{"skill":{"slug":"superpowers-dispatching-parallel-agents","displayName":"Superpowers Dispatching Parallel Agents","summary":"Dispatch independent tasks to focused agents working concurrently on isolated problems without shared state or sequential dependencies for faster resolution.","description":"<!-- Original: https://github.com/obra/superpowers, MIT License -->\n---\nname: superpowers-dispatching-parallel-agents\ndescription: Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies\nversion: 1.0.0\n---\n\n# Dispatching Parallel Agents\n\n## Overview\n\nYou 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.\n\nWhen 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.\n\n**Core principle:** Dispatch one agent per independent problem domain. Let them work concurrently.\n\n## When to Use\n\n```\nMultiple failures?\n  → Are they independent?\n    → yes → Can they work in parallel?\n      → yes → Parallel dispatch\n      → no (shared state) → Sequential agents\n    → no (related) → Single agent investigates all\n```\n\n**Use when:**\n- 3+ test files failing with different root causes\n- Multiple subsystems broken independently\n- Each problem can be understood without context from others\n- No shared state between investigations\n\n**Don't use when:**\n- Failures are related (fix one might fix others)\n- Need to understand full system state\n- Agents would interfere with each other\n\n## The Pattern\n\n### 1. Identify Independent Domains\n\nGroup failures by what's broken:\n- File A tests: Tool approval flow\n- File B tests: Batch completion behavior\n- File C tests: Abort functionality\n\nEach domain is independent — fixing tool approval doesn't affect abort tests.\n\n### 2. Create Focused Agent Tasks\n\nEach agent gets:\n- **Specific scope:** One test file or subsystem\n- **Clear goal:** Make these tests pass\n- **Constraints:** Don't change other code\n- **Expected output:** Summary of what you found and fixed\n\n### 3. Dispatch in Parallel\n\nSpawn subagents simultaneously — each handles one domain:\n\n```\nAgent 1 → Fix agent-tool-abort.test.ts failures\nAgent 2 → Fix batch-completion-behavior.test.ts failures\nAgent 3 → Fix tool-approval-race-conditions.test.ts failures\n```\n\nAll three run concurrently.\n\n### 4. Review and Integrate\n\nWhen agents return:\n- Read each summary\n- Verify fixes don't conflict\n- Run full test suite\n- Integrate all changes\n\n## Agent Prompt Structure\n\nGood agent prompts are:\n1. **Focused** — One clear problem domain\n2. **Self-contained** — All context needed to understand the problem\n3. **Specific about output** — What should the agent return?\n\n```markdown\nFix the 3 failing tests in src/agents/agent-tool-abort.test.ts:\n\n1. \"should abort tool with partial output capture\" - expects 'interrupted at' in message\n2. \"should handle mixed completed and aborted tools\" - fast tool aborted instead of completed\n3. \"should properly track pendingToolCount\" - expects 3 results but gets 0\n\nThese are timing/race condition issues. Your task:\n\n1. Read the test file and understand what each test verifies\n2. Identify root cause - timing issues or actual bugs?\n3. Fix by:\n   - Replacing arbitrary timeouts with event-based waiting\n   - Fixing bugs in abort implementation if found\n   - Adjusting test expectations if testing changed behavior\n\nDo NOT just increase timeouts - find the real issue.\n\nReturn: Summary of what you found and what you fixed.\n```\n\n## Common Mistakes\n\n| Mistake | Fix |\n|---------|-----|\n| **Too broad:** \"Fix all the tests\" | **Specific:** \"Fix agent-tool-abort.test.ts\" |\n| **No context:** \"Fix the race condition\" | Paste error messages and test names |\n| **No constraints:** Agent might refactor everything | \"Do NOT change production code\" or \"Fix tests only\" |\n| **Vague output:** \"Fix it\" | \"Return summary of root cause and changes\" |\n\n## Real Example from Session\n\n**Scenario:** 6 test failures across 3 files after major refactoring\n\n**Failures:**\n- agent-tool-abort.test.ts: 3 failures (timing issues)\n- batch-completion-behavior.test.ts: 2 failures (tools not executing)\n- tool-approval-race-conditions.test.ts: 1 failure (execution count = 0)\n\n**Decision:** Independent domains — abort logic separate from batch completion separate from race conditions\n\n**Dispatch:**\n```\nAgent 1 → Fix agent-tool-abort.test.ts\nAgent 2 → Fix batch-completion-behavior.test.ts\nAgent 3 → Fix tool-approval-race-conditions.test.ts\n```\n\n**Results:**\n- Agent 1: Replaced timeouts with event-based waiting\n- Agent 2: Fixed event structure bug (threadId in wrong place)\n- Agent 3: Added wait for async tool execution to complete\n\n**Integration:** All fixes independent, no conflicts, full suite green\n\n**Time saved:** 3 problems solved in parallel vs sequentially\n\n## Key Benefits\n\n1. **Parallelization** — Multiple investigations happen simultaneously\n2. **Focus** — Each agent has narrow scope, less context to track\n3. **Independence** — Agents don't interfere with each other\n4. **Speed** — 3 problems solved in time of 1\n\n## Verification\n\nAfter agents return:\n1. **Review each summary** — Understand what changed\n2. **Check for conflicts** — Did agents edit same code?\n3. **Run full suite** — Verify all fixes work together\n4. **Spot check** — Agents can make systematic errors\n","tags":{"latest":"1.0.0"},"stats":{"comments":0,"downloads":757,"installsAllTime":28,"installsCurrent":5,"stars":1,"versions":1},"createdAt":1774402831797,"updatedAt":1778492171908},"latestVersion":{"version":"1.0.0","createdAt":1774402831797,"changelog":"superpowers-dispatching-parallel-agents 1.0.0\n\n- Initial release.\n- Provides a pattern for delegating independent, unrelated tasks to specialized agents running in parallel.\n- Includes step-by-step guidance on identifying independent domains, creating focused agent tasks, dispatching agents, and integrating results.\n- Offers recommended agent prompt structures and highlights common mistakes.\n- Documents the benefits of parallel dispatch, with a real-world usage example and post-dispatch verification steps.","license":"MIT-0"},"metadata":null,"owner":{"handle":"demo112","userId":"s17fe775c9d5twmmpfa5wen3q983gcfx","displayName":"demo112","image":"https://avatars.githubusercontent.com/u/33809432?v=4"},"moderation":null}