---
name: build-with-parallel-subagents-prompt
description: A prompt that has the lead AI agent split work into independent tasks, send each to a fresh sub-agent with a focused brief, run them in parallel, then check for conflicts and run the full test suite. Use when the user has several unrelated bugs or failing tests, wants subagent-driven development, or asks to run parallel agents on a plan.
license: MIT
metadata:
  category: coding-prompts
  tags: "subagents,agents,workflow,testing"
  author: johnny-bravo
  version: "1.0"
  updated: "2026-10-31"
  status: published
  aliases: "dispatching-parallel-agents,subagent-driven-development,parallel-agents"
  source_url: "https://github.com/obra/superpowers/blob/2ce8aa15d05bd57213e6f746f953aafb7ded7a8b/skills/dispatching-parallel-agents/SKILL.md"
  source_license: MIT
  copyright: "Copyright (c) 2025 Jesse Vincent"
  original_author: "Jesse Vincent (obra/superpowers, 'dispatching-parallel-agents', with ideas from 'subagent-driven-development')"
  modified: "Adapted by TheSkillVault: one paste-in prompt; flowchart turned into a short independence check; the per-task review idea from subagent-driven-development (same repo and commit) added; plain-language steps, safety, portability and done-when sections."
  imported_on: "2026-10-31"
---

# Build with parallel sub-agents (prompt)

When problems are independent, solving them one after another wastes time. The lead agent sends one fresh sub-agent per problem, with exactly the context it needs. They work at the same time. The lead then checks their work fits together.

## When to use
- Several tests are failing in different files for different reasons.
- A plan has tasks that do not touch the same files or shared state.
- Your main session's context is filling up and you want helpers to do focused work.

## Steps
1. Make sure your AI tool supports sub-agents (Claude Code, Cursor, Codex and others do).
2. Paste the prompt below with the list of problems or the plan.
3. Check the lead agent's grouping before it dispatches. Merge any groups that touch the same code.
4. Read the final report and the full test run.

## Prompt
```text
Work on the items below using parallel sub-agents.

1. Group the items by independent problem domain (a test file, a subsystem, a feature).
   Items are independent only if fixing one cannot affect another and they do not edit
   the same files or shared state. If items are related, or nobody knows yet what is broken,
   investigate them together first instead of splitting.
2. Show me the groups and why each is independent. Then continue.
3. For each group, write a self-contained brief. A sub-agent does not see this chat. Include:
   - scope: exactly which files or subsystem it owns
   - goal: e.g. "make these 3 tests pass", with the test names and error messages pasted in
   - constraints: what it must not change (e.g. "do not touch other modules",
     "do not just increase timeouts - find the real cause")
   - output: "Return a short summary of the root cause and every file you changed."
4. Dispatch all briefs at once so they run in parallel.
5. When they return:
   - read each summary and check the actual diff, not just the report
   - review each change against its brief (did it do what was asked, and only that?)
   - check that no two agents edited the same code
   - run the full test suite and show me the result
6. Report: per group, what was wrong, what changed, and the final test output.

ITEMS:
{{PASTE FAILING TESTS, BUGS OR PLAN TASKS}}
```

## How to adapt
- Executing a plan instead of fixing bugs? Give each sub-agent one ticket and add a review sub-agent after each.
- Without sub-agents, run the briefs one by one in fresh chats instead. Works with any AI coding tool.
- Many agents editing one repo? Give each its own git worktree or branch.

## Gotchas
- "Fix all the tests" is too broad. One focused domain per agent.
- An agent with no constraints may refactor everything. Say what it must not touch.
- A sub-agent's "success" is a claim. Check the diff and run the tests yourself.

## Safety
- Sub-agents inherit your tool permissions. Do not let them push, deploy or delete without asking.
- Paste only what each brief needs. Leave out API keys, tokens and private customer data.

## Done when
- Every group has a summary and a diff you checked.
- No two agents changed the same code, and the full test suite passes.

## Example prompt
"Six tests are failing across three files after the refactor. Fix them in parallel with sub-agents."

---
Adapted from "dispatching-parallel-agents" in obra/superpowers by Jesse Vincent (MIT). See LICENSE.txt.
