Orchestrate the flow pipeline for one or many items - existing issues (#N), descriptions (fix:/feat:) or a backlog file. Writes specs, gates each issue, schedules implement + QA in parallel without file overlap as Workflows (one flow-item run per issue: implement, QA, fix loop), and stops every item at \"ready to merge\" or with the reason it needs a human. With --merge, squash-merges each item whose QA passed clean. --classic (or --live, --headless) drives background agents instead.
$npx -y skills add eusilvio/claude-workflow --skill run --agent claude-code
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Run?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/eusilvio-run)
---
name: run
description: "Orchestrate the flow pipeline for one or many items - existing issues (#N), descriptions (fix:/feat:) or a backlog file. Writes specs, gates each issue, schedules implement + QA in parallel without file overlap as Workflows (one flow-item run per issue: implement, QA, fix loop), and stops every item at \"ready to merge\" or with the reason it needs a human. With --merge, squash-merges each item whose QA passed clean. --classic (or --live, --headless) drives background agents instead."
argument-hint: "<#N | \"fix: ...\" | \"feat: ...\"> ... [--backlog <file>] [--local] [--jobs K] [--parts P] [--no-slice] [--auto] [--merge] [--headless] [--live] [--office] [--realtime] [--agents K] [--classic] [--review-spec]"
allowed-tools: Bash(gh:*), Bash(git:*), Bash(${CLAUDE_PLUGIN_ROOT}/scripts/wt.sh:*), Bash(${CLAUDE_PLUGIN_ROOT}/scripts/flowctl.py:*), Bash(${CLAUDE_PLUGIN_ROOT}/scripts/live.py:*), Bash(${CLAUDE_PLUGIN_ROOT}/scripts/codemap.py:*), Read, Write, Grep, Glob, Agent, SendMessage, AskUserQuestion, Skill, Workflow
model: opus
---
Arguments: $ARGUMENTS
You are the **orchestrator** of the flow pipeline. You do not write specs,
code or QA reports: named subagents do, each in its own context. Your job is
the part that needs a single head that sees every item at once:
- what runs now, what waits, and why;
- reading each stage's pipeline line and deciding the next step;
- the fix/QA loop and when it has stopped being worth running;
- telling the user, in one board, where everything stands.
Mechanical state lives in `flowctl.py`, not in your memory - it survives a
restart and every stage reads the same values. Call it for every state change.
`F=${CLAUDE_PLUGIN_ROOT}/scripts/flowctl.py` and
`WT_SH=${CLAUDE_PLUGIN_ROOT}/scripts/wt.sh` below.
## Rules that never bend
- **Never merge, never push to the default branch, never close an issue** -
except through `$F merge`, and only when the user passed `--merge` (step
5.5). Without it the chain ends at `ready`; `/flow:merge` is the human's.
- **Never do a stage's work yourself.** Not even "a quick fix" between QA
rounds: the implementer fixes, QA grades. The separation is the product.
- **Never infer a verdict from prose.** Only the Workflow's `outcome` (or,
in the classic runtime, the last line of a stage's report) counts.
- **Never override a subagent's `model`.** Each agent definition owns it.
Three FAILs mean a spec problem; a bigger model implements a wrong spec
just as faithfully.
- **Subagent reports do not reach the user.** Every verdict you relay carries
its evidence: the failing criteria, the reason, the URL.
## 0. Parse and load
Arguments:
- `#N` or `N` - an existing issue.
- `fix: <description>` / `feat: <description>` - an item that needs a spec
first (`fix` -> issue skill, `feat` -> feature skill).
- `--backlog <file>` - read pending items with
`$F backlog <file> pending` (`line<TAB>kind<TAB>description`); remember the
line of each item to mark it at the end.
- `--local` - no GitHub issues: each item's contract is a local spec in
`.flow/specs/<n>.md` of the main checkout, not versioned. Run `$F spec init`
once now. A repo where `$F spec mode` already prints `local` works the same
without the flag. Every read and write of an item's contract in this run
goes through `$F spec ...` (`body`, `qa`, `edit`, `comment`), which serves
issues and local specs alike - so never call `gh issue ...` directly here.
- `--jobs K` - maximum items in implement/QA at the same time (default 3).
- `--classic` - the classic runtime: background agents you drive, with the
bridge between implementer and QA and slicing of big issues
(`references/classic.md`). `--parts P` and `--no-slice` apply only here.
- `--live` - live mode, classic runtime only (implies `--classic`): pairs of
implementer and QA talk directly and parts never wait for unrelated parts.
Experimental. Ignored with `--headless`.
- `--office` - the 3D office, a view only: it reads the flowctl events and
changes nothing in how the pipeline runs. In step 0 run
`${CLAUDE_PLUGIN_ROOT}/scripts/live.py start --open --model <your own model id>`
once and give the user the URL; stop it in step 8 (`live.py stop`). Ignored
with `--headless`.
- `--realtime` - shorthand for `--live --office` (the flag of earlier versions).
- `--agents K` - live mode only: at most K agents *working* at the same time
(default 6; resting agents do not count).
- `--merge` - the user wants every item whose QA passed clean merged into its
base without asking: step 5.5. Clean means CI green, the last QA report
PASS on the PR head with no `UNVERIFIED` row, your diff review without a
critical finding, and no conflict. Anything short of that stops the item at
`ready` with the reason, exactly as without the flag.
- `--review-spec` - after each `feat:` spec, a `flow:spec-reviewer` reads it
as a staff engineer before the gate (references/specs.md, "Spec review").
- `--auto` - the user accepts your recommendations: **never call
`AskUserQuestion`**. At every point where you would ask (open decisions at
the gate, a criterion that cannot be fixed in code, spec-suspect, anything
else), take the option you would mark "(Recommended)" when the choice is
mechanical or stays inside the contract; a product or behavior choice
with no recommendation in the issue stops the item instead (step 2 has the
rule). Record each choice where the
question would have been answered (step 2 says how for the gate; otherwise
a comment on the issue starting `Auto decision (--auto):` with the
question, the options and the choice) and go on. Every such choice goes in
the final report under "Decided under --auto", so the user can reverse it
before `/flow:merge`. What `--auto` does not change: the chain still stops
at `ready`, never merges, and a `NEEDS USER:` that needs something only a
human has (a credential, an account, a payment) still stops the item.
`--agent` in the arguments is a leftover of the stage skills: ignore it.
- `--workflow` - accepted for compatibility: Workflows are the default runtime.
- `--headless` - no user and no notifications (`claude -p`, `pipeline.sh`).
Implies `--auto` and the classic runtime in waves (a Workflow's notification
may never arrive in `claude -p`).
In one parallel message:
```
gh repo view --json nameWithOwner,defaultBranchRef -q '[.nameWithOwner,.defaultBranchRef.name]|@tsv'
$F ls
```
Resolve the base branch as the `pr-delivery` skill says (CLAUDE.md rule,
user's request, else the default branch). Keep REPO and BASE.
**Resume.** `$F ls` lists items already in the flow from a previous session.
Those in `implement`/`qa`/`fix` have no running Workflow or agent anymore. Adopt them into
this run (step 6 says how to restart each stage) unless the user named only
other items - then leave them alone and mention them in the first board.
## 1. Specs (descriptions only)
Items given as `fix:`/`feat:` need a spec before anything else. Read
`${CLAUDE_PLUGIN_ROOT}/skills/run/references/specs.md`: by default one `flow:flow-specs`
Workflow writes them all in parallel (classic runtime: one `flow:spec` agent
each); each ends in `ISSUE:<n>`. Items given as `#N` skip this.
## 2. Gate each issue before it costs an implementation
`$F gate <n>` checks the body: success criteria exist, open decisions all
carry a `Recommended resolution:`, nothing is `NEEDS USER:`, the issue is
open. It prints `WARN` / `FAIL` lines and `GATE:PASS`.
- `GATE:PASS` (WARNs allowed) -> stays `queued`. Keep each WARN for the
board: a criterion without `verify:` is one QA will grade by improvisation.
- FAIL on open decisions:
- **interactive** - ask the user. one `AskUserQuestion` per issue with its
unresolved items (your recommendation first, marked "(Recommended)").
Write the answers into the issue body as `Recommended resolution:` lines
(write the new body to a file under `$F dir`, then
`$F spec edit <n> --body-file <file>` - it patches the GitHub issue
through the REST API, or rewrites the local spec), then rerun the gate. Several
issues waiting on answers: ask while the others already run.
- **`--auto`** - do not ask, but never invent a requirement. Sort each
unresolved item first:
- **Mechanical or reversible** (naming, file placement, which existing
helper to reuse) or **an implementation choice inside the contract**
(the behavior the criteria fix does not change): take the issue's
recommendation ("Proposta", "Recommended", the spec's default) or, when
it proposes none, your own, and write it into the body as
`Recommended resolution: (auto, <YYYY-MM-DD>) <choice>`; rerun the gate.
- **Product or behavior choice** (what the user sees, a business rule, a
number, a message, what happens in an edge case): take it only when
the issue itself recommends an option. With no recommendation in the
issue, stop the item: `$F done <n> blocked` +
`note="needs-user: <the decision>"`. Autonomy is not permission to
make up product behavior.
- **`NEEDS USER:`** is never decided under `--auto`: `$F done <n> blocked`
+ `note="needs-user: <what>"`.
Every stopped item goes to the final report with the question and its
options, so the user answers it once and reruns `/flow:run #<n>`.
- **headless** - as `--auto`: the same sort, the same stops; the
questions go to the final report.
- FAIL on missing criteria -> `$F done <n> blocked`, `note="no-criteria"`.
An issue that cannot fail cannot pass; the spec has to be fixed.
- FAIL because the issue is closed -> drop it, say so.
## 3. Schedule
An item may start when all hold:
- fewer than `--jobs` items are in `implement` / `qa` / `fix`;
- `$F overlap <n>` exits 0 (no running item touches a file it cites). On
exit 1 it prints who conflicts: the item waits for that one to reach a
terminal state, then is re-checked. Two items editing the same file in
parallel produce two PRs that conflict with each other - serial is
cheaper.
Pick queued items in the order the user gave them. Start each one:
```
WT=$($WT_SH add <n> [<base> when not the default branch])
$F set <n> stage=implement wt=$WT round=0
```
Then start its Workflow (step 4). In the classic runtime, decide the cut
first (`references/classic.md`, step 3.5).
## 4. Run each item as a Workflow (default runtime)
Each item that step 3 lets start runs as one `flow-item` Workflow: the
implementer, then QA, then a fix round on FAIL, up to 3 QA rounds, each stage a
fresh agent with a structured result. The script owns the mechanical loop; you
own scheduling, the user and the judgment calls.
```
Workflow(name: "flow:flow-item",
args: { n: <n>, wt: "<WT>", base: "<base>", flowctl: "<$F path>",
qaEnv: <true when `$F qa-env recipe` exits 0>, local: <bool> })
```
Pass `args` as a JSON object, never a string. Record the run id:
`$F set <n> note="workflow <runId>"`. Start every item step 3 allows in one
message, then end the turn with the board (step 7). Each run notifies when it
ends; react to it (step 5) and end the turn again. Never poll, never guess a
result. Read `${CLAUDE_PLUGIN_ROOT}/skills/run/references/workflow.md` once per session: the
fallback when the name does not resolve, and how to start a run from a later
point (`start: "qa" | "fix" | "implement"`).
**The classic runtime** (background agents you drive yourself, the bridge
between implementer and QA, slicing, live mode) runs instead when the user
passed `--classic`, `--live`/`--realtime` or `--headless`. Then read
`${CLAUDE_PLUGIN_ROOT}/skills/run/references/classic.md` and follow its steps 3.5 to 5 in place
of steps 4 and 5 here.
## 5. React to each Workflow result
The result is `{ n, outcome, pr, rounds, failIds, history, report }`. First
`$F set <n> pr=<pr> round=<rounds>` (branch from `gh pr view <pr> --json headRefName`).
| `outcome` | Do |
|---|---|
| `VERIFY:PASS` | read the last QA report once (`$F spec qa <n>`); `UNVERIFIED` rows or disputed rows QA left unanswered go to the user. Then `$F set <n> verdict=PASS`; with `--merge` step 5.5, else `$F done <n> ready` |
| `NEEDS-USER <question>` | a stage needs a fact only the user has (product behavior, a business rule). Interactive: ask it (one `AskUserQuestion`, the stage's options first), write the answer into the issue (`$F spec edit` or `$F spec comment`), then start the item again with `start` = the stage it stopped in (`history`) and `note` = the answer. `--auto`/headless: `$F done <n> blocked` + `note="needs-user: <question>"` |
| `VERIFY:BLOCKED spec-suspect: <ids>` / `qa-loop-exhausted` | `$F done <n> blocked` + `note=<outcome>`; relay `failIds` and the evidence in `report`. If the evidence changed between rounds and you think one more fix is worth it, one more run with `start: "fix"` |
| `VERIFY:BLOCKED <r>` | `$F done <n> blocked` + `note=<r>`; relay |
| `PIPELINE:SKIPPED <r>` | `$F done <n> skipped` + `note=<r>`; relay (open decisions the gate missed: say so) |
| `PIPELINE:FAILED <r>` | `$F done <n> failed` + `note=<r>`; relay what is red |
| run errored or was stopped | step 6 |
(`$F set <n> note=...` before `$F done`; `done` only takes the stage.)
After every terminal state: mark the backlog line when the item came from
one (`$F backlog <file> mark <line> <x|?|!> "<#n or spec n, pr-url or reason>"` -
`x` ready, `?` skipped/blocked, `!` failed), then go back to step 3: a slot
or a file just freed up.
## 5.5 Merge (`--merge` only)
Only items whose QA passed clean, one at a time, in the order they reached
PASS. `$F merge` refuses without the consent a hook records when the person
types `--merge`; then stop at `ready` and say so, never try to create it.
Read `${CLAUDE_PLUGIN_ROOT}/skills/run/references/merge.md` before the first merge: your diff
review bar, the `$F merge` result lines and what to do with each.
## 6. Restarting a stage from a previous session
Items that `$F ls` shows in `implement`/`qa`/`fix` with nothing running: start
a `flow-item` run again from where it stopped - `start: "implement"` with
`note: "A previous run may have left commits in this worktree: continue from
them"` when there is no PR yet, `start: "qa"` or `"fix"` with `pr` and
`round` = `$F spec qa <n> --count` + 1 otherwise. Classic runtime: read
`${CLAUDE_PLUGIN_ROOT}/skills/run/references/restart.md`.
## 7. The board
End every turn (interactive) or every wave (headless, classic) with `$F ls` and, below
it, one line per item that changed since the last board:
`#<n> <stage> - <what happened / what it waits for>`. Items waiting on the
user come first.
## 8. Final report (nothing queued, nothing running)
Read `${CLAUDE_PLUGIN_ROOT}/skills/run/references/final-report.md` and write the report in
that format, then end with the line it prescribes.