agentleFS
oleg494oleg494/coding-kit/skills/dispatching-parallel-agents/SKILL.md

dispatching-parallel-agents

Skill3 starsChanged 11 days agoMITView on GitHub

Use when several work slices can be handed to separate agents at once: unrelated failures with distinct root causes, independent subsystems, or parallel slices whose interfaces are already defined. Not for related failures or exploratory debugging (investigate inline), and not for deciding slice boundaries or workspace isolation (use writing-plans and using-git-worktrees).

190 other projects use a version of this, 160 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use chinese-code-review, chinese-commit-conventions and 10 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.
  • Leodorareluctant259Skill

    chinese-code-review

    中文代码审查规范——在保持专业严谨的同时,用符合国内团队文化的方式给出有效反馈

    Also in 8 projects that use this

  • Leodorareluctant259Skill

    chinese-commit-conventions

    中文 Git 提交规范 — 适配国内团队的 commit message 规范和 changelog 自动化

    Also in 8 projects that use this

  • 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 19 projects that use this

  • kntismSkill

    condition-based-waiting

    Use when tests have race conditions, timing dependencies, or inconsistent pass/fail behavior - replaces arbitrary timeouts with condition polling to wait for actual state changes, eliminating flaky tests from timing guesses

    Also in 3 projects that use this

  • xfstudioSkill

    context-driven-development

    Use this skill when working with Conductor's context-driven

    Also in 3 projects that use this

  • EvezArtSkill

    analytics-dashboard

    User behavior tracking and analytics dashboards

    Also in 3 projects that use this

  • +3 more from Leodorareluctant259

The file

We split this skill into the rules it gives an agent

9 rules. 4 are common, 5 are distinctive, and 0 are very specific to this project.

  • 4

    Common

    Most of the 180 edited versions we read keep these.

  • 5

    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:

    When you have multiple unrelated failures (different test files, different subsystems, different bugs), investigating them sequentially …

    line 15
  2. Common:

    No shared state between investigations

    line 43
  3. Common:

    Constraints: Don't change other code

    line 69
  4. Distinctive:

    Interfaces: only where the slice shares a real boundary with a sibling — exact consumed/produced names and signatures, so a worker who sees …

    line 70
  5. Distinctive:

    Use the API the current host actually exposes — its task/subagent tool, its agent-role selector, or an isolated worker session — not …

    line 77
  6. Distinctive:

    Read each summary and check the changed code, not only the claim.

    line 94
  7. Distinctive:

    Look for conflicting edits when two slices touch the same file or concept.

    line 95
  8. Distinctive:

    Run the checks the integrated change needs: the suites the touched code belongs to, going suite-wide when slices shared code or a targeted …

    line 96
  9. Common:

    Self-contained: - All context needed to understand the problem

    line 106

“Common” is measured: kept by at least 6 in 10 of the 180 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

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: Give each independently completable slice its own isolated worker, and delegate only when the slice is worth the coordination cost. The count is not a quota: a task too small to hand over, a host without subagents, or a task whose slices share state runs inline without ceremony.

When to Use

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 dispatch" [label="no - shared state"];
}

Use when:

  • Several failures or work slices have different root causes
  • Multiple subsystems are 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) — investigate together first
  • Understanding requires seeing the full system state
  • Agents would interfere: same files, same service, same database, same port
  • You don't know what's broken yet (exploratory debugging is inherently sequential)
  • One slice is too small to justify the coordination cost
  • The host has no subagent tool — run the work inline; never fabricate a dispatch

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
  • Interfaces: only where the slice shares a real boundary with a sibling — exact consumed/produced names and signatures, so a worker who sees only their task still matches neighboring code
  • Expected output: Summary of what you found and fixed

3. Dispatch with the Host's Delegation Mechanism

Use the API the current host actually exposes — its task/subagent tool, its agent-role selector, or an isolated worker session — not another platform's example. When that tool supports concurrent dispatch, issue the independent slices as one batch; verify from its own documentation or a prior run whether they actually run concurrently rather than inferring it from call placement, since a host may serialize queued workers. Each worker keeps the isolated scope, constraints and interfaces from step 2.

Workspace isolation is not this skill's call. Whether the slices need separate worktrees, who creates them and who removes them on completion belongs to using-git-worktrees; native harness facilities own placement and cleanup, and a dispatcher that invents an extra git worktree add per worker leaves state the harness cannot see. Reuse whatever isolation the plan and the host already established.

4. Review and integrate

  • Read each summary and check the changed code, not only the claim.
  • Look for conflicting edits when two slices touch the same file or concept.
  • Run the checks the integrated change needs: the suites the touched code belongs to, going suite-wide when slices shared code or a targeted run fails. Scale this to the change, not to the number of workers.
  • Integrate all of it before reporting; a returned summary is not a finished slice.

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?
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": the agent wanders. Name one file or one subsystem.
  • No context — "Fix the race condition": the agent doesn't know where. Paste the error messages and the failing test names.
  • No constraints — the agent refactors the world. Say "do not change production code" or "fix tests only".
  • Vague output — "Fix it" leaves you guessing what changed. Ask for the root cause and the changes made.
  • No interfaces — sibling tasks invent each other's names. State the names and signatures that cross a real sibling boundary.
  • Improvised isolation — each agent runs its own git worktree add. Set up isolation once with using-git-worktrees, then dispatch.

Real example

Six test failures across three files after a refactoring:

  • agent-tool-abort.test.ts — 3 failures (timing)
  • batch-completion-behavior.test.ts — 2 failures (tools not executing)
  • tool-approval-race-conditions.test.ts — 1 failure (execution count = 0)

Abort logic, batch completion and race conditions are separate domains, so three workers each took one file. Result: three fixes, no conflicts. The session still ran the full suite, because all three touched shared async-wait code — the scope of verification follows the change, not the worker count.


Source: obra/superpowers (MIT). Adapted for coding-kit: cross-references made local.

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.