Communityコーディング&開発github.com

並列エージェントのディスパッチ

独立した2つ以上のタスク(共有状態や順序依存関係が不要なタスク)を同時に進める際に使用します。

並列エージェントのディスパッチ とは?

このスキルは、複数の独立した問題領域(例:異なるテストファイルの失敗、別々のサブシステムのバグ)を並行して調査・修正するためのパターンを提供します。従来のように問題を逐次的に調査すると時間を浪費しますが、本スキルでは各問題を独立したエージェントに割り当て、並行実行することで効率を大幅に向上させます。Claude CodeやCursor、CodexなどのAIエージェントプラットフォーム上で動作し、エージェントごとに独立したコンテキストと明確な指示を与えることで、コンテキストの混在や競合を防ぎます。具体的な手順として、問題領域の特定、エージェントタスクの作成、並列ディスパッチ、結果の統合と検証を定義しており、実際のセッション例も含まれています。このスキルは、複数の独立した障害が同時に発生した場合に特に有効で、各エージェントが集中して作業できるため、修正の質も向上します。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/alfathafp/portofolio-web-design/tree/HEAD/.agents/skills/dispatching-parallel-agents

Installed? Explore more コーディング&開発 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

並列エージェントのディスパッチ は何をしますか?

概要

専門化されたエージェントに、独立したコンテキストでタスクを委任します。エージェントへの指示とコンテキストを正確に作成することで、エージェントがタスクに集中し成功することを確実にします。エージェントはあなたのセッションのコンテキストや履歴を継承してはなりません。エージェントが必要とするものだけを正確に構築します。これにより、調整作業のためのあなた自身のコンテキストも保持されます。

複数の無関係な障害(異なるテストファイル、異なるサブシステム、異なるバグ)がある場合、それらを順次調査すると時間を浪費します。各調査は独立しており、並行して実行できます。

中核となる原則: 独立した問題領域ごとに1つのエージェントをディスパッチします。並行して作業させます。

使用するタイミング

digraph when_to_use {
    "複数の障害?" [shape=diamond];
    "それらは独立している?" [shape=diamond];
    "1つのエージェントですべて調査" [shape=box];
    "問題領域ごとに1エージェント" [shape=box];
    "並行作業可能?" [shape=diamond];
    "逐次エージェント" [shape=box];
    "並列ディスパッチ" [shape=box];

    "複数の障害?" -> "それらは独立している?" [label="はい"];
    "それらは独立している?" -> "1つのエージェントですべて調査" [label="いいえ - 関連あり"];
    "それらは独立している?" -> "並行作業可能?" [label="はい"];
    "並行作業可能?" -> "並列ディスパッチ" [label="はい"];
    "並行作業可能?" -> "逐次エージェント" [label="いいえ - 共有状態あり"];
}

使用するケース:

  • 3つ以上のテストファイルが異なる根本原因で失敗している
  • 複数のサブシステムが独立して壊れている
  • 各問題を他の問題のコンテキストなしで理解できる
  • 調査間で共有状態がない

使用しないケース:

  • 障害が関連している(1つを修正すれば他も修正される可能性がある)
  • システム全体の状態を理解する必要がある
  • エージェントが互いに干渉する可能性がある

パターン

1. 独立したドメインを特定する

何が壊れているかで障害をグループ化します:

  • ファイルAのテスト: ツール承認フロー
  • ファイルBのテスト: バッチ完了動作
  • ファイルCのテスト: 中断機能

各ドメインは独立しています。ツール承認を修正しても中断テストには影響しません。

2. フォーカスしたエージェントタスクを作成する

各エージェントは以下を受け取ります:

  • 特定のスコープ: 1つのテストファイルまたはサブシステム
  • 明確な目標: これらのテストを通過させる
  • 制約: 他のコードは変更しない
  • 期待される出力: 見つけたものと修正したもののサマリー

3. 並列にディスパッチする

同じレスポンス内で3つすべてのサブエージェントディスパッチを発行します。それらは並行して実行されます:

サブエージェント (汎用): "agent-tool-abort.test.ts の障害を修正"
サブエージェント (汎用): "batch-completion-behavior.test.ts の障害を修正"
サブエージェント (汎用): "tool-approval-race-conditions.test.ts の障害を修正"
# 3つすべてが同時に実行される。

1つのレスポンス内で複数のディスパッチ呼び出し = 並列実行。レスポンスごとに1つ = 逐次実行。

4. レビューと統合

エージェントが戻ってきたとき:

  • 各サマリーを読む
  • 修正が競合していないか確認する
  • テストスイート全体を実行する
  • すべての変更を統合する

エージェントプロンプトの構造

良いエージェントプロンプトは:

  1. フォーカスされている - 1つの明確な問題領域
  2. 自己完結型 - 問題を理解するために必要なすべてのコンテキストを含む
  3. 出力について具体的 - エージェントは何を返すべきか?
src/agents/agent-tool-abort.test.ts の3つの失敗テストを修正:

1. "should abort tool with partial output capture" - メッセージに 'interrupted at' を期待
2. "should handle mixed completed and aborted tools" - 高速ツールが完了せず中断された
3. "should properly track pendingToolCount" - 3つの結果を期待するが0を取得

これらはタイミング/競合状態の問題です。あなたのタスク:

1. テストファイルを読み、各テストが何を検証しているか理解する
2. 根本原因を特定する - タイミング問題か実際のバグか?
3. 以下によって修正する:
   - 任意のタイムアウトをイベントベースの待機に置き換える
   - 見つかった場合は中断実装のバグを修正する
   - テスト対象の動作が変更された場合はテストの期待値を調整する

単にタイムアウトを増やさないでください。本当の問題を見つけてください。

戻り値: 見つけたものと修正したもののサマリー。

よくある間違い

❌ 範囲が広すぎる: 「すべてのテストを修正」- エージェントが迷子になる ✅ 具体的: 「agent-tool-abort.test.ts を修正」- 焦点が絞られている

❌ コンテキストなし: 「競合状態を修正」- エージェントは場所がわからない ✅ コンテキストあり: エラーメッセージとテスト名を貼り付ける

❌ 制約なし: エージェントがすべてをリファクタリングする可能性がある ✅ 制約あり: 「プロダクションコードは変更しない」または「テストのみ修正」

❌ 出力が曖昧: 「修正して」- 何が変わったかわからない ✅ 具体的: 「根本原因と変更のサマリーを返す」

使用すべきでないケース

関連する障害: 1つを修正すれば他も修正されるかもしれない。最初に一緒に調査する 全体のコンテキストが必要: システム全体を見る必要がある 探索的デバッグ: 何が壊れているかまだわからない 共有状態: エージェントが互いに干渉する(同じファイルの編集、同じリソースの使用)

セッションの実例

シナリオ: 大規模リファクタリング後、3つのファイルで6つのテスト失敗

障害:

  • agent-tool-abort.test.ts: 3つの失敗(タイミング問題)
  • batch-completion-behavior.test.ts: 2つの失敗(ツールが実行されない)
  • tool-approval-race-conditions.test.ts: 1つの失敗(実行回数 = 0)

判断: 独立したドメイン – 中断ロジックはバッチ完了とも競合状態とも別

ディスパッチ:

エージェント1 → agent-tool-abort.test.ts を修正
エージェント2 → batch-completion-behavior.test.ts を修正
エージェント3 → tool-approval-race-conditions.test.ts を修正

結果:

  • エージェント1: タイムアウトをイベントベースの待機に置き換え
  • エージェント2: イベント構造のバグを修正(threadId が間違った場所)
  • エージェント3: 非同期ツール実行の完了を待つ処理を追加

統合: すべての修正は独立しており、競合なし、テストスイート全体がグリーン

検証

エージェントが戻ってきたら:

  1. 各サマリーをレビュー - 何が変わったか理解する
  2. 競合をチェック - エージェントが同じコードを編集していないか?
  3. テストスイート全体を実行 - すべての修正が一緒に機能するか確認
  4. スポットチェック - エージェントは系統的な誤りを犯す可能性がある

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

alfathafp/portofolio-web-design

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).

alfathafp/portofolio-web-design

Tests in real browsers via Chrome DevTools MCP. Use when building or debugging anything that runs in a browser. Use when you need to inspect the DOM, capture console errors, analyze network requests, profile performance, or verify visual output with real runtime data. Requires the chrome-devtools MCP server to be configured.

alfathafp/portofolio-web-design

Automates CI/CD pipeline setup. Use when setting up or modifying build and deployment pipelines. Use when you need to automate quality gates, configure test runners in CI, or establish deployment strategies.

alfathafp/portofolio-web-design

Conducts multi-axis code review. Use before merging any change. Use when reviewing code written by yourself, another agent, or a human. Use when you need to assess code quality across multiple dimensions before it enters the main branch. Use when asked to review a diff or a pull request, even when the diff is pasted inline.

alfathafp/portofolio-web-design

Simplifies code for clarity. Use when refactoring code for clarity without changing behavior. Use when code works but is harder to read, maintain, or extend than it should be. Use when reviewing code that has accumulated unnecessary complexity.

alfathafp/portofolio-web-design

Establishes a project's quality bar as a written contract and stops agents quietly lowering it. Interviews the user on which dimensions matter, supplies sane default thresholds when they have no number in mind, records everything in CONSTRAINTS.md, and watches the diff for a weakened bar — new @ts-ignore or eslint-disable suppressions, skipped or deleted tests, assertions stripped out, unimplemented stubs, thresholds edited down. Use when no quality bar is written down, when the user says "set up constraints" or "define our standards", when the user wants dimensions they care about — accessibility, web performance, coverage — set up as enforced constraints, when an agent keeps silencing checks or skipping tests to get to green, when you need a coverage or performance threshold and don't know what number to pick, or when an agent writes more code than anyone will read.

alfathafp/portofolio-web-design

Optimizes agent context setup. Use when starting a new session, when agent output quality degrades, when switching between tasks, or when you need to configure rules files and context for a project.

alfathafp/portofolio-web-design

Guides systematic root-cause debugging. Use when tests fail, builds break, something that worked yesterday broke, behavior doesn't match expectations, or you encounter any unexpected error. Use when you need to figure out what broke and why — a systematic approach to finding and fixing the root cause rather than guessing.

alfathafp/portofolio-web-design

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

alfathafp/portofolio-web-design

Manages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code.

alfathafp/portofolio-web-design

Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.

alfathafp/portofolio-web-design

Records decisions and documentation. Use when you need to document an architecture decision (ADR) or the reasoning behind a design choice, when changing public APIs, shipping features, or when you need to record context that future engineers and agents will need to understand the codebase.

alfathafp/portofolio-web-design

Subjects every non-trivial decision to a fresh-context adversarial review before it stands. Use when you want every assumption cross-examined before proceeding, when stress-testing a plan for hidden failure modes, when correctness matters more than speed, when working in unfamiliar code, when stakes are high (production auth, security-sensitive logic, a high-stakes migration, irreversible operations), or any time a confident output would be cheaper to verify now than to debug later.

alfathafp/portofolio-web-design

Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available

alfathafp/portofolio-web-design

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work

alfathafp/portofolio-web-design

Builds production-quality, accessible, responsive user-facing UIs. Use when building or modifying interfaces and pages, creating components, implementing layouts, meeting WCAG accessibility requirements, managing state, or when the output needs to look and feel production-quality rather than AI-generated.

alfathafp/portofolio-web-design

Structures git workflow practices. Use when making any code change. Use when committing, branching, resolving conflicts, splitting uncommitted work in a messy working tree into clean atomic commits, opening or reviewing a pull request (PR), pushing to a remote, or when you need to organize work across multiple parallel streams. Use when cutting a release, choosing a semantic version bump, tagging, or writing a changelog.

alfathafp/portofolio-web-design

Refines raw ideas into sharp, actionable concepts through structured divergent and convergent thinking. Use when an idea is still vague, when you need to stress-test assumptions before committing to a plan, or when you want to expand options before converging on one. Triggers on "ideate", "refine this idea", or "stress-test my plan".

alfathafp/portofolio-web-design

Delivers changes incrementally in thin, verifiable slices. Use when implementing any feature or change that touches more than one file, or when picking up the next task from a plan. Use when rolling a change out behind a feature flag, when you're about to write a large amount of code at once, or when a task feels too big to land in one step.

alfathafp/portofolio-web-design

Guides stable API and interface design. Use when designing APIs, module boundaries, or any public interface. Use when creating REST or GraphQL endpoints, defining type contracts between modules, or establishing boundaries between frontend and backend.

関連スキル