with one click
flow-create-scenario-files
// Create scenario files for testing migrated Output SDK workflows. Use to set up test inputs in the scenarios/ subfolder.
// Create scenario files for testing migrated Output SDK workflows. Use to set up test inputs in the scenarios/ subfolder.
Validate and fix folder structure for Output SDK workflows. Use to ensure migrated workflows follow the correct structure conventions.
Convert Flow SDK activities.ts to Output SDK steps.ts. Use when migrating activity functions to step definitions with typed parameters.
Convert inline prompts and prompt arrays to .prompt files with YAML frontmatter. Use when migrating prompts from Flow SDK format to Output SDK prompt files.
Convert Flow SDK workflow class to Output SDK workflow() function. Use when migrating workflow.ts files from class-based to functional definitions.
Fix ESLint issues in migrated Output SDK code. Use when seeing lint errors after migration, or when writing new Output SDK code that needs to follow project conventions.
Remove try-catch antipattern from step calls during Flow to Output SDK migration. Use when converting workflow code that wraps step calls in try-catch blocks.
| name | flow-create-scenario-files |
| description | Create scenario files for testing migrated Output SDK workflows. Use to set up test inputs in the scenarios/ subfolder. |
| allowed-tools | ["Bash","Read","Write","Edit"] |
This skill helps create scenario files - JSON files containing test inputs for Output SDK workflows. Scenario files enable consistent testing and validation of migrated workflows.
After Migration:
During Development:
Scenario files live in a scenarios/ subfolder within the workflow directory:
src/workflows/my_workflow/
āāā workflow.ts
āāā steps.ts
āāā types.ts
āāā analyze@v1.prompt
āāā scenarios/
āāā basic_input.json
āāā edge_case_empty.json
āāā full_options.json
Scenario files are JSON files that match the workflow's input schema:
{
"userId": "user-123",
"options": {
"includeDetails": true,
"maxResults": 10
}
}
Use descriptive names that indicate the test case:
basic_input.json # Standard happy path
edge_case_empty.json # Empty or minimal input
edge_case_large.json # Large data input
error_missing_field.json # Missing required field (for error testing)
full_options.json # All optional fields included
question_ada_lovelace.json # Specific test scenario description
Use the Output CLI to run a workflow with a scenario file:
# Basic usage
npx output workflow run <workflow_name> --input src/<workflow>/scenarios/<scenario>.json
# Examples
npx output workflow run simple --input src/simple/scenarios/question_ada_lovelace.json
npx output workflow run userReport --input src/workflows/user_report/scenarios/basic_input.json
Review the workflow's input schema in types.ts or workflow.ts:
// types.ts
export const WorkflowInputSchema = z.object( {
userId: z.string(),
reportType: z.enum( [ 'daily', 'weekly', 'monthly' ] ),
options: z.object( {
includeCharts: z.boolean().optional(),
maxPages: z.number().optional()
} ).optional()
} );
mkdir -p src/workflows/my_workflow/scenarios
Start with a minimal valid input:
{
"userId": "test-user-001",
"reportType": "daily"
}
Full Options Scenario:
{
"userId": "test-user-001",
"reportType": "weekly",
"options": {
"includeCharts": true,
"maxPages": 5
}
}
Edge Case - Empty Optional:
{
"userId": "test-user-002",
"reportType": "monthly",
"options": {}
}
If the Flow SDK workflow had test files, convert them to scenarios:
// Original test
describe('UserReportWorkflow', () => {
it('generates daily report', async () => {
const input = {
userId: 'test-123',
reportType: 'daily'
};
const result = await workflow.execute(input);
expect(result.success).toBe(true);
});
});
// scenarios/daily_report.json
{
"userId": "test-123",
"reportType": "daily"
}
Run with:
npx output workflow run userReport --input src/workflows/user_report/scenarios/daily_report.json
Test normal, expected usage:
// scenarios/basic_user.json
{
"userId": "user-12345",
"action": "process"
}
Test boundary conditions:
// scenarios/edge_empty_string.json
{
"userId": "",
"action": "validate"
}
// scenarios/edge_long_input.json
{
"userId": "user-12345",
"content": "Very long content string repeated many times..."
}
Test error handling (may cause expected failures):
// scenarios/error_invalid_type.json
{
"userId": 12345,
"action": "process"
}
Test complex inputs:
// scenarios/complex_nested.json
{
"userId": "user-001",
"documents": [
{
"id": "doc-1",
"title": "First Document",
"content": "Content of first document"
},
{
"id": "doc-2",
"title": "Second Document",
"content": "Content of second document"
}
],
"options": {
"processAll": true,
"outputFormat": "json"
}
}
// types.ts
import { z } from '@outputai/core';
export const AnalyzeDocumentInputSchema = z.object( {
documentId: z.string(),
documentText: z.string(),
analysisType: z.enum( [ 'summary', 'entities', 'sentiment', 'full' ] ),
options: z.object( {
language: z.string().optional(),
maxLength: z.number().optional(),
includeConfidence: z.boolean().optional()
} ).optional()
} );
scenarios/basic_summary.json:
{
"documentId": "doc-001",
"documentText": "This is a sample document about artificial intelligence and its applications in modern business.",
"analysisType": "summary"
}
scenarios/full_analysis_with_options.json:
{
"documentId": "doc-002",
"documentText": "Detailed technical document content here...",
"analysisType": "full",
"options": {
"language": "en",
"maxLength": 500,
"includeConfidence": true
}
}
scenarios/edge_minimal.json:
{
"documentId": "doc-min",
"documentText": "Short.",
"analysisType": "summary"
}
scenarios/edge_empty_options.json:
{
"documentId": "doc-003",
"documentText": "Document with empty options object.",
"analysisType": "entities",
"options": {}
}
# Test basic scenario
npx output workflow run analyzeDocument --input src/workflows/analyze_document/scenarios/basic_summary.json
# Test full options
npx output workflow run analyzeDocument --input src/workflows/analyze_document/scenarios/full_analysis_with_options.json
# Test edge cases
npx output workflow run analyzeDocument --input src/workflows/analyze_document/scenarios/edge_minimal.json
Use this template to create new scenarios:
{
"_scenario": {
"name": "Descriptive scenario name",
"description": "What this scenario tests",
"expectedOutcome": "success|error|specific behavior"
},
"field1": "value1",
"field2": "value2",
"optionalField": "optional value"
}
Note: The _scenario metadata field is optional and ignored by the workflow. It's useful for documentation.
After creating scenarios, verify they work:
# List all scenarios
ls src/workflows/my_workflow/scenarios/
# Run each scenario
for f in src/workflows/my_workflow/scenarios/*.json; do
echo "Testing: $f"
npx output workflow run my_workflow --input "$f"
done
flow-validation-checklist - Complete migration validationflow-analyze-workflow-structure - Understanding workflow inputsflow-conventions-folder-structure - Folder structure conventions