📋output-dev-scenario-file
- プラグイン
- outputai
- ソース
- GitHub で見る ↗
説明
テスト用のシナリオJSONファイルをOutput SDKワークフロー向けに作成します。 次のような場合に使用: - テスト用の入力データを作成するとき - 期待される動作をドキュメント化するとき - ワークフローのテスト環境をセットアップするとき
原文を表示
Create test scenario JSON files for Output SDK workflows. Use when creating test inputs, documenting expected behaviors, or setting up workflow testing.
ユースケース
- ✓テスト用の入力データを作成するとき
- ✓期待される動作をドキュメント化するとき
- ✓ワークフローのテスト環境をセットアップするとき
本文(日本語訳)
シナリオファイルの作成
概要
このスキルは、Output SDK ワークフロー向けのテストシナリオ JSON ファイルの作成方法を解説します。 シナリオは、開発・検証フェーズにおいてワークフローをテストするための事前定義済み入力値を提供します。
次のような場合に使用
- 新しいワークフロー向けのテスト入力を作成する
- 異なるユースケースをドキュメント化する
- リグレッションテストをセットアップする
- 特定の入力でワークフローの動作をデバッグする
配置場所の規則
シナリオファイルはワークフローフォルダの内部に配置します:
src/workflows/{workflow-name}/
├── workflow.ts
├── steps.ts
├── types.ts
└── scenarios/
├── basic_input.json
├── complex_input.json
└── edge_case_empty.json
重要: シナリオはワークフロー固有のものであり、ワークフローフォルダ内に配置します。
ファイル命名規則
シナリオファイル名には snake_case を使用します:
{説明}_input.json
例:
basic_input.jsontest_input_solar_panels.jsonedge_case_empty_content.jsoncomplex_with_references.json
命名パターン:
basic_*― 最小限の有効な入力complex_*― すべてのオプションを含むフル機能の入力edge_case_*― 境界条件とエッジケースerror_*― エラーが発生することを想定した入力
基本構造
シナリオファイルは、ワークフローの inputSchema に対応する JSON ファイルです:
{
"fieldName": "value",
"optionalField": "optional value",
"numericField": 42,
"arrayField": ["item1", "item2"]
}
inputSchema との対応
シナリオ JSON は types.ts で定義された Zod スキーマと一致している必要があります。
スキーマの例 (types.ts)
export const WorkflowInputSchema = z.object({
content: z.string().describe('Text content to process'),
numberOfIdeas: z.number().min(1).max(10).default(1),
colorPalette: z.string().optional(),
aspectRatio: z.enum(['1:1', '16:9', '9:16']).default('1:1'),
referenceUrls: z.array(z.string()).optional()
});
対応するシナリオ
basic_input.json(必須フィールドのみ)
{
"content": "This is sample content for testing the workflow."
}
complete_input.json(全フィールドを指定)
{
"content": "This is sample content for testing the workflow.",
"numberOfIdeas": 3,
"colorPalette": "blue and green tones",
"aspectRatio": "16:9",
"referenceUrls": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
]
}
実例
image_infographic_nano ワークフローに基づく例:
test_input_solar_panels.json
{
"content": "Solar panels work by converting sunlight into electricity through the photovoltaic effect. The process begins when photons from sunlight strike the silicon cells in the panel, knocking electrons loose from their atoms. These free electrons flow through the semiconductor material, creating an electric current. The panels contain multiple layers: a protective glass covering, anti-reflective coating to maximize light absorption, silicon cells (both n-type and p-type layers forming a junction), and a backing material. The DC electricity generated by the panels flows through an inverter, which converts it to AC electricity suitable for home use or feeding back into the power grid. Modern solar panels achieve 15-20% efficiency, meaning they convert that percentage of sunlight into usable electricity. The entire system includes mounting hardware, wiring, inverters, and often battery storage for excess energy.",
"numberOfIdeas": 3,
"aspectRatio": "16:9",
"resolution": "2K",
"numberOfGenerations": 1
}
test_input_complex.json
{
"content": "Detailed explanation of the topic...",
"numberOfIdeas": 5,
"colorPalette": "warm earth tones with orange accents",
"artDirection": "minimalist corporate style",
"aspectRatio": "1:1",
"resolution": "4K",
"numberOfGenerations": 2,
"referenceImageUrls": [
"https://storage.example.com/style-guide.png"
],
"storageNamespace": "test/infographics"
}
シナリオの実行
CLI を使用する場合
# シナリオファイルを指定して実行
npx output workflow run workflowName --input path/to/scenarios/basic_input.json
# インライン JSON を指定して実行
npx output workflow run workflowName --input '{"content": "test"}'
コマンド例
# 基本シナリオ
npx output workflow run contentUtilsImageInfographicNano --input src/workflows/content_utils/image_infographic_nano/scenarios/test_input_solar_panels.json
# 複合シナリオ
npx output workflow run contentUtilsImageInfographicNano --input src/workflows/content_utils/image_infographic_nano/scenarios/test_input_complex.json
関連スキル: CLI の詳細な使い方は output-workflow-run を参照してください。
シナリオのカテゴリ
1. 基本 / ハッピーパス
ワークフローが正常に動作することを確認するための最小限の有効な入力:
{
"content": "Simple test content",
"numberOfIdeas": 1
}
2. 完全 / フル機能
すべてのオプションフィールドを指定した入力:
{
"content": "Detailed content...",
"numberOfIdeas": 5,
"colorPalette": "custom palette",
"artDirection": "specific style",
"aspectRatio": "16:9",
"resolution": "4K",
"numberOfGenerations": 3,
"referenceImageUrls": ["https://example.com/ref.jpg"],
"storageNamespace": "test/folder"
}
3. エッジケース
境界条件をテストします:
edge_case_min_values.json
{
"content": "x",
"numberOfIdeas": 1
}
edge_case_max_values.json
{
"content": "Very long content string...",
"numberOfIdeas": 10
}
4. エラーケース(バリデーションテスト用)
error_missing_required.json
{
"numberOfIdeas": 3
}
注意: エラーシナリオはバリデーションを通過しませんが、エラーハンドリングのテストに役立ちます。
ベストプラクティス
1. 目的をドキュメント化する
コメントフィールド(サポートされている場合)を追加するか、付属の README を作成します:
{
"_comment": "複数の参照画像を使用したワークフローのテスト",
"content": "...",
"referenceImageUrls": ["url1", "url2", "url3"]
}
2. リアルなデータを使用する
{
"content": "実際のユースケースを反映した、代表的なコンテンツ..."
}
以下のような内容は避けてください:
{
"content": "test"
}
3. すべての enum 値をカバーする
スキーマに enum がある場合、それぞれの値に対してシナリオを作成します:
// scenario_aspect_1x1.json
{ "aspectRatio": "1:1", ... }
// scenario_aspect_16x9.json
{ "aspectRatio": "16:9", ... }
// scenario_aspect_9x16.json
{ "aspectRatio": "9:16", ... }
4. オプションフィールドのバリエーションを含める
// without_optional_fields.json
{ "content": "..." }
// with_all_optional_fields.json
{ "content": "...", "colorPalette": "...", "artDirection": "..." }
// with_some_optional_fields.json
{ "content": "...", "colorPalette": "..." }
5. リグレッションテスト用シナリオを作成する
バグ報告の入力値を保存しておきます:
// regression_issue_123.json
{
"_issue": "https://github.com/org/repo/issues/123",
"content": "バグを引き起こした入力値..."
}
シナリオの整理
シナリオが多いワークフローでは、サブフォルダで整理します:
scenarios/
├── basic/
│ └── minimal_input.json
├── complete/
│ └── all_options.json
├── edge_cases/
│ ├── empty_array.json
│ └── max_length.json
└── regression/
└── issue_123.json
確認チェックリスト
- [ ] シナリオファイルがワークフローディレクトリ内の
scenarios/フォルダに配置されている - [ ] ファイルの拡張子が
.jsonである - [ ] ファイル名が
snake_caseを使用している - [ ] JSON が有効でパース可能である
- [ ] inputSchema の必須フィールドがすべて含まれている
- [ ] フィールドの型がスキーマと一致している(文字列、数値、配列など)
- [ ] enum の値がスキーマで定義された有効なオプションである
- [ ] 数値が min/max の制約内に収まっている
- [ ] 少なくとも1つの基本シナリオが存在する
- [ ] そのシナリオでワークフローが正常に実行される
シナリオのテスト
JSON 構文の検証
# JSON が有効かどうか確認する
cat scenarios/basic_input.json | jq .
実行と結果の確認
# シナリオを使ってワークフローを実行する
npx output workflow run workflowName --input scenarios/basic_input.json
# 非同期の場合はステータスを確認する
npx output workflow status <workflowId>
# 結果を取得する
npx output workflow result <workflowId>
関連スキル
output-dev-types-file― シナリオが準拠すべき inputSchema の定義output-dev-folder-structure― scenarios フォルダの配置場所の理解output-workflow-run― シナリオファイルを使ったワークフローの実行output-workflow-list― 利用可能なワークフローの検索
原文(English)を表示
Creating Scenario Files
Overview
This skill documents how to create test scenario JSON files for Output SDK workflows. Scenarios provide predefined inputs for testing workflows during development and validation.
When to Use This Skill
- Creating test inputs for a new workflow
- Documenting different use cases
- Setting up regression tests
- Debugging workflow behavior with specific inputs
Location Convention
Scenario files are stored INSIDE the workflow folder:
src/workflows/{workflow-name}/
├── workflow.ts
├── steps.ts
├── types.ts
└── scenarios/
├── basic_input.json
├── complex_input.json
└── edge_case_empty.json
Important: Scenarios are workflow-specific and live inside the workflow folder.
File Naming Convention
Use snake_case for scenario file names:
{description}_input.json
Examples:
basic_input.jsontest_input_solar_panels.jsonedge_case_empty_content.jsoncomplex_with_references.json
Naming patterns:
basic_*- Minimal valid inputcomplex_*- Full-featured input with all optionsedge_case_*- Boundary conditions and edge caseserror_*- Inputs expected to produce errors
Basic Structure
A scenario file is a JSON file that matches the workflow's inputSchema:
{
"fieldName": "value",
"optionalField": "optional value",
"numericField": 42,
"arrayField": ["item1", "item2"]
}
Matching inputSchema
The scenario JSON must match the Zod schema defined in types.ts:
Example Schema (types.ts)
export const WorkflowInputSchema = z.object({
content: z.string().describe('Text content to process'),
numberOfIdeas: z.number().min(1).max(10).default(1),
colorPalette: z.string().optional(),
aspectRatio: z.enum(['1:1', '16:9', '9:16']).default('1:1'),
referenceUrls: z.array(z.string()).optional()
});
Corresponding Scenarios
basic_input.json (minimal required fields)
{
"content": "This is sample content for testing the workflow."
}
complete_input.json (all fields specified)
{
"content": "This is sample content for testing the workflow.",
"numberOfIdeas": 3,
"colorPalette": "blue and green tones",
"aspectRatio": "16:9",
"referenceUrls": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
]
}
Real-World Example
Based on image_infographic_nano workflow:
test_input_solar_panels.json
{
"content": "Solar panels work by converting sunlight into electricity through the photovoltaic effect. The process begins when photons from sunlight strike the silicon cells in the panel, knocking electrons loose from their atoms. These free electrons flow through the semiconductor material, creating an electric current. The panels contain multiple layers: a protective glass covering, anti-reflective coating to maximize light absorption, silicon cells (both n-type and p-type layers forming a junction), and a backing material. The DC electricity generated by the panels flows through an inverter, which converts it to AC electricity suitable for home use or feeding back into the power grid. Modern solar panels achieve 15-20% efficiency, meaning they convert that percentage of sunlight into usable electricity. The entire system includes mounting hardware, wiring, inverters, and often battery storage for excess energy.",
"numberOfIdeas": 3,
"aspectRatio": "16:9",
"resolution": "2K",
"numberOfGenerations": 1
}
test_input_complex.json
{
"content": "Detailed explanation of the topic...",
"numberOfIdeas": 5,
"colorPalette": "warm earth tones with orange accents",
"artDirection": "minimalist corporate style",
"aspectRatio": "1:1",
"resolution": "4K",
"numberOfGenerations": 2,
"referenceImageUrls": [
"https://storage.example.com/style-guide.png"
],
"storageNamespace": "test/infographics"
}
Running Scenarios
Using CLI
# Run with scenario file
npx output workflow run workflowName --input path/to/scenarios/basic_input.json
# Run with inline JSON
npx output workflow run workflowName --input '{"content": "test"}'
Example Commands
# Basic scenario
npx output workflow run contentUtilsImageInfographicNano --input src/workflows/content_utils/image_infographic_nano/scenarios/test_input_solar_panels.json
# Complex scenario
npx output workflow run contentUtilsImageInfographicNano --input src/workflows/content_utils/image_infographic_nano/scenarios/test_input_complex.json
Related Skill: output-workflow-run for detailed CLI usage
Scenario Categories
1. Basic/Happy Path
Minimal valid input to verify the workflow works:
{
"content": "Simple test content",
"numberOfIdeas": 1
}
2. Complete/Full-Featured
All optional fields populated:
{
"content": "Detailed content...",
"numberOfIdeas": 5,
"colorPalette": "custom palette",
"artDirection": "specific style",
"aspectRatio": "16:9",
"resolution": "4K",
"numberOfGenerations": 3,
"referenceImageUrls": ["https://example.com/ref.jpg"],
"storageNamespace": "test/folder"
}
3. Edge Cases
Test boundary conditions:
edge_case_min_values.json
{
"content": "x",
"numberOfIdeas": 1
}
edge_case_max_values.json
{
"content": "Very long content string...",
"numberOfIdeas": 10
}
4. Error Cases (for validation testing)
error_missing_required.json
{
"numberOfIdeas": 3
}
Note: Error scenarios won't pass validation but are useful for testing error handling.
Best Practices
1. Document the Purpose
Add a comment field (if supported) or create a companion README:
{
"_comment": "Tests workflow with multiple reference images",
"content": "...",
"referenceImageUrls": ["url1", "url2", "url3"]
}
2. Use Realistic Data
{
"content": "Actual representative content that matches real use cases..."
}
Not:
{
"content": "test"
}
3. Cover All Enum Values
If schema has enums, create scenarios for each:
// scenario_aspect_1x1.json
{ "aspectRatio": "1:1", ... }
// scenario_aspect_16x9.json
{ "aspectRatio": "16:9", ... }
// scenario_aspect_9x16.json
{ "aspectRatio": "9:16", ... }
4. Include Optional Field Variations
// without_optional_fields.json
{ "content": "..." }
// with_all_optional_fields.json
{ "content": "...", "colorPalette": "...", "artDirection": "..." }
// with_some_optional_fields.json
{ "content": "...", "colorPalette": "..." }
5. Create Regression Test Scenarios
Save inputs from bug reports:
// regression_issue_123.json
{
"_issue": "https://github.com/org/repo/issues/123",
"content": "Input that caused the bug..."
}
Scenario Organization
For workflows with many scenarios, organize into subfolders:
scenarios/
├── basic/
│ └── minimal_input.json
├── complete/
│ └── all_options.json
├── edge_cases/
│ ├── empty_array.json
│ └── max_length.json
└── regression/
└── issue_123.json
Verification Checklist
- [ ] Scenario file located in
scenarios/folder inside workflow directory - [ ] File uses
.jsonextension - [ ] File name uses
snake_case - [ ] JSON is valid and parseable
- [ ] All required fields from inputSchema are present
- [ ] Field types match schema (strings, numbers, arrays, etc.)
- [ ] Enum values are valid options from schema
- [ ] Numbers are within min/max constraints
- [ ] At least one basic scenario exists
- [ ] Workflow runs successfully with the scenario
Testing Scenarios
Validate JSON Syntax
# Check JSON is valid
cat scenarios/basic_input.json | jq .
Run and Verify
# Run workflow with scenario
npx output workflow run workflowName --input scenarios/basic_input.json
# Check status if async
npx output workflow status <workflowId>
# Get result
npx output workflow result <workflowId>
Related Skills
output-dev-types-file- Defining inputSchema that scenarios must matchoutput-dev-folder-structure- Understanding scenarios folder locationoutput-workflow-run- Running workflows with scenario filesoutput-workflow-list- Finding available workflows
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。