🏗️output-dev-create-skeleton
- プラグイン
- outputai
- ソース
- GitHub で見る ↗
説明
ワークフローのスケルトンファイルを Output SDK CLI を使って生成します。 次のような場合に使用: - 新しいワークフローを開始するとき - プロジェクト構造をスキャフォールディングするとき - 生成されたファイルのレイアウトを把握したいとき
原文を表示
Generate workflow skeleton files using the Output SDK CLI. Use when starting a new workflow, scaffolding project structure, or understanding the generated file layout.
ユースケース
- ✓新しいワークフローを開始するとき
- ✓プロジェクト構造をスキャフォールディングするとき
- ✓生成されたファイルのレイアウトを把握したいとき
本文(日本語訳)
Output SDK CLI を使ったワークフロースケルトンの生成
概要
このスキルでは、Output SDK CLI を使用してワークフローのスケルトンを生成する方法を説明します。 スケルトンは、必要なすべてのファイルと適切な構造が揃った出発点を提供します。
次のような場合に使用
- 新しいワークフローをゼロから始めるとき
- ワークフローに必要なファイルを把握したいとき
- 実装前に基本構造をスキャフォールドしたいとき
- Output SDK のワークフローパターンを学びたいとき
CLI コマンド
npx output workflow generate --skeleton
このコマンドは、新しいワークフロー用の基本ファイル構造を生成します。
生成されるファイル構造
スケルトンジェネレーターを実行すると、以下のファイル構造が作成されます:
src/workflows/{workflow-name}/
├── workflow.ts # メインのワークフロー定義
├── steps.ts # ステップ関数の定義
├── types.ts # Zod スキーマと型定義
├── prompts/ # プロンプトファイル用の空フォルダ
└── scenarios/ # テストシナリオ用の空フォルダ
プロジェクト構造の概要
スケルトンは、Output SDK の標準プロジェクト構造内に生成されます:
src/
├── shared/ # 共有コード(必要に応じて作成)
│ ├── clients/ # API クライアント
│ ├── utils/ # ユーティリティ関数
│ ├── services/ # ビジネスロジックサービス
│ ├── steps/ # 共有ステップ(任意)
│ └── evaluators/ # 共有エバリュエーター(任意)
└── workflows/
└── {workflow-name}/ # 新しいワークフロー
├── workflow.ts
├── steps.ts
├── types.ts
├── prompts/
└── scenarios/
生成後の手順
ステップ 1: 生成されたファイルを確認する
生成後、各ファイルを確認してテンプレート構造を把握します:
workflow.ts — 基本的なワークフローテンプレートを含みます:
import { workflow, z } from '@outputai/core';
import { exampleStep } from './steps.js';
import { WorkflowInputSchema } from './types.js';
export default workflow( {
name: 'workflowName',
description: 'Workflow description',
inputSchema: WorkflowInputSchema,
outputSchema: z.object( { result: z.string() } ),
fn: async input => {
const result = await exampleStep( input );
return { result };
}
} );
steps.ts — ステップのサンプルテンプレートを含みます:
import { step, z } from '@outputai/core';
import { ExampleStepInputSchema } from './types.js';
export const exampleStep = step( {
name: 'exampleStep',
description: 'Example step description',
inputSchema: ExampleStepInputSchema,
outputSchema: z.object( { result: z.string() } ),
fn: async input => {
// ステップのロジックをここに実装
return { result: 'example' };
}
} );
types.ts — スキーマ定義を含みます:
import { z } from '@outputai/core';
export const WorkflowInputSchema = z.object( {
// 入力フィールドを定義
} );
export type WorkflowInput = z.infer<typeof WorkflowInputSchema>;
ステップ 2: ワークフロー名をカスタマイズする
- フォルダ名をワークフローに合わせて変更する
workflow.tsのnameプロパティを更新する- 以下の命名規則に従う:
- フォルダ名:
snake_case(例:image_processor) - ワークフロー名:
camelCase(例:imageProcessor)
- フォルダ名:
ステップ 3: スキーマを定義する
types.ts で実際の入出力スキーマを定義します:
import { z } from '@outputai/core';
export const WorkflowInputSchema = z.object( {
content: z.string().describe( 'Content to process' ),
options: z.object( {
format: z.enum( [ 'json', 'text' ] ).default( 'json' )
} ).optional()
} );
export type WorkflowInput = z.infer<typeof WorkflowInputSchema>;
export type WorkflowOutput = { processed: string };
関連スキル: output-dev-types-file
ステップ 4: ステップを実装する
サンプルステップを実際のステップ実装に置き換えます:
import { step, z, FatalError, ValidationError } from '@outputai/core';
import { httpClient } from '@outputai/http';
import { ProcessContentInputSchema } from './types.js';
export const processContent = step( {
name: 'processContent',
description: 'Process the input content',
inputSchema: ProcessContentInputSchema,
outputSchema: z.object( { processed: z.string() } ),
fn: async ( { content } ) => {
// ロジックを実装
return { processed: content.toUpperCase() };
}
} );
関連スキル: output-dev-step-function
ステップ 5: ワークフローを更新する
ワークフロー内でステップを接続します:
import { workflow, z } from '@outputai/core';
import { processContent } from './steps.js';
import { WorkflowInputSchema } from './types.js';
export default workflow( {
name: 'contentProcessor',
description: 'Process content with custom logic',
inputSchema: WorkflowInputSchema,
outputSchema: z.object( { processed: z.string() } ),
fn: async input => {
const result = await processContent( { content: input.content } );
return result;
}
} );
関連スキル: output-dev-workflow-function
ステップ 6: プロンプトを追加する(必要な場合)
ワークフローで LLM オペレーションを使用する場合は、プロンプトファイルを作成します:
prompts/
└── analyzeContent@v1.prompt
関連スキル: output-dev-prompt-file
ステップ 7: テストシナリオを作成する
scenarios フォルダにテスト用入力ファイルを追加します:
scenarios/
├── basic_input.json
└── complex_input.json
関連スキル: output-dev-scenario-file
ステップ 8: 共有リソースをセットアップする(必要な場合)
ワークフローで共有クライアント・ユーティリティ・サービスが必要な場合:
# 共有ディレクトリが存在しない場合は作成
mkdir -p src/shared/clients
mkdir -p src/shared/utils
mkdir -p src/shared/services
ステップ内で共有リソースをインポートします:
import { GeminiService } from '../../shared/clients/gemini_client.js';
import { formatDate } from '../../shared/utils/date_helpers.js';
関連スキル: output-dev-http-client-create
検証
カスタマイズ後、ワークフローを以下の手順で確認します:
1. 利用可能なワークフローの一覧を表示する
npx output workflow list
作成したワークフローが一覧に表示されていることを確認します。
2. テスト入力で実行する
npx output workflow run {workflowName} --input path/to/scenarios/basic_input.json
3. エラーを確認する
スケルトン生成後によくある問題:
- インポートパスに
.js拡張子がない zodからzをインポートしている(@outputai/coreから インポートする必要あり)- ステップのエクスポートが不足している
カスタマイズのヒント
複数のステップを追加する
// steps.ts
export const stepOne = step( { ... } );
export const stepTwo = step( { ... } );
export const stepThree = step( { ... } );
// workflow.ts
const resultOne = await stepOne( input );
const resultTwo = await stepTwo( resultOne );
const resultThree = await stepThree( resultTwo );
ステップの並列実行
// workflow.ts
const [ resultA, resultB ] = await Promise.all( [
stepA( input ),
stepB( input )
] );
条件付きステップ
// workflow.ts
if ( input.processImages ) {
await processImages( input );
}
大規模ワークフロー — フォルダベースの構成
ステップ数が多いワークフローでは、フォルダベースの構成を使用します:
src/workflows/{workflow-name}/
├── workflow.ts
├── steps/ # 単一ファイルの代わりにフォルダを使用
│ ├── fetch_data.ts
│ ├── process.ts
│ └── validate.ts
├── types.ts
└── ...
検証チェックリスト
スケルトンを生成・カスタマイズした後、以下を確認します:
- [ ] ワークフローフォルダが
snake_case命名規則に従っている - [ ]
workflow.tsの name が camelCase で正しく設定されている - [ ] すべてのインポートに
.js拡張子が付いている - [ ]
zが@outputai/coreからインポートされている - [ ] 型が
types.tsに定義されている - [ ] ステップが
steps.tsまたはsteps/フォルダに定義されている - [ ] テストシナリオが少なくとも 1 つ存在する
- [ ]
npx output workflow listにワークフローが表示される - [ ] 共有リソース(存在する場合)が
src/shared/に配置されている
関連スキル
output-dev-folder-structure— フォルダ全体のレイアウトを理解するoutput-dev-workflow-function— workflow.ts の詳細ドキュメントoutput-dev-step-function— steps.ts の詳細ドキュメントoutput-dev-types-file— Zod スキーマの作成output-dev-prompt-file— LLM プロンプトの追加output-dev-scenario-file— テストシナリオの作成output-workflow-run— ワークフローの実行output-dev-code-style— コードスタイルの規則output-workflow-list— 利用可能なワークフローの一覧表示
原文(English)を表示
Generate Workflow Skeleton with Output SDK CLI
Overview
This skill documents how to use the Output SDK CLI to generate a workflow skeleton. The skeleton provides a starting point with all required files and proper structure.
When to Use This Skill
- Starting a new workflow from scratch
- Understanding what files are needed for a workflow
- Scaffolding the basic structure before implementation
- Learning the Output SDK workflow patterns
CLI Command
npx output workflow generate --skeleton
This command creates the basic file structure for a new workflow.
Generated File Structure
After running the skeleton generator, you will have:
src/workflows/{workflow-name}/
├── workflow.ts # Main workflow definition
├── steps.ts # Step function definitions
├── types.ts # Zod schemas and types
├── prompts/ # Empty folder for prompt files
└── scenarios/ # Empty folder for test scenarios
Project Structure Overview
The skeleton is created within the standard Output SDK project structure:
src/
├── shared/ # Shared code (create if needed)
│ ├── clients/ # API clients
│ ├── utils/ # Utility functions
│ ├── services/ # Business logic services
│ ├── steps/ # Shared steps (optional)
│ └── evaluators/ # Shared evaluators (optional)
└── workflows/
└── {workflow-name}/ # Your new workflow
├── workflow.ts
├── steps.ts
├── types.ts
├── prompts/
└── scenarios/
Post-Generation Steps
Step 1: Review Generated Files
After generation, review each file to understand the template structure:
workflow.ts - Contains a basic workflow template:
import { workflow, z } from '@outputai/core';
import { exampleStep } from './steps.js';
import { WorkflowInputSchema } from './types.js';
export default workflow( {
name: 'workflowName',
description: 'Workflow description',
inputSchema: WorkflowInputSchema,
outputSchema: z.object( { result: z.string() } ),
fn: async input => {
const result = await exampleStep( input );
return { result };
}
} );
steps.ts - Contains example step template:
import { step, z } from '@outputai/core';
import { ExampleStepInputSchema } from './types.js';
export const exampleStep = step( {
name: 'exampleStep',
description: 'Example step description',
inputSchema: ExampleStepInputSchema,
outputSchema: z.object( { result: z.string() } ),
fn: async input => {
// Implement step logic here
return { result: 'example' };
}
} );
types.ts - Contains schema definitions:
import { z } from '@outputai/core';
export const WorkflowInputSchema = z.object( {
// Define input fields
} );
export type WorkflowInput = z.infer<typeof WorkflowInputSchema>;
Step 2: Customize the Workflow Name
- Update the folder name to match your workflow
- Update the
nameproperty inworkflow.ts - Follow naming conventions:
- Folder:
snake_case(e.g.,image_processor) - Workflow name:
camelCase(e.g.,imageProcessor)
- Folder:
Step 3: Define Your Schemas
In types.ts, define your actual input/output schemas:
import { z } from '@outputai/core';
export const WorkflowInputSchema = z.object( {
content: z.string().describe( 'Content to process' ),
options: z.object( {
format: z.enum( [ 'json', 'text' ] ).default( 'json' )
} ).optional()
} );
export type WorkflowInput = z.infer<typeof WorkflowInputSchema>;
export type WorkflowOutput = { processed: string };
Related Skill: output-dev-types-file
Step 4: Implement Your Steps
Replace the example step with your actual step implementations:
import { step, z, FatalError, ValidationError } from '@outputai/core';
import { httpClient } from '@outputai/http';
import { ProcessContentInputSchema } from './types.js';
export const processContent = step( {
name: 'processContent',
description: 'Process the input content',
inputSchema: ProcessContentInputSchema,
outputSchema: z.object( { processed: z.string() } ),
fn: async ( { content } ) => {
// Implement your logic
return { processed: content.toUpperCase() };
}
} );
Related Skill: output-dev-step-function
Step 5: Update the Workflow
Wire up your steps in the workflow:
import { workflow, z } from '@outputai/core';
import { processContent } from './steps.js';
import { WorkflowInputSchema } from './types.js';
export default workflow( {
name: 'contentProcessor',
description: 'Process content with custom logic',
inputSchema: WorkflowInputSchema,
outputSchema: z.object( { processed: z.string() } ),
fn: async input => {
const result = await processContent( { content: input.content } );
return result;
}
} );
Related Skill: output-dev-workflow-function
Step 6: Add Prompts (If Needed)
If your workflow uses LLM operations, create prompt files:
prompts/
└── analyzeContent@v1.prompt
Related Skill: output-dev-prompt-file
Step 7: Create Test Scenarios
Add test input files to the scenarios folder:
scenarios/
├── basic_input.json
└── complex_input.json
Related Skill: output-dev-scenario-file
Step 8: Set Up Shared Resources (If Needed)
If your workflow needs shared clients, utilities, or services:
# Create shared directories if they don't exist
mkdir -p src/shared/clients
mkdir -p src/shared/utils
mkdir -p src/shared/services
Import shared resources in your steps:
import { GeminiService } from '../../shared/clients/gemini_client.js';
import { formatDate } from '../../shared/utils/date_helpers.js';
Related Skill: output-dev-http-client-create
Verification
After customization, verify your workflow:
1. List Available Workflows
npx output workflow list
Your workflow should appear in the list.
2. Run with Test Input
npx output workflow run {workflowName} --input path/to/scenarios/basic_input.json
3. Check for Errors
Common issues after skeleton generation:
- Import paths missing
.jsextension - Schema imported from
zodinstead of@outputai/core - Missing step exports
Customization Tips
Adding Multiple Steps
// steps.ts
export const stepOne = step( { ... } );
export const stepTwo = step( { ... } );
export const stepThree = step( { ... } );
// workflow.ts
const resultOne = await stepOne( input );
const resultTwo = await stepTwo( resultOne );
const resultThree = await stepThree( resultTwo );
Parallel Step Execution
// workflow.ts
const [ resultA, resultB ] = await Promise.all( [
stepA( input ),
stepB( input )
] );
Conditional Steps
// workflow.ts
if ( input.processImages ) {
await processImages( input );
}
Large Workflows - Folder-Based Organization
For workflows with many steps, use folder-based organization:
src/workflows/{workflow-name}/
├── workflow.ts
├── steps/ # Folder instead of single file
│ ├── fetch_data.ts
│ ├── process.ts
│ └── validate.ts
├── types.ts
└── ...
Verification Checklist
After generating and customizing the skeleton:
- [ ] Workflow folder follows
snake_casenaming - [ ]
workflow.tshas correct name in camelCase - [ ] All imports use
.jsextension - [ ]
zis imported from@outputai/core - [ ] Types are defined in
types.ts - [ ] Steps are defined in
steps.tsorsteps/folder - [ ] At least one test scenario exists
- [ ] Workflow appears in
npx output workflow list - [ ] Shared resources (if any) are in
src/shared/
Related Skills
output-dev-folder-structure- Understanding the complete folder layoutoutput-dev-workflow-function- Detailed workflow.ts documentationoutput-dev-step-function- Detailed steps.ts documentationoutput-dev-types-file- Creating Zod schemasoutput-dev-prompt-file- Adding LLM promptsoutput-dev-scenario-file- Creating test scenariosoutput-workflow-run- Running workflowsoutput-dev-code-style- Code style conventionsoutput-workflow-list- Listing available workflows
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。