agentleFS
myths-labsmyths-labs/muse/skills/toolkit/dispatching-parallel-agents/SKILL.md

dispatching-parallel-agents

Skill35 starsChanged 8 months agoMITView on GitHub

Use to run multiple subagents concurrently on independent tasks

136 other projects use a version of this, 105 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use diagnosing-superpowers, workflow-runner and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • obraSkill

    diagnosing-superpowers

    Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.

    Also in 6 projects that use this

  • MorningStar0709Skill

    workflow-runner

    Run an agency-orchestrator style YAML workflow inside the current Trae conversation by simulating or coordinating multiple roles. Use when the user provides a `.yaml` or `.yml` workflow, asks for multi-role collaboration, says things like “用多个角色一起评审这个 PRD”“多角色协作”“先生成工作流再执行”“让产品经理、架构师、QA 一起看一下”, or wants roles such as product manager, architect, reviewer, or QA to work together. Supports layered execution, role prompting, variable interpolation, document-backed inputs, and parallel steps only when the current environment has a clear subagent mapping. Do not use for ordinary implementation plans, simple code changes, or tasks already covered by `writing-plans`, `executing-plans`, `subagent-driven-development`, or single-purpose review/debug skills.

    Also in 5 projects that use this

  • MorningStar0709Skill

    chinese-git-workflow

    Configure Git for domestic platforms and manage branching strategies suitable for Chinese teams. Use when the user asks to configure remotes, set up SSH, or manage Git workflows for Gitee, Coding, Jihu GitLab, or CNB, including requests like "配置国内 Git", "设置 Gitee 远程仓库", "推荐适合小团队的 Git 流程".

    Also in 4 projects that use this

  • shibit-netSkill

    chinese-code-review

    中文 review 沟通参考——话术模板、分级标注(必须修复/建议修改/仅供参考)、国内团队常见反模式应对。仅在用户显式 /chinese-code-review 时调用,不要根据上下文自动触发。

    Also in 3 projects that use this

  • shibit-netSkill

    chinese-commit-conventions

    中文 commit 与 changelog 配置参考——Conventional Commits 中文适配、commitlint/husky/commitizen 中文模板、conventional-changelog 中文配置。仅在用户显式 /chinese-commit-conventions 时调用,不要根据上下文自动触发。

    Also in 3 projects that use this

  • MicrosoftSkill

    testing-anti-patterns

    Use when writing or changing tests, adding mocks, or tempted to add test-only methods to production code - prevents testing mock behavior, production pollution with test-only methods, and mocking without understanding dependencies

    Also in 4 projects that use this

  • +1 more from shibit-net

The file

We split this skill into the rules it gives an agent

2 rules. 1 is common, 1 is distinctive, and 0 are very specific to this project.

  • 1

    Common

    Most of the 129 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Common:

    Constraints: Don't change other code

    line 35
  2. Distinctive:

    After a worker completes, decide whether to reuse or spawn fresh:

    line 71

“Common” is measured: kept by at least 6 in 10 of the 129 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Dispatching Parallel Agents

Overview

Pattern for dispatching multiple subagents to work on independent tasks simultaneously.

Core principle: Parallel execution of strictly independent implementation or investigation domains.

v3.0: Enhanced with Anthropic coordinator patterns — synthesis iron law, continue/spawn matrix, concurrency management.

The Pattern

1. Identify Independent Domains

Group tasks by what's independent:

  • File A tests: Tool approval flow
  • File B tests: Batch completion behavior
  • File C tests: Abort functionality

Each domain is independent — fixing one doesn't affect the others.

2. Create Self-Contained Agent Tasks

Iron Law: Workers can't see your conversation. Every prompt must be self-contained with everything the worker needs.

Each agent gets:

  • Specific scope: One test file or subsystem
  • Full context: File paths, line numbers, error messages — not "based on earlier findings"
  • Clear goal: Make these tests pass
  • Purpose statement: Why this matters (helps worker calibrate depth)
  • Constraints: Don't change other code
  • Expected output: Summary of what you found and fixed

3. Dispatch with Concurrency Rules

// Read-only tasks (research) → parallel freely
Task("Research auth system — find token handling in src/auth/")
Task("Research session management — how are sessions stored?")
Task("Research test helpers for auth")

// Write tasks → one at a time per file area
Task("Fix auth validation in src/auth/validate.ts")
// Wait for completion before dispatching overlapping writes
Task("Fix session expiry in src/auth/session.ts")

Concurrency management:

Task TypeRule
Read-only (research)Run in parallel freely
Write-heavy (implementation)One at a time per set of files
VerificationCan run alongside implementation on different file areas

4. Synthesize and Integrate

When agents return:

  1. Read each summary — Understand what changed (this is YOUR job, don't delegate)
  2. Synthesize findings — Write specific specs if follow-up work needed
  3. Check for conflicts — Did agents edit same code?
  4. Run full suite — Verify all fixes work together
  5. Decide continue vs spawn for next phase

Continue vs Spawn Decision

After a worker completes, decide whether to reuse or spawn fresh:

SituationActionWhy
Worker researched exactly the files to editContinueAlready has files in context
Research was broad, implementation is narrowSpawn freshAvoid exploration noise
Correcting a failureContinueHas error context
Verifying another worker's codeSpawn freshFresh eyes, no bias
Wrong approach entirelySpawn freshAvoid anchoring on failed path
Unrelated taskSpawn freshNo useful context

No universal default. High context overlap → continue. Low overlap → spawn fresh.

Synthesis Anti-Patterns

❌ Anti-Pattern✅ Correct
"Based on your findings, fix it"Write specific spec with file paths + line numbers
"The worker found an issue, please fix""Fix null pointer at src/auth/validate.ts:42 — add null check before user.id"
Sending one worker to check anotherWorkers report to you; you synthesize
Predicting worker resultsWait for actual results, then synthesize

Agent Prompt Structure

Good agent prompts are:

  1. Self-contained — All context included (workers can't see your conversation)
  2. Synthesized — Proves you understood the problem, not delegating understanding
  3. Focused — One clear problem domain
  4. Purposeful — Includes why this matters
  5. Specific about output — What should the agent return?
## Context
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

## Purpose
These are the last blockers before we can merge the feature branch.

## 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.

## Constraints
- Only modify files in src/agents/
- Do NOT change production code outside abort.ts

## Expected Output
Summary of root cause and changes made. Commit hash.

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"

❌ Lazy delegation: "Based on earlier findings, fix it" ✅ Synthesized spec: Specific file paths, line numbers, what to change

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)

Key Benefits

  1. Parallelization — Multiple investigations happen simultaneously
  2. Focus — Each agent has narrow scope, less context to track
  3. Independence — Agents don't interfere with each other
  4. Speed — 3 problems solved in time of 1
  5. Synthesis quality — Coordinator proves understanding before delegating

Verification

After agents return:

  1. Read each summary — This is YOUR job, don't delegate understanding
  2. Synthesize — Combine findings into a coherent picture
  3. Check for conflicts — Did agents edit same code?
  4. Run full suite — Verify all fixes work together
  5. Spawn fresh verifier — Fresh eyes, no implementation bias

Related Skills

  • coordinator-mode — Full multi-agent coordination SOP
  • subagent-driven-development — Per-task dispatch with review
  • iterative-retrieval — Progressive context gathering for workers
  • verification-before-completion — Evidence-based verification

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.