dispatching-parallel-agents
Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.
Use when an HTML UI beats terminal text — collecting structured answers (decision trees, multi-select, code/SQL fields), showing visual comparisons or mockups, running interactive demos, or presenting decisions for approval. A local browser companion renders markdown+YAML screens and streams the user's answers back. Use when: many questions at once, layout/visual choices, mockup or diagram feedback, config wizard, demo review, approve/revise decisions. Skip: a single quick question (use AskUserQuestion or plain text).
Use when you have a spec or requirements for a multi-step task, before touching code
Use when starting any conversation - establishes how to find and use skills, requiring Skill tool invocation before ANY response including clarifying questions
Use when you have a written implementation plan to execute in a separate session with review checkpoints
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
| name | dispatching-parallel-agents |
| description | Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies |
委任務於特化 agent,孤立 context。精工其 instruction 與 context,使專注成事。勿令承汝 session 之歷史——汝構其所需。此亦保汝 context 於協調之務。
多失敗而無關(異測檔、異子系統、異 bug),序查耗時。每查獨立,可並行。
核心原則: 每獨立問題域派一 agent。使其並行。
digraph when_to_use {
"Multiple failures?" [shape=diamond];
"Are they independent?" [shape=diamond];
"Single agent investigates all" [shape=box];
"One agent per problem domain" [shape=box];
"Can they work in parallel?" [shape=diamond];
"Sequential agents" [shape=box];
"Parallel dispatch" [shape=box];
"Multiple failures?" -> "Are they independent?" [label="yes"];
"Are they independent?" -> "Single agent investigates all" [label="no - related"];
"Are they independent?" -> "Can they work in parallel?" [label="yes"];
"Can they work in parallel?" -> "Parallel dispatch" [label="yes"];
"Can they work in parallel?" -> "Sequential agents" [label="no - shared state"];
}
用於:
不用於:
以所斷分失敗:
每域獨立——修 tool approval 不影 abort 測。
每 agent 獲:
// In Claude Code / AI environment
Task("Fix agent-tool-abort.test.ts failures")
Task("Fix batch-completion-behavior.test.ts failures")
Task("Fix tool-approval-race-conditions.test.ts failures")
// All three run concurrently
Agent 返時:
善 agent prompt:
Fix the 3 failing tests in src/agents/agent-tool-abort.test.ts:
1. "should abort tool with partial output capture" - expects 'interrupted at' in message
2. "should handle mixed completed and aborted tools" - fast tool aborted instead of completed
3. "should properly track pendingToolCount" - expects 3 results but gets 0
These are timing/race condition issues. Your task:
1. Read the test file and understand what each test verifies
2. Identify root cause - timing issues or actual bugs?
3. Fix by:
- Replacing arbitrary timeouts with event-based waiting
- Fixing bugs in abort implementation if found
- Adjusting test expectations if testing changed behavior
Do NOT just increase timeouts - find the real issue.
Return: Summary of what you found and what you fixed.
❌ 過廣: "Fix all the tests" - agent 迷 ✅ 具體: "Fix agent-tool-abort.test.ts" - 範圍明
❌ 無 context: "Fix the race condition" - agent 不知何處 ✅ 有 context: 貼錯訊與測名
❌ 無限制: agent 或重構所有 ✅ 有限制: "Do NOT change production code" 或 "Fix tests only"
❌ 輸出模糊: "Fix it" - 汝不知何變 ✅ 具體: "Return summary of root cause and changes"
相關失敗: 修一或修他——先合查 需全 context: 理解需見全系統 探索性 debug: 汝未知何斷 共享 state: agent 互擾(編同檔、用同資源)
情境: 大重構後 3 檔 6 測失敗
失敗:
決: 域獨——abort 邏輯與 batch completion 與 race condition 分
派:
Agent 1 → Fix agent-tool-abort.test.ts
Agent 2 → Fix batch-completion-behavior.test.ts
Agent 3 → Fix tool-approval-race-conditions.test.ts
果:
整合: 所修獨,無衝,全套綠
省時: 3 問並行 vs 序
Agent 返後:
From debugging session (2025-10-03):