jpskill.com
🛠️ 開発・MCP コミュニティ

when-chaining-agent-pipelines-use-stream-chain

Chain agent outputs as inputs in sequential or parallel pipelines for data flow orchestration

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o when-chaining-agent-pipelines-use-stream-chain.zip https://jpskill.com/download/18794.zip && unzip -o when-chaining-agent-pipelines-use-stream-chain.zip && rm when-chaining-agent-pipelines-use-stream-chain.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/18794.zip -OutFile "$d\when-chaining-agent-pipelines-use-stream-chain.zip"; Expand-Archive "$d\when-chaining-agent-pipelines-use-stream-chain.zip" -DestinationPath $d -Force; ri "$d\when-chaining-agent-pipelines-use-stream-chain.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して when-chaining-agent-pipelines-use-stream-chain.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → when-chaining-agent-pipelines-use-stream-chain フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
2

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

[スキル名] when-chaining-agent-pipelines-use-stream-chain

エージェントパイプライン連結SOP

概要

このスキルは、あるエージェントからの出力が次のエージェントへの入力となるエージェントパイプラインの連結を実装し、ストリーミングデータフローによるシーケンシャルおよびパラレルな実行パターンをサポートします。

エージェントと責任

task-orchestrator

役割: パイプラインの調整とオーケストレーション 責任:

  • パイプラインアーキテクチャの設計
  • エージェントステージの接続
  • データフローの監視
  • パイプラインエラーの処理

memory-coordinator

役割: データフローと状態管理 責任:

  • 中間結果の保存
  • データ受け渡しの調整
  • パイプライン状態の管理
  • データの一貫性の確保

フェーズ1: パイプラインの設計

目的

ステージ、データフロー、実行戦略を含むパイプラインアーキテクチャを設計します。

スクリプト

# Design pipeline architecture
npx claude-flow@alpha pipeline design \
  --stages "research,analyze,code,test,review" \
  --flow sequential \
  --output pipeline-design.json

# Define data flow
npx claude-flow@alpha pipeline dataflow \
  --design pipeline-design.json \
  --output dataflow-spec.json

# Visualize pipeline
npx claude-flow@alpha pipeline visualize \
  --design pipeline-design.json \
  --output pipeline-diagram.png

# Store design in memory
npx claude-flow@alpha memory store \
  --key "pipeline/design" \
  --file pipeline-design.json

パイプラインパターン

シーケンシャルパイプライン:

Agent1 → Agent2 → Agent3 → Agent4

パラレルパイプライン:

       ┌─ Agent2 ─┐
Agent1 ├─ Agent3 ─┤ Agent5
       └─ Agent4 ─┘

ハイブリッドパイプライン:

Agent1 → ┬─ Agent2 ─┐
         └─ Agent3 ─┴─ Agent4 → Agent5

フェーズ2: エージェントの接続

目的

適切なデータフローチャネルと状態管理でエージェントを接続します。

スクリプト

# Initialize pipeline
npx claude-flow@alpha pipeline init \
  --design pipeline-design.json

# Spawn pipeline agents
npx claude-flow@alpha agent spawn --type researcher --pipeline-stage 1
npx claude-flow@alpha agent spawn --type analyst --pipeline-stage 2
npx claude-flow@alpha agent spawn --type coder --pipeline-stage 3
npx claude-flow@alpha agent spawn --type tester --pipeline-stage 4

# Connect pipeline stages
npx claude-flow@alpha pipeline connect \
  --from-stage 1 --to-stage 2 \
  --data-channel "memory"

npx claude-flow@alpha pipeline connect \
  --from-stage 2 --to-stage 3 \
  --data-channel "stream"

# Verify connections
npx claude-flow@alpha pipeline status --show-connections

データフローメカニズム

メモリベース:

# Agent 1 stores output
npx claude-flow@alpha memory store \
  --key "pipeline/stage-1/output" \
  --value "research findings..."

# Agent 2 retrieves input
npx claude-flow@alpha memory retrieve \
  --key "pipeline/stage-1/output"

ストリームベース:

# Agent 1 streams output
npx claude-flow@alpha stream write \
  --channel "stage-1-to-2" \
  --data "streaming data..."

# Agent 2 consumes stream
npx claude-flow@alpha stream read \
  --channel "stage-1-to-2"

フェーズ3: パイプラインの実行

目的

適切なシーケンスとデータフローでパイプラインを実行します。

スクリプト

# Execute sequential pipeline
npx claude-flow@alpha pipeline execute \
  --design pipeline-design.json \
  --input initial-data.json \
  --strategy sequential

# Execute parallel pipeline
npx claude-flow@alpha pipeline execute \
  --design pipeline-design.json \
  --input initial-data.json \
  --strategy parallel \
  --max-parallelism 3

# Monitor execution
npx claude-flow@alpha pipeline monitor --interval 5

# Track stage progress
npx claude-flow@alpha pipeline stages --show-progress

実行戦略

シーケンシャル:

  • ステージは順次実行されます
  • ステージNの出力がステージN+1の入力となります
  • シンプルなエラー処理
  • 予測可能な実行時間

パラレル:

  • 独立したステージが同時に実行されます
  • 出力は同期ポイントでマージされます
  • 複雑なエラー処理
  • 全体的な実行が高速

アダプティブ:

  • ステージの依存関係とリソースの利用可能性に基づいて、シーケンシャルとパラレルを動的に切り替えます
  • スループットを最適化します

フェーズ4: ストリーミングの監視

目的

データフローとパイプラインの実行をリアルタイムで監視します。

スクリプト

# Monitor data flow
npx claude-flow@alpha stream monitor \
  --all-channels \
  --interval 2 \
  --output stream-metrics.json

# Track stage throughput
npx claude-flow@alpha pipeline metrics \
  --metric throughput \
  --per-stage

# Monitor backpressure
npx claude-flow@alpha stream backpressure --detect

# Generate flow report
npx claude-flow@alpha pipeline report \
  --include-timing \
  --include-throughput \
  --output pipeline-report.md

主要なメトリクス

  • ステージスループット: 各ステージで1分あたりに処理されるアイテム数
  • パイプラインレイテンシ: エンドツーエンドの処理時間
  • バックプレッシャー: ステージ境界でのキューの蓄積
  • エラー率: 各ステージでの失敗数
  • リソース利用率: 各エージェントのCPU/メモリ

フェーズ5: 結果の検証

目的

パイプラインの出力を検証し、データの整合性を確保します。

スクリプト

# Collect pipeline results
npx claude-flow@alpha pipeline results \
  --output pipeline-results.json

# Validate data integrity
npx claude-flow@alpha pipeline validate \
  --results pipeline-results.json \
  --schema validation-schema.json

# Compare with expected output
npx claude-flow@alpha pipeline compare \
  --actual pipeline-results.json \
  --expected expected-output.json

# Generate validation report
npx claude-flow@alpha pipeline report \
  --type validation \
  --output validation-report.md

成功基準

  • [ ] パイプライン設計が完了していること
  • [ ] すべてのステージが接続されていること
  • [ ] データフローが機能していること
  • [ ] 出力が検証されていること
  • [ ] パフォーマンスが許容範囲内であること

パフォーマンス目標

  • ステージレイテンシ: 平均30秒未満
  • パイプラインスループット: 10アイテム/分以上
  • エラー率: 2%未満
  • データ整合性: 100%

ベストプラクティス

  1. 明確なステージ境界: 各ステージは単一の責任を持つこと
  2. データ検証: 出力を渡す前に検証すること

(原文がここで切り詰められています)

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Agent Pipeline Chaining SOP

Overview

This skill implements agent pipeline chaining where outputs from one agent become inputs to the next, supporting both sequential and parallel execution patterns with streaming data flows.

Agents & Responsibilities

task-orchestrator

Role: Pipeline coordination and orchestration Responsibilities:

  • Design pipeline architecture
  • Connect agent stages
  • Monitor data flow
  • Handle pipeline errors

memory-coordinator

Role: Data flow and state management Responsibilities:

  • Store intermediate results
  • Coordinate data passing
  • Manage pipeline state
  • Ensure data consistency

Phase 1: Design Pipeline

Objective

Design pipeline architecture with stages, data flows, and execution strategy.

Scripts

# Design pipeline architecture
npx claude-flow@alpha pipeline design \
  --stages "research,analyze,code,test,review" \
  --flow sequential \
  --output pipeline-design.json

# Define data flow
npx claude-flow@alpha pipeline dataflow \
  --design pipeline-design.json \
  --output dataflow-spec.json

# Visualize pipeline
npx claude-flow@alpha pipeline visualize \
  --design pipeline-design.json \
  --output pipeline-diagram.png

# Store design in memory
npx claude-flow@alpha memory store \
  --key "pipeline/design" \
  --file pipeline-design.json

Pipeline Patterns

Sequential Pipeline:

Agent1 → Agent2 → Agent3 → Agent4

Parallel Pipeline:

       ┌─ Agent2 ─┐
Agent1 ├─ Agent3 ─┤ Agent5
       └─ Agent4 ─┘

Hybrid Pipeline:

Agent1 → ┬─ Agent2 ─┐
         └─ Agent3 ─┴─ Agent4 → Agent5

Phase 2: Connect Agents

Objective

Connect agents with proper data flow channels and state management.

Scripts

# Initialize pipeline
npx claude-flow@alpha pipeline init \
  --design pipeline-design.json

# Spawn pipeline agents
npx claude-flow@alpha agent spawn --type researcher --pipeline-stage 1
npx claude-flow@alpha agent spawn --type analyst --pipeline-stage 2
npx claude-flow@alpha agent spawn --type coder --pipeline-stage 3
npx claude-flow@alpha agent spawn --type tester --pipeline-stage 4

# Connect pipeline stages
npx claude-flow@alpha pipeline connect \
  --from-stage 1 --to-stage 2 \
  --data-channel "memory"

npx claude-flow@alpha pipeline connect \
  --from-stage 2 --to-stage 3 \
  --data-channel "stream"

# Verify connections
npx claude-flow@alpha pipeline status --show-connections

Data Flow Mechanisms

Memory-Based:

# Agent 1 stores output
npx claude-flow@alpha memory store \
  --key "pipeline/stage-1/output" \
  --value "research findings..."

# Agent 2 retrieves input
npx claude-flow@alpha memory retrieve \
  --key "pipeline/stage-1/output"

Stream-Based:

# Agent 1 streams output
npx claude-flow@alpha stream write \
  --channel "stage-1-to-2" \
  --data "streaming data..."

# Agent 2 consumes stream
npx claude-flow@alpha stream read \
  --channel "stage-1-to-2"

Phase 3: Execute Pipeline

Objective

Execute pipeline with proper sequencing and data flow.

Scripts

# Execute sequential pipeline
npx claude-flow@alpha pipeline execute \
  --design pipeline-design.json \
  --input initial-data.json \
  --strategy sequential

# Execute parallel pipeline
npx claude-flow@alpha pipeline execute \
  --design pipeline-design.json \
  --input initial-data.json \
  --strategy parallel \
  --max-parallelism 3

# Monitor execution
npx claude-flow@alpha pipeline monitor --interval 5

# Track stage progress
npx claude-flow@alpha pipeline stages --show-progress

Execution Strategies

Sequential:

  • Stages execute one after another
  • Output of stage N is input to stage N+1
  • Simple error handling
  • Predictable execution time

Parallel:

  • Independent stages execute simultaneously
  • Outputs merged at synchronization points
  • Complex error handling
  • Faster overall execution

Adaptive:

  • Dynamically switches between sequential and parallel
  • Based on stage dependencies and resource availability
  • Optimizes for throughput

Phase 4: Monitor Streaming

Objective

Monitor data flow and pipeline execution in real-time.

Scripts

# Monitor data flow
npx claude-flow@alpha stream monitor \
  --all-channels \
  --interval 2 \
  --output stream-metrics.json

# Track stage throughput
npx claude-flow@alpha pipeline metrics \
  --metric throughput \
  --per-stage

# Monitor backpressure
npx claude-flow@alpha stream backpressure --detect

# Generate flow report
npx claude-flow@alpha pipeline report \
  --include-timing \
  --include-throughput \
  --output pipeline-report.md

Key Metrics

  • Stage Throughput: Items processed per minute per stage
  • Pipeline Latency: End-to-end processing time
  • Backpressure: Queue buildup at stage boundaries
  • Error Rate: Failures per stage
  • Resource Utilization: CPU/memory per agent

Phase 5: Validate Results

Objective

Validate pipeline outputs and ensure data integrity.

Scripts

# Collect pipeline results
npx claude-flow@alpha pipeline results \
  --output pipeline-results.json

# Validate data integrity
npx claude-flow@alpha pipeline validate \
  --results pipeline-results.json \
  --schema validation-schema.json

# Compare with expected output
npx claude-flow@alpha pipeline compare \
  --actual pipeline-results.json \
  --expected expected-output.json

# Generate validation report
npx claude-flow@alpha pipeline report \
  --type validation \
  --output validation-report.md

Success Criteria

  • [ ] Pipeline design complete
  • [ ] All stages connected
  • [ ] Data flow functional
  • [ ] Outputs validated
  • [ ] Performance acceptable

Performance Targets

  • Stage latency: <30 seconds average
  • Pipeline throughput: ≥10 items/minute
  • Error rate: <2%
  • Data integrity: 100%

Best Practices

  1. Clear Stage Boundaries: Each stage has single responsibility
  2. Data Validation: Validate outputs before passing to next stage
  3. Error Handling: Implement retry and fallback mechanisms
  4. Backpressure Management: Prevent queue overflow
  5. Monitoring: Track metrics continuously
  6. State Management: Use memory coordination for state
  7. Testing: Test each stage independently
  8. Documentation: Document data schemas and flows

Common Issues & Solutions

Issue: Pipeline Stalls

Symptoms: Stages stop processing Solution: Check for backpressure, increase buffer sizes

Issue: Data Loss

Symptoms: Missing data in outputs Solution: Implement acknowledgment mechanism, use reliable channels

Issue: High Latency

Symptoms: Slow end-to-end processing Solution: Identify bottleneck stage, add parallelism

Integration Points

  • swarm-orchestration: For complex multi-pipeline orchestration
  • advanced-swarm: For optimized agent coordination
  • performance-analysis: For bottleneck detection

References

  • Pipeline Design Patterns
  • Stream Processing Theory
  • Data Flow Architectures

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。