Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
git clone https://github.com/obra/superpowers.git--- name: dispatching-parallel-agents description: Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies --- # Dispatching Parallel Agents ## Overview You delegate tasks to specialized agents with isolated context. By precisely crafting their instructions and context, you ensure they stay focused and succeed at their task. They should never inherit your session's context or history — you construct exactly what they need. This also preserves your own context for coordination work. When you have multiple unrelated failures (different test files, different subsystems, different bugs), investigating them sequentially wastes time. Each investigation is independent and can happen in parallel. **Core principle:** Dispatch one agent per independent problem domain. Let them work concurrently. ## When to Use ```dot 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"]; } ``` **Use when:** - 3+ test files failing with different root causes - Multiple subsystems broken independently - Each problem can be understood without context from others - No shared state between investigations **Don't use when:** - Failures are related (fix one might fix others) - Need to understand full system state - Agents would interfere with each other ## The Pattern ### 1. Identify Independent Domains Group failures by what's broken: - File A tests: Tool approval flow - File B tests: Batch completion behavior - File C tests: Abort functionality Each domain is independent - fixing tool approval doesn't affect abort tests. ### 2. Create Focused Agent Tasks Each agent gets: - **Specific scope:** One test file or subsystem - **Clear goal:** Make these tests pass - **Constraints:** Don't change other code - **Expected output:** Summary of what you found and fixed ### 3. Dispatch in Parallel Issue all three subagent dispatches in the same response — they run in parallel: ```text Subagent (general-purpose): "Fix agent-tool-abort.test.ts failures" Subagent (general-purpose): "Fix batch-completion-behavior.test.ts failures" Subagent (general-purpose): "Fix tool-approval-race-conditions.test.ts failures" # All three run concurrently. ``` Multiple dispatch calls in one response = parallel execution. One per response = sequential. ### 4. Review and Integrate When agents return: - Read each summary - Verify fixes don't conflict - Run full test suite - Integrate all changes ## Agent Prompt Structure Good agent prompts are: 1. **Focused** - One clear problem domain 2. **Self-contained** - All context needed to understand the problem 3. **Specific about output** - What should the agent return? ```markdown 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. ``` ## Common Mistakes **❌ Too broad:** "Fix all the tests" - agent gets lost **✅ Specific:** "Fix agent-tool-abort.test.ts" - focused scope **❌ No context:** "Fix the race condition" - agent doesn't know where **✅ Context:** Paste the error messages and test names **❌ No constraints:** Agent might refactor everything **✅ Constraints:** "Do NOT change production code" or "Fix tests only" **❌ Vague output:** "Fix it" - you don't know what changed **✅ Specific:** "Return summary of root cause and changes" ## When NOT to Use **Related failures:** Fixing one might fix others - investigate together first **Need full context:** Understanding requires seeing entire system **Exploratory debugging:** You don't know what's broken yet **Shared state:** Agents would interfere (editing same files, using same resources) ## Real Example from Session **Scenario:** 6 test failures across 3 files after major refactoring **Failures:** - agent-tool-abort.test.ts: 3 failures (timing issues) - batch-completion-behavior.test.ts: 2 failures (tools not executing) - tool-approval-race-conditions.test.ts: 1 failure (execution count = 0) **Decision:** Independent domains - abort logic separate from batch completion separate from race conditions **Dispatch:** ``` 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 ``` **Results:** - Agent 1: Replaced timeouts with event-based waiting - Agent 2: Fixed event structure bug (threadId in wrong place) - Agent 3: Added wait for async tool execution to complete **Integration:** All fixes independent, no conflicts, full suite green ## Verification After agents return: 1. **Review each summary** - Understand what changed 2. **Check for conflicts** - Did agents edit same code? 3. **Run full suite** - Verify all fixes work together 4. **Spot check** - Agents can make systematic errors
1. **Identify Parallel Tasks**: List all independent tasks that don't require shared data or sequential steps. Use tools like Notion or Trello to organize them. 2. **Define Clear Ownership**: For each task, specify the agent's role (e.g., researcher, writer, analyst) and success criteria (e.g., 'Deliver a 500-word report with 3 actionable recommendations'). 3. **Dispatch Agents**: Use the prompt template to assign tasks to parallel agents. Include specific deliverables (e.g., 'CSV file with customer churn metrics') and deadlines if applicable. 4. **Monitor Progress**: Check in after 15-30 minutes to ensure agents aren't stuck. Use the consolidated summary to verify outputs and identify gaps. 5. **Refine and Iterate**: If outputs are incomplete, reassign tasks with clearer instructions or additional context. For complex projects, break tasks into smaller parallel subtasks. Tip: For best results, use this skill for tasks like data collection, content creation, or research where parallel processing saves significant time. Avoid for tasks requiring real-time collaboration or shared state (e.g., live editing a document).
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/obra/superpowers/tree/main/skills/dispatching-parallel-agentsCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Act as a project manager with access to parallel agents. Assign the following independent tasks to separate agents for simultaneous execution: [TASK_1], [TASK_2], [TASK_3]. Ensure each agent has clear ownership of their task, including specific deliverables and success criteria. Coordinate the agents to avoid overlap and report back the results in a consolidated summary with each agent's output clearly labeled. Start now.
Parallel Agent Dispatch Report
Agent Alpha (Research Specialist) - Task: 'Analyze Q3 competitor pricing strategies for our three main product lines'
Deliverable: Competitive pricing matrix with historical trends and gap analysis
Success Criteria: Identify 3 pricing opportunities and 2 threats per product line
Output:
- Product A: Competitors average 15% discount on bulk orders; our pricing is 5% higher than market leader
- Product B: New entrant undercutting us by 22% in enterprise segment
- Product C: Premium positioning justified by 40% higher feature score
Agent Beta (Content Creator) - Task: 'Draft social media posts announcing our Q4 product updates'
Deliverable: 10 LinkedIn posts (250-300 chars each) with hashtags and emojis
Success Criteria: Posts must highlight new features, include CTAs, and maintain brand voice
Output:
1. "🚀 Big news! Our Product A just got a turbo boost with AI-powered analytics. Who's ready to upgrade their workflow? #ProductA #AI #Innovation"
2. "Enterprise teams, we heard you! Product B now supports 500+ user collaboration. Time to scale your projects! #ProductB #Teamwork #Scale"
3. "Premium never looked this good. Product C's revamped UI is here to elevate your daily grind. Try it today! #ProductC #Design #Luxury"
Agent Gamma (Technical Writer) - Task: 'Update API documentation for the new webhook endpoints'
Deliverable: Markdown files with code samples and endpoint specifications
Success Criteria: All endpoints must include request/response examples and error codes
Output:
- POST /api/v2/webhooks/subscribe: {"event_type": "string", "callback_url": "string"} → 201 on success, 400 on invalid payload
- GET /api/v2/webhooks/events: Returns array of subscribed events with last triggered timestamp
- DELETE /api/v2/webhooks/{id}: Soft deletes webhook with 204 response
Consolidated Summary:
All agents completed their tasks ahead of schedule. No conflicts detected in deliverables. Recommend reviewing Agent Alpha's pricing threats for immediate strategic response and Agent Beta's posts for scheduled publishing in the next 2 hours.skills-collection
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan