一键导入
dispatching-parallel-agents
Use when facing 2+ tasks that can proceed without shared state, sequential dependencies, or mutual file edits
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when facing 2+ tasks that can proceed without shared state, sequential dependencies, or mutual file edits
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
[Workflow] Explore an idea and design a solution before implementing
Use when the what or how of a change has open questions requiring collaborative design dialogue with the user — before committing to an approach
[Agent] Subagent persona for reviewing code changes against a plan and quality standards
Use when approaching complex exploration, research, or synthesis tasks — understanding systems, codebases, domains, or architectures before proposing changes or designs
[Workflow] Execute an implementation plan task by task with review checkpoints
Use when you have a written implementation plan to execute — before touching code on any multi-step planned work
| name | dispatching-parallel-agents |
| description | Use when facing 2+ tasks that can proceed without shared state, sequential dependencies, or mutual file edits |
| metadata | {"owner":"shrug-labs","last_updated":"2026-03-09T00:00:00.000Z"} |
Coordinate independent work streams across parallel agents to solve N problems in the time of one.
DO NOT PARALLELIZE DEPENDENT TASKS
If Task B reads state that Task A writes, they are not independent. If two tasks edit the same file, they are not independent. If fixing one problem might fix another, they are not independent. Sequential execution is not a failure — false parallelism that produces conflicts and wasted work is.
No exceptions:
Violating the letter of this rule IS violating the spirit.
This skill is for KNOWN independent tasks where the boundaries are clear before dispatch.
digraph dispatch {
"Multiple tasks?" [shape=diamond];
"Do it directly" [shape=box];
"Tasks well-defined?" [shape=diamond];
"Decompose first" [shape=box];
"All independent?" [shape=diamond];
"Separate dependent\nfrom independent" [shape=box];
"Harness supports\nparallel dispatch?" [shape=diamond];
"Dispatch in parallel" [shape=box];
"Execute sequentially\n(same protocol)" [shape=box];
"Multiple tasks?" -> "Do it directly" [label="no — single task"];
"Multiple tasks?" -> "Tasks well-defined?" [label="yes"];
"Tasks well-defined?" -> "Decompose first" [label="no — unclear scope"];
"Tasks well-defined?" -> "All independent?" [label="yes"];
"All independent?" -> "Dispatch in parallel" [label="yes" style=bold];
"All independent?" -> "Separate dependent\nfrom independent" [label="no — some share state"];
"Separate dependent\nfrom independent" -> "Harness supports\nparallel dispatch?" ;
"Dispatch in parallel" -> "Harness supports\nparallel dispatch?";
"Harness supports\nparallel dispatch?" -> "Dispatch in parallel" [label="yes"];
"Harness supports\nparallel dispatch?" -> "Execute sequentially\n(same protocol)" [label="no"];
}
List every discrete work item. For each, state:
Run every pair through the independence checklist (below). Any failure = those tasks serialize.
Each dispatched task gets a self-contained prompt:
A task prompt that requires reading another task's output is not independent.
When all tasks complete:
Before dispatching, verify each pair of tasks against ALL of these:
| Check | Pass | Fail |
|---|---|---|
| File writes — do they write to any of the same files? | Disjoint write sets | Any overlap |
| Read-write — does one read what another writes? | No cross-dependencies | Any dependency |
| Shared resources — database, API quota, lock file, port? | No shared resources | Any contention |
| Causal link — could fixing one make the other unnecessary? | Independent root causes | Possibly related |
| Ordering — does the correctness of one depend on the other completing first? | Order irrelevant | Order matters |
ALL checks must pass for a pair to be independent. One failure = serialize that pair.
| Excuse | Reality |
|---|---|
| "They're in different files" | Files =/= independence. Two files can share state through imports, config, or side effects. |
| "They'll probably finish before conflicting" | "Probably" is a race condition. Prove independence or serialize. |
| "We can merge the conflicts after" | Merge conflicts between parallel agents are expensive. Prevent, don't repair. |
| "It's faster to parallelize" | It's faster only when tasks are independent. False parallelism is slower than sequential. |
| "Each agent is smart enough to avoid conflicts" | Agents don't coordinate. They can't see each other's work in progress. |
All of these mean: Go back to the Independence Checklist.
| Scenario | Tasks | Approach |
|---|---|---|
| Test failures across unrelated files | 1 per file/subsystem | Parallel — disjoint by definition |
| Bug fix + documentation update | 2 | Parallel — if docs describe existing behavior, not the fix |
| Multiple config changes to same system | N | Serialize — shared config state |
| Research across independent domains | 1 per domain | Parallel — read-only exploration |
| Refactor + feature in same module | 2 | Serialize — shared file writes |
| Multi-repo changes with no cross-deps | 1 per repo | Parallel — isolated by repository boundary |
Once results are collected and reconciled:
Do not skip reconciliation. Parallel agents produce independent results that must be validated together before the work is complete.