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

spawn-parallel

Pattern for spawning parallel subagents efficiently. Use when you need multiple independent tasks done concurrently.

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して spawn-parallel.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → spawn-parallel フォルダができる
  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
同梱ファイル
1

📖 Skill本文(日本語訳)

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

並列 Spawn Skill

並列なサブエージェントを spawn し、連携するためのパターンです。

この Skill をロードするタイミング

  • 複数の独立したタスクがある場合
  • タスクが互いの出力に依存しない場合
  • 並行性を最大化したい場合

Spawn パターン

1. 独立したタスクを特定する

タスクが独立している条件:

  • タスク間にデータ依存性がない
  • ファイルの競合がない(異なるファイルまたは読み取り専用)
  • 任意の順序で完了できる

2. コンテキストを準備する

各サブエージェントは、最小限で焦点を絞ったコンテキストを必要とします。

{"task":{"id":"unique_id","description":"specific task"},"context_files":["only relevant files"],"boundaries":{"owns":["files this agent can modify"],"reads":["files for reference"]},"output_path":"memory/tasks/{id}/output.json"}

3. すべてを一度に Spawn する

単一の応答で複数の Task 呼び出しを使用します。

Task(subagent_type: "implementer", model: "sonnet", prompt: "Task 1...")
Task(subagent_type: "implementer", model: "sonnet", prompt: "Task 2...")
Task(subagent_type: "implementer", model: "sonnet", prompt: "Task 3...")

サブエージェントタイプのリファレンス(カスタム Dotagent エージェント): | タイプ | モデル | 用途 | |------|-------|---------| | explorer | haiku | 高速なコードベース調査 | | implementer | sonnet | 焦点を絞ったコード作成 | | verifier | haiku | 独立した検証 | | tester | haiku | テスト実行 |

注: これらはカスタムの dotagent エージェント(小文字)です。ExplorePlan (大文字) のような組み込みの Claude Code エージェントは、異なる動作をします。

4. 収集と検証

すべて完了した後:

  • 各出力ファイルが存在することを確認する
  • スキーマに対して検証する
  • 失敗を処理する(再試行またはエスカレーション)

連携ルール

競合を防止する

  • エージェントごとに明確なファイルの所有権を定義する
  • 共有インターフェースにコントラクトを使用する
  • 共有リソースへの読み取り専用アクセス

失敗を処理する

個々の失敗はバッチを失敗させません。@.claude/skills/error-recovery/SKILL.md からリカバリ戦略を適用します。

FOR each failed task in batch:
  IF output malformed/timeout:
    → Simple Retry (same prompt, up to 3x)
  ELIF agent said "unclear"/"don't understand":
    → Context Enhancement (add files, clarify)
  ELIF partial completion:
    → Scope Reduction (split into subtasks)
  ELIF boundary/contract violation:
    → Escalation (spawn contract-resolver)
  ELIF 3+ attempts failed:
    → Abort, record failure, continue with others

コンテキスト拡張による再試行の例:

Task(
  subagent_type: "implementer",
  model: "sonnet",
  prompt: |
    ## RETRY - Previous attempt failed
    Error: "Unclear how to connect to database"

    ## Additional Context
    See database config: @src/config/database.ts
    Connection pattern: @src/services/db-connection.ts

    ## Original Task
    {original_task_description}

    Output: memory/tasks/{id}/output.json
)

例: 並列 Explorer

# 3つのカスタム explorer エージェントを並行して Spawn する
Task(
  subagent_type: "explorer",  # カスタム dotagent エージェント
  model: "haiku",
  prompt: "Explore authentication code. Return compact JSON with findings."
)
Task(
  subagent_type: "explorer",
  model: "haiku",
  prompt: "Explore API routes. Return compact JSON with findings."
)
Task(
  subagent_type: "explorer",
  model: "haiku",
  prompt: "Explore database models. Return compact JSON with findings."
)

すべてが同時に実行され、すべてが完了すると結果が収集されます。

例: 混合エージェントタイプ

# 異なる境界を持つ並列実装
Task(
  subagent_type: "implementer",
  model: "sonnet",
  prompt: |
    Task: Add user validation
    Boundaries: owns=[src/validators/user.ts], reads=[src/types/]
    Output: memory/tasks/task-001/output.json
)
Task(
  subagent_type: "implementer",
  model: "sonnet",
  prompt: |
    Task: Add email service
    Boundaries: owns=[src/services/email.ts], reads=[src/config/]
    Output: memory/tasks/task-002/output.json
)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Spawn Parallel Skill

Pattern for spawning and coordinating parallel subagents.

When to Load This Skill

  • You have multiple independent tasks
  • Tasks don't depend on each other's output
  • You want to maximize concurrency

Spawning Pattern

1. Identify Independent Tasks

Tasks are independent if:

  • No data dependencies between them
  • No file conflicts (different files or read-only)
  • Can complete in any order

2. Prepare Contexts

Each subagent needs minimal, focused context:

{"task":{"id":"unique_id","description":"specific task"},"context_files":["only relevant files"],"boundaries":{"owns":["files this agent can modify"],"reads":["files for reference"]},"output_path":"memory/tasks/{id}/output.json"}

3. Spawn All at Once

Use multiple Task calls in single response:

Task(subagent_type: "implementer", model: "sonnet", prompt: "Task 1...")
Task(subagent_type: "implementer", model: "sonnet", prompt: "Task 2...")
Task(subagent_type: "implementer", model: "sonnet", prompt: "Task 3...")

Subagent Type Reference (Custom Dotagent Agents): | Type | Model | Use For | |------|-------|---------| | explorer | haiku | Fast codebase scouting | | implementer | sonnet | Focused code writing | | verifier | haiku | Independent verification | | tester | haiku | Test execution |

Note: These are custom dotagent agents (lowercase). Built-in Claude Code agents like Explore and Plan (capitalized) have different behavior.

4. Collect and Validate

After all complete:

  • Check each output file exists
  • Validate against schema
  • Handle failures (retry or escalate)

Coordination Rules

Prevent Conflicts

  • Define clear file ownership per agent
  • Use contracts for shared interfaces
  • Read-only access to shared resources

Handle Failures

Individual failures don't fail the batch. Apply recovery strategies from @.claude/skills/error-recovery/SKILL.md:

FOR each failed task in batch:
  IF output malformed/timeout:
    → Simple Retry (same prompt, up to 3x)
  ELIF agent said "unclear"/"don't understand":
    → Context Enhancement (add files, clarify)
  ELIF partial completion:
    → Scope Reduction (split into subtasks)
  ELIF boundary/contract violation:
    → Escalation (spawn contract-resolver)
  ELIF 3+ attempts failed:
    → Abort, record failure, continue with others

Retry with Context Enhancement Example:

Task(
  subagent_type: "implementer",
  model: "sonnet",
  prompt: |
    ## RETRY - Previous attempt failed
    Error: "Unclear how to connect to database"

    ## Additional Context
    See database config: @src/config/database.ts
    Connection pattern: @src/services/db-connection.ts

    ## Original Task
    {original_task_description}

    Output: memory/tasks/{id}/output.json
)

Example: Parallel Explorers

# Spawn 3 custom explorer agents in parallel
Task(
  subagent_type: "explorer",  # Custom dotagent agent
  model: "haiku",
  prompt: "Explore authentication code. Return compact JSON with findings."
)
Task(
  subagent_type: "explorer",
  model: "haiku",
  prompt: "Explore API routes. Return compact JSON with findings."
)
Task(
  subagent_type: "explorer",
  model: "haiku",
  prompt: "Explore database models. Return compact JSON with findings."
)

All run concurrently, results collected when all complete.

Example: Mixed Agent Types

# Parallel implementation with different boundaries
Task(
  subagent_type: "implementer",
  model: "sonnet",
  prompt: |
    Task: Add user validation
    Boundaries: owns=[src/validators/user.ts], reads=[src/types/]
    Output: memory/tasks/task-001/output.json
)
Task(
  subagent_type: "implementer",
  model: "sonnet",
  prompt: |
    Task: Add email service
    Boundaries: owns=[src/services/email.ts], reads=[src/config/]
    Output: memory/tasks/task-002/output.json
)