Your task is to implement an Output.ai workflow based on a provided plan document.
The workflow directory is provided as an argument (the workflow directory path). The workflow skeleton should already have been created there; if it has not, create it first.
Please read the plan file and implement the workflow according to its specifications.
Use the todo tool to track your progress through the implementation process.
Implementation Rules
Overview
Implement the workflow described in the plan document, following Output SDK patterns and best practices.
EXECUTE: Claude Skill: output-meta-pre-flight
Step 1: Plan Analysis
Read and understand the plan document.
- Read the plan file from the provided plan file path
- Identify the workflow name, description, and purpose
- Extract input and output schema definitions
- List all required steps and their relationships
- Note any LLM-based steps that require prompt templates
- Understand error handling and retry requirements
Step 2: Workflow Implementation
Update workflow.ts in the workflow directory with the workflow definition.
const inputSchema = z.object( { // Define based on plan } );
const outputSchema = z.object( { // Define based on plan } );
export default workflow( { name: 'workflow-name-from-plan', description: 'Description from plan', inputSchema, outputSchema, fn: async input => { // Implement orchestration logic from plan const result = await stepName( input ); return { result }; } } );
</workflow_template>
</step>
<step number="3" name="steps_implementation" subagent="workflow-quality">
### Step 3: Steps Implementation
Update `steps.ts` in the workflow directory with all step definitions from the plan.
<implementation_checklist>
- Import required dependencies (step, z from '@outputai/core')
- Implement each step with proper schema validation
- Add error handling and retry logic as specified
- Ensure step names match plan specifications
- Add descriptive comments for complex logic
</implementation_checklist>
<step_template>
```typescript
import { step, z } from '@outputai/core';
export const stepName = step( {
name: 'stepName',
description: 'Description from plan',
inputSchema: z.object( {
// Define based on plan
} ),
outputSchema: z.object( {
// Define based on plan
} ),
fn: async input => {
// Implement step logic from plan
return output;
}
} );
Step 3.5: Evaluators Implementation (if needed)
If the plan includes evaluator functions, implement them in evaluators.ts in the workflow directory.
export const evaluateName = evaluator( { name: 'evaluate_name', description: 'Description from plan', inputSchema: z.object( { // Define based on plan } ), fn: async input => { // Implement evaluation logic from plan return new EvaluationBooleanResult( { value: true, confidence: 0.95, reasoning: 'Explanation of evaluation' } ); } } );
</evaluator_template>
</step>
<step number="4" name="prompt_templates" subagent="workflow-prompt-writer">
### Step 4: Prompt Templates (if needed)
If the plan includes LLM-based steps, create prompt templates in the `prompts/` subdirectory of the workflow directory.
<decision_tree>
IF plan_includes_llm_steps:
CREATE prompt_templates
UPDATE steps.ts to use loadPrompt and generateText
ELSE:
SKIP to step 6
</decision_tree>
<llm_step_template>
```typescript
import { step, z } from '@outputai/core';
import { generateText } from '@outputai/llm';
export const llmStep = step( {
name: 'llmStep',
description: 'LLM-based step',
inputSchema: z.object( {
param: z.string()
} ),
outputSchema: z.string(),
fn: async ( { param } ) => {
const { result } = await generateText( {
prompt: 'prompt_name@v1',
variables: { param }
} );
return result;
}
} );
Step 5: README Update
Update README.md in the workflow directory with workflow-specific documentation.
Step 6: Scenario File Creation
Create at least one scenario file in the scenarios/ subdirectory of the workflow directory for testing the workflow.
Create scenarios/test_input.json:
{
"topic": "The history of artificial intelligence",
"maxLength": 500
}
Step 7: Implementation Validation
Verify the implementation is complete and correct.
Step 8: Post-Flight Check
Verify the implementation is ready for use.
---- START ----
Use the workflow name, workflow directory, and plan file path provided as arguments, along with any additional instructions the user provided.