/agents-skills:dispatching-subagentsfrom agents-skills
Orchestrates sub-agents to implement tracker issues: selects issues, resolves model/effort, writes dispatch briefs, launches parallel agents, recovers stalls, and verifies PRs before merging.
Ships in agents-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This skill is the dispatch half of a multi-agent issue-orchestration system. It covers everything between "an issue is ready to work" and "a sub-agent has opened a PR": picking the issue, resolving model and effort, writing the brief, launching in parallel, recovering stalls, and verifying completions.
Companions in the same family: the issue-filing skill (gh-issue-filing for GitHub, jira-issue-filing for Jira) defines what a dispatchable issue looks like; the issue control-field skill (gh-issue-labels for GitHub labels, jira-issue-fields for Jira fields) defines the control taxonomy this skill reads; the issue-locking skill (gh-issue-locking / jira-issue-locking) defines the claim that must precede every dispatch; the orchestrating-slots skill runs the loop that calls this one; the driving-prs-to-merge skill defines what the agent owes after gh pr create.
Every value below is project-specific. The adopting project must define these in its own CLAUDE.md; this skill refers to them by placeholder. Do not copy the example column into a new project unverified.
| Binding | Placeholder | Example |
|---|---|---|
| Integration branch PRs target | <integration-branch> | dev (NOT the default branch, so issue auto-close never fires — close explicitly on merge) |
| Repo root | <repo-root> | resolve dynamically: git rev-parse --show-toplevel — hardcoding a path rots |
| Worktree location | <worktree-dir> | <repo-root>/.worktrees/<name> (git-ignored) |
| Branch naming | <branch-convention> | feat|fix|chore|docs/<N>-<slug> (encodes the issue number) |
| Commit message convention | <commit-convention> | lowercase conventional-commit subject (lowercase because the project's title-format check may reject leading capitals); body ends with Closes #<N> |
| Toolchain prefix for git hooks | <toolchain-prefix> | e.g. a runtime-version bootstrap such as source <version-manager> && use <version> && (empty if the project's hooks need no runtime bootstrap, or it has no hooks) |
| Lockfile-faithful install | <lockfile-install-cmd> | the ecosystem's frozen-lockfile install (e.g. <pkg-manager> install --frozen-lockfile) |
| Force-push policy | <force-push-policy> | sub-agents may force-push their own branch with --force-with-lease; orchestrator handles any case where permission-blocking applies |
| Derived files never committed | <derived-files> | generated status/manifest files (regenerated by post-merge automation) |
| Model tiers | <cheap-model> / <workhorse-model> / <premium-models> | haiku / sonnet / opus, fable |
| Auto-merge invocation | <auto-merge-cmd> | gh pr merge <N> --auto — verify whether a strategy flag is accepted; some merge queues reject one and enrollment silently drops |
| Pre-push hook cost | <hook-cost> | e.g. several minutes (full local unit suite) |
| Traceability scheme (optional) | <traceability-scheme> | REQ-<PREFIX>-<NUMBER> tags in test names |
| Design source of truth (UI projects) | <design-source> | the project's authoritative design artifacts (e.g. a checked-in design-system/ folder or a referenced design tool) |
| Test-layer menu | <test-layers> | unit / integration / smoke / E2E |
| Bot reviewer(s) | <bot-reviewer> | the project's automated PR-review bot, if any |
The operator login is never a binding: resolve it at session start with gh api user --jq .login. Hardcoded logins in dispatch templates are a documented hazard — a stale login can sit in a template for weeks while a different operator runs the sessions.
Apply these rules in order; each exists because its violation has a known cost:
Closes #N lines. Review cost is per-PR, not per-line: a 4-string-edit PR costs the same review effort as a 1-string-edit PR, and one PR can't conflict with itself.Tie-break: when in doubt, prefer the smaller issue. A 2-line copy fix shipping beats a 200-file refactor stalled.
After picking, read the issue's control fields — they drive model and effort selection:
gh issue view <N> --json labels
Skip anything carrying the project's hold marker (e.g. a do-not-dispatch label, or the equivalent status/field in Jira) — see the control-field skill. Holds must be honored from the machine-readable field, not just remembered from comments; explicit "do not implement" comments have failed to stop a dispatch that broke a deploy for hours.
Resolve both from three sources, highest precedence first: (1) an explicit operator chat instruction for this dispatch always wins, even over the issue's control fields; (2) the issue's control fields (a model field like agent-model:*, an effort field like agent-effort:*) are the persistent per-issue knob; (3) defaults — <workhorse-model> for anything that writes or modifies code, <cheap-model> only for narrow mechanical tasks where errors are immediately visible, <premium-models> never on your own initiative. A premium-model setting counts as the operator's explicit instruction. If still ambiguous, default to <workhorse-model> and proceed. Pass the model explicitly on every Agent call. Effort has no API parameter — translate the field into a prose directive inside the brief. Full taxonomy, tier rationale, incident evidence, and the deliberate absence of a cheap-tier setting: see the control-field skill.
Premium-access fallback. If an issue carries a premium-model setting and your session cannot dispatch on that model, release the claim and leave the setting in place so an operator session with access picks it up. See the control-field skill for the full fallback steps.
Claim the issue before spawning the agent, never after — the window between dispatch and lock is exactly when concurrent operators double-claim. The claim has three signals: the claim marker (<claim-label> or the tracker's claim field), the assignee set to your resolved operator login, and a machine-parseable lock comment. Re-verify the assignee list is empty immediately before locking; queue/status markers alone are not authoritative — a stale ready-to-dispatch marker has caused multiple double-locked issues. Full protocol, lock-comment format, and stale-expiry: see the issue-locking skill.
This is the core of the skill. Every section earned its place by a failure class that occurred when it was omitted. Include all eight; the toolchain and hygiene blocks go in verbatim (placeholders substituted), not summarized — they are "LEARNED FROM RESCUES" and their omission is the most-repeated source of failed pushes.
Tell the agent to read the issue first and treat it as the spec:
Run `gh issue view <N> --comments` (or the tracker's equivalent fetch)
and read the full issue and comment thread before writing any code.
The issue body is the spec.
Do not paraphrase the full body into the brief — paraphrased specs drift from the source of truth, and the agent then implements your summary instead of the requirement. Restate only the acceptance criteria (in section e) as a scope check.
Verbatim commands, placeholders substituted:
git -C <repo-root> fetch origin <integration-branch>
git -C <repo-root> worktree add \
<worktree-dir>/<descriptive-name> \
-b <branch-convention> origin/<integration-branch>
cd <worktree-dir>/<descriptive-name>
Never the primary checkout, never branched from whatever happens to be checked out. Agents that work in the primary checkout collide with the orchestrator and with each other; agents that branch from a stale or wrong base ship diffs full of unrelated changes. The branch name encodes the issue number so PRs, locks, and worktrees are mutually traceable.
If <toolchain-prefix> is non-empty, include the exact shell prefix that makes the project's git hooks runnable in a fresh non-interactive shell, and the rule that goes with it:
Every shell that runs `git commit` or `git push` must be prefixed with:
<toolchain-prefix>
Never use --no-verify. If a hook blocks you, fix what it is flagging.
Sub-agent shells are non-interactive; without the prefix the hook's runtime is missing, the hook fails confusingly, and the agent reaches for --no-verify — which ships exactly what the hook would have caught.
If <toolchain-prefix> is empty, state explicitly in the brief that no prefix is needed, but retain the --no-verify prohibition unconditionally.
Include this block verbatim (substitute placeholders). Each rule is a previously-paid rescue:
PRE-PUSH HYGIENE (non-negotiable):
1. If the project runs pre-push verification hooks (<hook-cost>): ALWAYS
`git fetch origin <integration-branch> && git rebase
origin/<integration-branch>` immediately before your FIRST push —
never push on a stale base to "see if CI passes". If a sibling PR
merged shared files while you worked, pushing on a stale base burns
that entire run and the hook rejects you anyway for being behind.
Rebase FIRST, then push — every time, including the first.
2. After every rebase, run `<lockfile-install-cmd>` (if the ecosystem
has one) so new transitive dependencies from sibling merges are present
before any local verification runs. Missing-dependency failures (any
"not found" / "cannot find module" error your toolchain emits for an
undeclared dep) are the most common cause of post-rebase pre-push
failures.
3. Never commit <derived-files> — they are regenerated by post-merge
automation; committing them causes constant merge conflicts. Do not
`git rm` them either (they regenerate); just never `git add` them.
Stage only your code and intentional doc edits.
4. A branch whose commits have never been on origin takes plain
`git push -u origin <branch>` — NOT force. Force-push is only
legitimate after rebasing an existing remote branch, and then only
`--force-with-lease` — unless <force-push-policy> reserves force
pushes for the orchestrator, in which case STOP and report so the
orchestrator performs the push (see driving-prs-to-merge).
<design-source> artifacts the agent must read and match.<test-layers> layer the behaviour should be covered at — the cheapest layer that actually exercises it — and, if the project uses <traceability-scheme>, the ID the test must carry.Include verbatim:
GIT DISCIPLINE:
- Commit after each logical step — do not save a single large commit
for the end. Per-step commits mean a stalled agent's worktree can be
salvaged and resumed from the last commit in minutes rather than
replaying the whole task from scratch.
- Never run `git reset --hard`, `git rebase -i`, `git checkout <other-branch>`,
or any history-destroying command.
- If git state ever looks unexpected (wrong branch, commits you don't
recognize, dirty files you didn't touch): STOP and report. Do not
"clean up".
- Stay inside your worktree for the entire task.
Why the reset ban: a confused agent that runs git reset --hard to "clean up" unexpected state can silently destroy prior commits; recovery then needs git fsck --unreachable. Cheaper to ban the command than to fish objects out of the GC.
1. Run the project's local verification (lint, typecheck, tests for the
touched packages AND their dependents; include any coverage flags CI
enforces) and confirm green BEFORE committing the final state.
2. Commit per <commit-convention>; body ends with `Closes #<N>` (one
line per bundled issue).
3. Rebase + `<lockfile-install-cmd>` + push, per the pre-push hygiene block.
4. gh pr create --base <integration-branch> --head <branch> \
--title "<conventional title>" --body "<structured body with Closes #<N>>" \
--assignee "$(gh api user --jq .login)"
Add any labels the project requires at creation time.
5. Verify the PR landed with the correct assignee and labels:
gh pr view <PR#> --json assignees,labels
Repair via the REST API if anything is missing — never via `gh pr edit`
(can exit 0 yet persist nothing).
6. Enable auto-merge immediately: <auto-merge-cmd>
7. Drive the PR to green per the driving-prs-to-merge skill: respond to
every review thread including <bot-reviewer>'s, fix CI, stay rebased.
The assignee is what --assignee @me filters on when multiple operators run concurrently — author is automatic, assignee is the ownership signal. Auto-merge at open means the PR merges the moment gates clear with no babysitting; verify which invocation the project's branch protection accepts, because a merge queue can reject a strategy flag and silently drop enrollment (a project's two docs can disagree for exactly this reason).
Require the agent to report back, explicitly:
<traceability-scheme> ID used if applicable.git status --short output from the worktree (proves nothing is left uncommitted).The return contract gives the orchestrator a clean handle for completion verification (section 7) and for the close-on-merge tick. Without it, agents end with a confident prose summary and the orchestrator has to forensically reconstruct what actually happened.
If two or more selected issues are file-disjoint AND logically independent, dispatch them in the same message with multiple Agent calls so they run concurrently — serial dispatch of independent work wastes wall-clock time.
Default guideline when the operator has not set <slot-count>: 3–5 concurrent sub-agents. Above that, the merge pipeline backs up and every merge invalidates the other branches' bases — rebase-thrash cost exceeds the parallelism win. The authoritative cap is operator policy; see the orchestrating-slots skill. The cap bounds agents, not processes: each agent multiplies build-tool and test-runner concurrency, so on constrained machines also cap tool-level workers, or the host OOMs (unbounded parallelism has frozen a multi-GB workstation more than once this way). Slot accounting and event-driven refill belong to the orchestrating-slots skill.
Sub-agents stall: runtime watchdogs kill them after a no-progress timeout (e.g. ~600s, often a transient infrastructure blip) and report status: failed. A failed status does not mean lost work — the agent's worktree retains all local changes. Treating a stall as a total loss wastes a full implementation cycle, so always audit before re-dispatching.
git -C <worktree-dir>/<name> log --oneline origin/<integration-branch>..HEAD
git -C <worktree-dir>/<name> status --short
| Worktree state | Action |
|---|---|
| Local commits, clean tree | Orchestrator finishes the job itself: rebase, <lockfile-install-cmd>, plain push, gh pr create + auto-merge per section (g) |
| Uncommitted changes | Stage code only (exclude <derived-files>), commit, then as above |
| No commits, no changes, or worktree gone | Re-dispatch fresh on a -v2 branch (below) |
Before any salvage push: fetch + rebase onto the integration branch + <lockfile-install-cmd>, then plain push — the same hygiene the agent would have owed. If multiple agents stalled at once, parallelize the installs and pushes, but only after per-branch confirmation that each working tree actually has the code intact; batch-pushing unverified worktrees ships partial work.
-v2 re-dispatch for irretrievable attemptsWhen the first attempt left nothing salvageable:
git -C <repo-root> worktree add <worktree-dir>/<name>-v2 \
-b <branch>-v2 origin/<integration-branch>
Include in the new brief: "A prior agent on this issue stalled before pushing and its worktree was cleaned up. Start fresh." The -v2 suffix avoids collisions with remote ghosts of the dead branch; the note prevents the new agent from being confused by residue. Do not redo the implementation yourself in this case — dispatch a fresh agent so the audit trail stays clean.
Agent completion reports are optimistic. Observed failure modes, each with its check:
gh pr list --head <branch>; if no PR, audit the worktree per section 6 and self-handle push + PR. Re-dispatching hits the same wall.git push exit 0 is unreliable from background shells. Verify git ls-remote origin <branch> matches the worktree's HEAD.git -C <worktree> log origin/<branch>..HEAD is empty before trusting a "resolved" state — the queue will otherwise merge pre-fix code.--assignee flag even when the brief bolds it. After every dispatch: gh pr view <N> --json assignees,labels and repair via the API if missing (the REST assignee endpoint works even on merged PRs). Note that gh pr edit can exit 0 yet persist nothing — verify with gh pr view --json <field> after any edit.git status immediately.Only after these checks does the PR enter the merge-driving phase — see the driving-prs-to-merge skill — and the issue gets closed on merge per the issue-locking skill's release protocol.
Never do these; each is a previously-paid failure:
agent-model: / agent-effort: or their tracker equivalents). They are the persistent operator control plane.--no-verify past a failing hook. The hook is real; fix what it is flagging.git rm derived files. They regenerate; the fix is to never git add them.gh api user --jq .login and verify on the opened PR — hardcodes rot and agents drop flags.<workhorse-model> and proceed.-v2; keep the audit trail clean.This skill runs in high-volume, repetitive orchestration loops where tokens compound across many rounds and many agents. Operate in caveman mode (load the caveman skill) to cut token use on all working output — status, reasoning, slot tables, completion reports, dispatch and coordination chatter.
Caveman compresses prose only. It must NEVER alter machine-precise content, which stays byte-exact: lock-comment markers, the RECON OK / RECON-ERROR contract lines, JQL, gh / Atlassian-MCP commands, label and field names/values, file:line references, code blocks, and acceptance-criteria checklists. Compress the narration, never the protocol.
Durable prose a human reads later — issue/ticket bodies and PR descriptions — is the exception: write those through the humanizer skill (see the issue-filing skill), not in caveman.
The orchestrator's context is the expensive one — don't burn the workhorse/premium session on plumbing. Local mechanical work — ls/grep/git status, file/symbol lookups, listing issues or PRs, log triage, running a fixed command and parsing its output — goes to a cheap-tier subagent (the cheapest native model per platform: Haiku on Claude Code, Raptor Mini / GPT-mini on Copilot, free Auto on Cursor — see MODEL-DEFAULTS.md) that returns only the distilled, caveman-compressed answer. The main thread then spends a fraction of the tokens and keeps its context for judgement. The caveman plugin's caveman:cavecrew-investigator agent (read-only locator, caveman output) is one ready implementation; otherwise dispatch a sub-agent pinned to <cheap-model> for the lookup. Never escalate a mechanical sub-step to workhorse/premium "just in case" — a wrong answer there is obvious at a glance, which is exactly why the cheap tier is safe for it.
What SKILL.md sets; muted values are Claude Code's defaults
32 skills in this plugin
/browser-diagnosisReproduce and root-cause a front-end bug in a real browser using whichever browser MCP is connected — Chrome (claude-in-chrome), Playwright, Cypress, or Chrome DevTools — not just one. Drive the page as the signed-in user, watch the network and console, capture the failing request/response, shim/mock to isolate the fault, and record a repro, then hand the evidence to the issue being filed. Use whenever a symptom needs live-browser evidence (the toast says failed but it saved, a column shows zero, a click 404s) and from the /…-use-browser command family (and the engine-pinned /…-use-chrome, /…-use-playwright, /…-use-cypress variants), the /…-use-aws-browser commands, and the diagnostician agent. Picks the available MCP automatically and degrades gracefully when none is connected./cavemanUltra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested./ci-flake-huntingThe authoritative method for hunting, root-causing, and fixing CI flakes so the merge queue stops ejecting correct PRs and churn drops. A flake is a test that fails then passes on retry with NO code change explaining it — every red speculative merge-queue build ejects a correct PR and disarms its auto-merge, so a live flake taxes every PR behind it. Encodes the loop — MINE CI history for real flakes → REPRODUCE harsher-than-CI → ROOT-CAUSE the real mechanism (hydration/render race, settle race, mock-order, loading-state race, click-through fragility) → FIX FORWARD (test or component, never mask) → VERIFY by re-running many times → UNSTICK the PRs the flake stranded → REPEAT. And how to tell a true code flake from transient INFRA (CDN/mirror outage, expired token mid-suite, rate-limit/WAF, external-service cap, cloud state-lock, CI-provider billing/outage, upstream bump) which must NOT be code-fixed. Use whenever chasing CI instability, "deflake this spec", "CI keeps ejecting my PR", "is this a flake or real", a shard that intermittently reds the queue, or running the ci-flake-hunter lane. Distinct from ci-speed-hunting (which owns slow-but-green jobs — flake never touches timing/sharding)./ci-speed-huntingThe authoritative method for hunting, diagnosing, and fixing CI SLOWNESS so the merge queue drains faster and throughput rises — the target is wall-clock latency, NOT correctness (a job that is GREEN but slow). Encodes the loop — MINE CI timing for the real long poles → DIAGNOSE the bottleneck class (under-sharded matrix, cold cache, missing/too-broad path-filter tier, serial needs-chain, redundant rebuild) → PROVE the fix keeps identical coverage → FIX FORWARD → VERIFY the before/after delta at unchanged coverage → REPEAT. And the hard line — speed comes from doing the same work faster or skipping PROVABLY irrelevant work, NEVER from deleting tests, narrowing greps, dropping shards, or removing a gate. Use whenever chasing CI latency, "CI is too slow", "speed up the checks", "why does the merge queue take so long", re-sharding an E2E matrix, adding or fixing a cache, tuning changed-paths tiering, or running the ci-speed-hunter lane. Distinct from ci-flake-hunting (which owns failures and flakes — speed never touches a red job)./deploy-watchingSingle-lane interval watcher that keeps the integration environment's deploys healthy by fixing FORWARD — the deploy-health lane of a multi-agent fleet. Each tick it reads the newest deploy run, locates the red (deploy step vs post-deploy smoke), classifies it transient (concurrent-deploy state-lock race, CI-infra blip, known smoke transient) or real (deterministic IaC error, ordered co-deploy race, regression from a merged commit, contention inside the shared environment), re-runs the former, and mints a forward-fix PR for the latter that preserves the offending commit's intent — never a revert, never a skipped test. Loops on an interval ("/loop <interval> start"). Use when running a deploy lane, when the dev/staging deploy went red after a merge, when deciding whether a red deploy needs a re-run or a code fix, when the environment may be running stale code, or when `pr-checks` hands over a failure rooted in the integration branch rather than a PR's diff./doc-coauthoringGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.npx claudepluginhub skyfox675/agents-skills --plugin agents-skillsOther plugins' skills for the same job