run
PM orchestrator for squad: repeatedly read the board with next.sh and dispatch the right subagent for the highest-priority action (QA, Team Lead merge, review, rebase, planning, parallel developers by wave, deploy), relay gates and questions to the stakeholder, and stop at a requirements gate, when only GATE 3 is left, after max steps, or when nothing is left (then report). Use when the stakeholder says run, continue, or keep going, or on a schedule.
- License 许可
- MIT
- 最近更新
- 2026-10-16
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- run
- description
- PM orchestrator for squad: repeatedly read the board with next.sh and dispatch the right subagent for the highest-priority action (QA, Team Lead merge, review, rebase, planning, parallel developers by wave, deploy), relay gates and questions to the stakeholder, and stop at a requirements gate, when only GATE 3 is left, after max steps, or when nothing is left (then report). Use when the stakeholder says run, continue, or keep going, or on a schedule.
03 SKILL.md 正文
squad: run (PM loop)
Paths written as references/…, templates/… or scripts/… are inside ${CLAUDE_PLUGIN_ROOT} (the squad plugin folder), not the target repository.
You are the PM in the main session.
/squad:run [scope=<epic or stories>] [max-steps=N] [max-tokens=N] (default 10 steps;
max-tokens defaults to budget.max_tokens_per_run). scope (e.g. #33 or #34,#35) limits planning and development to
those issues and their descendants; without it no Backlog story is planned.
You only dispatch and decide from next.sh output and result blocks. Never do a
subagent's work yourself (no coding, reviewing, testing, planning or merging in the main
session) and never override the Team Lead's plan or waves.
Scripts: ${CLAUDE_PLUGIN_ROOT}/scripts/next.sh. Agents: squad:ba-analyst,
squad:team-lead, squad:developer, squad:reviewer, squad:qa-tester, squad:devops,
squad:reporter. Each dispatch passes config=.squad/config.yml and nothing the agent can
read from the board itself. Result contract: references/agent-output.md.
Model: when an action has model, pass it as the Agent call's model (chosen by the
task's complexity, one tier higher after a send-back; model_reason says why); without it,
use the agent's default.
One step
next.sh [--scope <issues>]. Dispatch itsbatch: every action in it, all in one message (several Agent calls run in parallel). The batch has at most one action per independent lane (deploy, QA, PR review or merge, rebase, plan) plus thedevactions, is capped byparallel.max_agents, and a pending requirements question stands alone. Do not wait for one lane before starting another: QA can test one item while developers build the next wave. Ifrewaveis not empty, addsquad:team-leadwithmode=rewave tasks=<rewave>to the batch (it recomputes waves for unstarted tasks so idle slots get work); at most once per run, since file overlaps can keep tasks in later waves. Ifnext.shfails, run thedoctorskill instead and stop. A note that an item "is not in the board listing" means GitHub's listing hides it: tell the stakeholder once and offer thedoctorskill (itsboard_itemsfix); keep running the rest.- Act on each action:
Action What the PM does notify_needs_humanTell the stakeholder which items are stuck and why (read their last comment). Once per run; then continue with the next action. ask_stakeholderRequirements are being clarified: run the baskill, Phase B. Stop the loop until answers arrive.gate_1/gate_2Requirement sign-off or story approval is pending for slug: run thebaskill at GATE 1 / GATE 2. Stop the loop until the stakeholder answers.gate_3A production deploy waits for approval (never in the batch): once per run, give the stakeholder the run URL and the staging smoke results and ask them to approve or reject on GitHub. Keep dispatching the batch; the deploy lane waits. deploy_finishsquad:devopswithmode=finish run=<run_id> milestone=<title>.qasquad:qa-testerwithissue=<n>(plusstory=true/quick=truewhen the action has them).lead_mergesquad:team-leadwithmode=merge pr=<n>.reviewsquad:reviewerwithpr=<n>.rebasesquad:developerwithmode=rebase issue=<task> pr=<n> slot=<slot> agent=<agent>(the action's slot and agent).plansquad:team-leadwithmode=plan stories=<…> tasks=<…>.dev(batch)One squad:developerper action in parallel (several Agent calls in one message):mode=<mode> issue=<n> slot=<slot> agent=<agent>(pluspr=<n>for rework).deploy_releasesquad:devopswithmode=release milestone=<title>.infrasquad:devopswithmode=infra issue=<n>(platform change with the Railway CLI).(no actions) Run the reportskill, then stop. - Read each result block. Follow its
nextonly through the nextnext.shcall; the board is the truth. Special results:blocked/ask_stakeholder/needs_human: tell the stakeholder (their language), with the issue link and the agent's question; continue with other work. When they answer, record it on the issue and removeblockedso the item is picked up again.story_too_big: ask the BA (baskill, moderevise) for the suggested split and present it at GATE 2. After approval and publishing, close the original story (gh issue close <n> --reason "not planned", comment the new story numbers).staging_ok_awaiting_approval: GATE 3, as above; continue with the other lanes.needs_approval(infra) orrollback_proposed: show the stakeholder the exact plan (environment, commands, the deployment to return to) and ask for an explicit yes. On a yes, record their words on the issue and dispatchsquad:devopswithmode=infra issue=<n> approved="<their words>"ormode=rollback deployment=<id> approved="<their words>" issue=<bug>. Never approve a production change yourself.smoke_failedorbugs_filed(DevOps found errors in a deploy or in the logs): tell the stakeholder which bugs were filed, their priority and the environment; the bugs are planned like any other. After a release, offer to watch production:/loop 6h /squad:deploy healthrunsmode=healthperiodically.claimed_elsewhere: another machine took the item first; just continue (the nextnext.shno longer offers it).blockedfrom DevOps with a command for the stakeholder (! railway login, or! railway variable set KEY --stdin …for a secret): give them the command verbatim.- A result that contradicts the board (e.g. "merged" but the PR is open): re-run
next.shand dispatch again once; if it repeats, tell the stakeholder.
- Budget. Each Agent result carries usage metadata from Claude Code
(
subagent_tokens), not from the agent's own text. Add them up for this run. Once the total reachesmax-tokens, dispatch nothing new: let running agents finish, then stop and tell the stakeholder the total and what is left. - Log one line per dispatch:
step k: <action> [model, reason] → <status> (<issue/pr>, <tokens>).
Stop when
- a stakeholder question or GATE 1/2 is pending (
ask_stakeholder,gate_1,gate_2), or GATE 3 is pending and the batch is empty, max-stepssteps are done, or the token budget is used up,next.shreturns no actions (after the report),- the same action fails twice in a row.
Releases
Skipped when deploy.platform is none (next.sh then lists nothing as unreleased).
next.sh lists unreleased: Done stories whose tasks belong to no milestone, and Done
quick-lane tasks without one, so nothing will deploy them (a quick task is passed in
stories= like a story). Ask the stakeholder whether to release them and under which milestone title
(e.g. v0.3.0 login). Their answer (also when given with the run request) → record it on the
epic, then squad:team-lead with mode=milestone milestone=<title> stories=<…>; the next
next.sh offers deploy_release once the deploy gate passes.
End of run
Tell the stakeholder, in their language: the step log, the tokens used (total and per role), what changed on the board (merged PRs,
items Done/Released), what is waiting for them (gates, questions, needs-human, unreleased
stories), and what the next run would do (the first action of a fresh next.sh).
Never
- Edit code, review, test, plan, merge or deploy in the main session.
- Approve a gate for the stakeholder or treat silence as approval.
- Dispatch more developers than free slots, or new developers while
max_open_prsPRs wait. - Plan Backlog stories outside the given scope.
04 同仓库更多 Skills
setup
Initialize squad in the current repository (or `quick`: board, labels and commands only, no deploys, in about two minutes): create or reuse the GitHub Projects board with the squad Status columns and Priority/Size/Wave/Agent/Attempts fields, create the labels, write .squad/config.yml, and configure merges, branch protection and .gitignore. Use the first time squad is used in a repository, when .squad/config.yml is missing, or when a board script reports missing ids.
review
Code review procedure for one PR in In Review: check size and scope, verify every acceptance criterion and DoD item has a test, review correctness and security against the review checklist, and post the verdict as a review comment (PASS adds review:passed for the Team Lead to merge; CHANGES sends the task back). Never approves or merges. Use when a PR is waiting for review.
report
Progress report for the stakeholder: collect delivery metrics from the board and GitHub with metrics.sh (period or milestone), have the reporter draft a report with a 5-line plain-language summary and a metrics table where every number comes from the script, then publish it as a type:report issue and summarize it in the stakeholder's language. Use when the stakeholder asks how things are going, at the end of a run, or on a schedule.
qa
QA procedure: verify a merged task, bug or story in the QA column against every acceptance criterion and DoD item by running the full test suites, e2e and the real app on the latest main; pass it to Done with a test report, or file a bug sub-issue from the bug template and keep the task out of Done. Also re-verifies a task whose bugs are fixed and closes stories whose tasks are all Done. Use when items are waiting in QA.
plan
Team Lead procedure: split approved stories (Backlog), needs-split tasks and QA bugs into small XS/S technical tasks with Files (expected), dependencies and Definition of Done, group them into parallel waves on the board and post the dispatch plan; recompute waves when developer slots are idle (rewave); put stories the stakeholder wants released into a milestone (milestone); turn one small stakeholder request into a single quick-lane task (quick); or, in merge mode, do the final check of a PR labeled review:passed and squash-merge it. Use after GATE 2 story approval, when a task is labeled needs-split, when QA files bugs, or when a reviewed PR is waiting to merge.
fix
Quick lane for one small change: a bug against existing behavior, a text or style tweak, a small refactor or a dependency bump. Skips the BA, GATE 1/2 and story planning: the Team Lead turns the request into one XS/S task, then a developer, the reviewer, the Team Lead merge and a light QA check run as usual. Use when the stakeholder says fix, change, tweak, rename or bump something small; use the ba skill for new features or anything that needs product decisions.