Verified against Claude Code · 2026-07-20
Orchestrate several Claude Code subagents on one task without collisions
A delegation prompt for a main Claude Code session coordinating multiple distinct subagents on one complex task — researcher, implementer, reviewer — with an explicit handoff contract between them, so parallel or sequential delegation does not produce duplicate work, conflicting edits, or a finding that silently never reaches the implementer.
The prompt
Ready to copy — highlighted parts are example details you can swap.
You are the orchestrating conversation for a task that will be split across more than one existing subagent, defined in code-investigator (read-only, finds root causes and cites file/line), implementer (has Edit and Bash, makes the actual code change), test-runner (runs the suite and reports pass/fail counts, cannot edit code).. You are not doing the work yourself where a subagent already owns it — your job is sequencing, handoff, and reconciling what comes back, not re-deriving the answer a subagent already produced. TASK Investigate why the invoice PDF export is missing line-item tax breakdowns, then implement the fix, then verify it against the existing invoice test fixtures. SUBAGENTS AVAILABLE AND WHAT EACH ONE OWNS code-investigator (read-only, finds root causes and cites file/line), implementer (has Edit and Bash, makes the actual code change), test-runner (runs the suite and reports pass/fail counts, cannot edit code). HANDOFF CONTRACT BETWEEN STAGES code-investigator must hand the implementer a specific file, line, and root-cause sentence, not a general description of the symptom; the implementer must hand test-runner the exact files changed, not a full diff. SEQUENCING Investigation must finish before implementation starts; there is nothing to parallelize here since each stage strictly depends on the last. BEFORE DELEGATING ANYTHING 1. Map the task onto the subagents above explicitly: which subagent does which slice, in what order, and what each one needs from the one before it to start. If a slice of the task does not cleanly belong to any existing subagent, say so and decide whether to handle it yourself in the main thread or define a new subagent first — do not force a mismatched slice onto the nearest existing one just to avoid that decision. 2. If two subagents can genuinely run in parallel because neither depends on the other's output, say so explicitly and confirm they do not both need to edit the same file — a subagent editing a file another one is simultaneously reading half-finished is a real race, not a hypothetical one. 3. State the handoff contract per stage: exactly what the next subagent, or you, needs back — not everything the subagent reasoned about internally, only what should cross the boundary. WHILE RUNNING - After each subagent returns, verify its output against the handoff contract before passing it to the next stage. Do not forward a result you have not actually checked matches what the next stage needs, just because it looks complete. - If a subagent's finding changes what a later stage should do, update that later stage's brief explicitly rather than sending it the original, now-stale instructions. FAILURE HANDLING If test-runner reports any failure, return control to the implementer with the specific failing test name rather than retrying test-runner or declaring the task done. If a subagent returns an incomplete or blocked result, do not silently proceed to the next stage as though it succeeded — stop, state what is missing, and decide whether to retry that subagent, do the missing piece yourself, or halt the whole task. CONSTRAINTS - Do not redo a subagent's job yourself in the main thread just because its result arrived slower than expected or looks slightly different from what you would have produced directly — the reason to delegate was the isolation and scoping a subagent provides, and quietly duplicating its work in the main thread defeats both without anyone deciding that tradeoff on purpose. - Do not let two subagents investigate or implement the same slice of the task independently unless Investigation must finish before implementation starts; there is nothing to parallelize here since each stage strictly depends on the last. explicitly calls for a deliberate second opinion — an accidental overlap wastes the isolated context both subagents were given and can return two different answers to the same question with no stated reason to prefer one over the other. OUTPUT A short running log of which subagent ran, what it was given, what it returned, and whether that result was accepted as-is or required a correction before moving on. End with the final consolidated result, not a list of the individual subagent transcripts.
Customize
Optional — swap in your own details for the highlighted parts above.
Why this works
A single Claude Code subagent definition specifies one job and an isolated context, but nothing about the subagent mechanism itself sequences several of them together — that coordination has to live somewhere, and by default it lives nowhere, which is why an unplanned multi-subagent task tends to degenerate into the main thread invoking whichever subagent occurred to it next rather than following a deliberate handoff plan. Making the handoff contract explicit per stage matters because a subagent's own internal reasoning never crosses back into the main conversation automatically — only what it explicitly returns does — so if the orchestrating prompt does not state exactly what the next stage needs, the main thread has no principled basis for deciding whether a subagent's response contains enough to proceed, and will often forward whatever came back regardless of completeness. The instruction to verify each result against its contract before forwarding it targets a specific compounding failure: an incomplete finding from stage one that goes unchecked does not just fail on its own, it silently degrades every subsequent stage built on top of it, and by the time a downstream subagent produces an obviously wrong result, the actual defect is now two or three stages upstream and much harder to trace back to. Distinguishing genuinely parallelizable stages from sequential ones is a real correctness question, not a performance tweak, when subagents share a working tree — two subagents invoked at once against the same files can produce a race on disk that neither one's own instructions would ever catch, since each subagent only sees its own isolated context and has no visibility into what a concurrently running sibling is doing to the same file at the same moment. Requiring the main thread to update a later stage's brief when an earlier stage's finding changes the situation, rather than sending the original instructions unchanged, matters because a subagent given a stale brief will faithfully execute exactly what it was told, producing a technically correct answer to a question that stopped being the right one to ask several stages ago.
Verified against
Claude Code Sonnet 4.6 · 2026-07-20
Changelog
- 2026-07-20 — Initial publish, verified against Claude Code multi-subagent delegation (Sonnet 4.6).
Building this for real?
This is a free starting point. If you'd rather have custom software built and running for your business, that's Scult's day job.
EXPLORE CUSTOM SOFTWARE
