agentleFS
a1fa1f/agent-templates/skills/dispatch/SKILL.md

dispatch

Skill2 starsChanged 4 months agoMITView on GitHub

Use when the user wants to start the unblocked PRs from a design doc, issue, or artifact in parallel — one tmux window, worktree, and coding agent per PR — or invokes /dispatch.

26 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use orient, spec and 5 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.
  • moredipSkill

    orient

    Orient yourself to this codebase by reading the README and documentation

    Also in 3 projects that use this

  • SentrySkill

    spec

    Produce a verified spec — problem, desired outcome, and acceptance criteria — before building. Use when given a GitHub/Linear issue link, when starting from a fuzzy in-conversation idea, or asked to "figure out what to do" / "scope this" / "what should I build" — whenever the *what* isn't yet pinned down. Grills the ambiguities, checks the premise against the code, and produces acceptance criteria you sign off on — then hands to design-first.

    Also in 3 projects that use this

  • AWSSkill

    ship

    Finalize dev work on an issue branch — update docs, push, and open a PR.

    Also in 3 projects that use this

  • AWSSkill

    tdd

    Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

    Also in 4 projects that use this

  • MicrosoftSkill

    handoff

    Compact the current conversation into a handoff document for another agent to pick up.

    Also in 4 projects that use this

  • SentrySkill

    commit

    Create commit messages following Sentry conventions. Use when committing code changes, writing commit messages, or formatting git history. Follows conventional commits with Sentry-specific issue references.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 24 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read the source the user named:

    line 34
  2. Very specific:

    A handful (≤ 4): use AskUserQuestion (multiSelect) — one option per ready PR, each labelled <PR#> <slug> with the *What* and *why it's …

    line 74
  3. Distinctive:

    Always show what you are not scheduling and why — blocked rows, and anything the user left unticked.

    line 89
  4. Very specific:

    Write the confirmed rows to a plan file (use a scratch path, not the repo).

    line 95
  5. Distinctive:

    Run it from inside the target repository — it anchors worktrees at that repo's main checkout even when called from a worktree.

    line 130
  6. Distinctive:

    Do not follow the dispatched work yourself.

    line 154

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

dispatch

Take the work that is ready to start in a plan and fan it out: one tmux window per PR, each in its own worktree, each running a coding agent on /make-pr <ref> <PR#>.

/dispatch [<issue ref | artifact | design doc>] [--pr <PR#> ...] [--session NAME] [--dry-run]

  1. Find the unblocked PRs
  2. Confirm which to schedule   (gate — always)
  3. Write the plan
  4. Fan out — one window per PR

You own steps 1–3 (judgement: what is ready, what the user confirms, the plan). The script owns step 4 — the mechanics (worktree, branch, window, launch) — so they are deterministic and repeatable.

--pr <PR#> schedules just those PRs (repeat the flag for a few, e.g. --pr 1.5 --pr 1.7) instead of the whole ready set — use it when you want one PR, not the batch. It preselects; it does not skip the confirmation gate. You still resolve each named PR from the source (for its What → slug and its ref) and still show the rest of the ready list so the user can add to the selection.

Phase 1 — Find the unblocked PRs

Read the source the user named:

  • Issue (#N, 123, or a URL) — gh issue view <N> --json title,body -q .body.
  • File — read it. Artifact URL — fetch it.
  • Nothing given? Scan the conversation for the last PRD published: ... (issue #N) or a plan the user just approved. Confirm the number with the user before proceeding.

Find the PR rows (a ## PR breakdown section from /pr-breakdown has them as | PR | What | LOC | Done when |). If the source has no PR-level breakdown, stop and point the user at /pr-breakdown — do not invent one.

Then decide which rows are ready to start:

SignalWhere it comes from
Dependencies satisfiedthe plan's own ordering and parallelism notes (*n.1 ∥ n.2 (independent)* = no dependency between them; otherwise later rows in a slice wait on earlier ones)
Not already donegh pr list --state all --search "<PR#>" — skip rows with a merged or open PR
Not already startedgit branch -a and git worktree list — skip rows that already have a branch or worktree

A row is ready when its dependencies are merged and nothing is already in flight for it. When the plan marks a status column explicitly, trust it, but still check for an in-flight branch or PR so a half-finished run does not hand out the same row twice.

Give each ready row a short kebab-case slug derived from its What (^[a-z0-9][a-z0-9-]*$, 2–4 words, e.g. evidence-schema). The slug names the branch, the worktree directory, and the window, so keep it short and distinct.

When --pr <PR#> was given: resolve each named PR from the source the same way (its What → slug, its ref), and mark it as the preselected candidate. Still compute the full ready set — the gate offers the rest so the user can add. If a named PR is blocked (a dependency is unmerged) or already in flight (has a branch or open PR), do not silently drop it: carry it into the gate flagged with the reason, and let the user decide.

Phase 2 — Confirm which to schedule (gate — always)

Never schedule without an explicit confirmation this run — each PR opens a window and spends real tokens. This gate runs every time, including when --pr named exactly one PR.

Offer the ready PRs as a list the user picks from:

  • A handful (≤ 4): use AskUserQuestion (multiSelect) — one option per ready PR, each labelled <PR#> <slug> with the What and why it's ready in the description. Preselect the --pr ones in your recommendation; if --pr named none, recommend the whole ready set. The user ticks the subset to launch.
  • More than that: show the table in chat and wait for approval or edits.
| PR | What | Slug | Why it's ready |
|----|------|------|----------------|
| 1.5 | Evidence handoff schema | evidence-schema | 1.4 merged (#138) |
| 1.6 | Vale prose gate | vale-gate | independent of 1.5 |

Blocked, not schedulable: 1.7 (waits on 1.6), 2.1 (waits on slice 1)

Always show what you are not scheduling and why — blocked rows, and anything the user left unticked. A silently dropped row reads as "everything is covered" when it isn't. Dispatch only the PRs the user confirmed here.

Phase 3 — Write the plan

Write the confirmed rows to a plan file (use a scratch path, not the repo). One confirmed PR is just a one-item items list — the tool dispatches one window all the same:

{
  "ref": "#135",
  "base": "origin/main",
  "items": [
    { "pr": "1.5", "slug": "evidence-schema" },
    { "pr": "1.6", "slug": "vale-gate" }
  ]
}
  • ref — what the child agent works from, passed through to /make-pr <ref> <PR#>. An issue (#135), a path, or a URL. A row may override it with its own ref.
  • base — optional, defaults to origin/main. Every worktree branches fresh from it, so run git fetch origin first if main has moved.
  • session — optional; the current tmux session is used when absent.

Fields are charset-checked (slug, PR id, ref, base, session): the plan becomes a shell command, and a rejected plan is a typo caught early. Fix and rewrite rather than working around a rejection.

Phase 4 — Fan out

The tool is the package staged at ~/.claude/at/scripts/dispatch; run it as a module so its imports resolve:

PYTHONPATH=~/.claude/at/scripts uv run --no-project --with click \
  python -m dispatch --plan <plan.json> [--session NAME] [--dry-run]

Run it from inside the target repository — it anchors worktrees at that repo's main checkout even when called from a worktree.

Per row it creates the worktree <repo>/.claude/worktrees/<slug> on a new branch worktree-<slug>, opens a tmux window pr-<PR#> already cd'd into it, and types claude "/make-pr <ref> <PR#>" there, then Enter.

  • --dry-run prints every git/tmux command and changes nothing. Use it when the user is unsure, or when a plan is large.
  • --session NAME targets a session other than the current one. Outside tmux this is required.
  • --agent selects the coding agent; claude is the only one wired today.

Exit codes: 0 all windows up, 1 at least one failed (each row is isolated — one failure does not stop the rest), 2 the plan or environment was rejected before anything ran.

Phase 5 — Report

Say what is now running and how to reach it — window names, worktree paths, and any row that failed with its reason. Note that each window's agent stops at Claude Code's first-run "Do you trust this folder?" prompt (every worktree is a new directory); the user presses Enter once per window to start it.

Do not follow the dispatched work yourself. Those agents run independently; this skill is done once the windows are up and reported.

Common mistakes

MistakeFix
Scheduling without the confirmation gateIt runs every time — confirm the subset first, even for a single --pr
Treating --pr as "skip the gate"--pr preselects; the user still confirms, and still sees the rest of the ready list
Dropping a named --pr row because it's blockedCarry it into the gate flagged with the reason; let the user decide
Inventing PR rows the plan does not haveStop; send the user to /pr-breakdown
Dispatching a row that already has a branch or open PRCheck git branch -a and gh pr list in Phase 1
Running the script from outside the target repocd to the repo first — the repo it is run in is the repo it branches
Long or duplicated slugs2–4 kebab-case words, unique within the plan
Babysitting the spawned windowsThey are independent; report and stop

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.