SKILL.md
Dispatching Parallel Agents
One agent per independent problem domain, all dispatched at once. Subagents get a constructed context, not your session history, which keeps them focused and keeps your own context free for coordination.
The Independence Test
Parallelize only when every answer is yes:
- Can each problem be understood without the others?
- Is there no shared state (same files, same fixtures, same resources)?
- Could fixing one never fix or break another?
- Do you already know what is broken, roughly where?
Any no: do not parallelize. Related failures get one investigator. Exploratory debugging (you do not know what is broken yet) gets you, not a fleet.
Workflow
- Group by domain. Cluster the failures by what is actually broken: one test file, one subsystem, one bug class per group. Three test files failing for three unrelated reasons is three domains.
- Write one prompt per domain. Each prompt is self-contained: the agent inherits nothing from your session. Include the exact scope (file paths, test names), the pasted error output, the goal, hard constraints, and the required return format.
- Dispatch all at once. Issue every subagent call in the same message. Same message means parallel; one per message means sequential and you lose the entire point.
- Integrate. When they return: read each summary, diff-check for overlapping edits, run the full test suite yourself, and spot-check the reasoning. Subagents make confident systematic errors; the suite is the referee, not their summaries.
Prompt Anatomy
Every dispatch prompt carries five parts:
- Scope: "Fix the 3 failing tests in
src/agents/agent-tool-abort.test.ts", never "fix the tests". - Evidence: paste the failing test names and error messages. The agent cannot see your terminal.
- Goal: what done looks like, stated observably.
- Constraints: what the agent must not touch. "Do not modify production code" or "fix the root cause, do not raise timeouts".
- Return contract: "Return: root cause, files changed, and what you fixed."
Verification
After integration, run the full test suite and git diff --stat. Expect: all tests green, and no file appearing in more than one agent's changes. If two agents touched the same file, review that file line by line before trusting the merge; if the suite is red, re-dispatch a single agent scoped to the regression with the new failure output pasted in.
Good vs Bad
Judgment call: prompting a subagent on a flaky-looking test failure.
Bad: "Fix the race condition in the agent tests." No file, no errors, no constraints. The agent wanders, refactors production code, and returns "fixed" with timeouts doubled.
Good: "Fix the 3 failures in agent-tool-abort.test.ts (names and errors pasted below). Likely timing issues. Replace arbitrary timeouts with event-based waiting, or fix the abort implementation if it is actually buggy. Do NOT just increase timeouts. Return root cause and changes." Scoped, evidenced, constrained.
Footguns
- Sequential dispatch by accident. Calls in separate messages run one after another. Fix: all dispatch calls in one message, every time.
- Shared-file collisions. Two agents editing the same helper produce a silent bad merge. Fix: check domain boundaries for shared files before dispatch; if unavoidable, serialize those two.
- Trusting summaries over the suite. "All tests pass" from a subagent means its slice passed in its view. Fix: you run the full suite after integration, always.
- Parallelizing related failures. One root cause, three agents, three conflicting patches. Fix: apply the independence test first; when in doubt, one investigator does a quick triage pass.
- Context dumping. Pasting your whole session into each prompt burns tokens and blurs focus. Fix: construct the minimal context each agent needs, nothing more.
Completion Checklist
- [ ] Independence test passed for every domain
- [ ] Each prompt has scope, evidence, goal, constraints, return contract
- [ ] All dispatches issued in a single message
- [ ] No overlapping file edits, or overlaps reviewed line by line
- [ ] Full suite run by you after integration, green
Any box unchecked: not done. Fix or say so.