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 Sprint?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/pillip-sprint)
---
name: sprint
description: Autonomously implements, reviews, and ships all issues in issues.md, with dynamic issue management.
argument-hint: '[--parallel N] [--max-iterations N]'
disable-model-invocation: true
allowed-tools: Task, Read, Glob, Grep, Write, Edit, Bash(bash scripts/checkpoint.sh *), Bash(bash scripts/wt_setup.sh *), Bash(bash scripts/wt_cleanup.sh *), Bash(bash scripts/registry_edit.sh *), Bash(bash scripts/flock_edit.sh *), Bash(bash scripts/worktree.sh *), Bash(python3 scripts/*), Bash(git *), Bash(gh *), Bash(pytest *), Bash(npm *), Bash(bash ${CLAUDE_PLUGIN_ROOT}/scripts/*), Bash(python3 ${CLAUDE_PLUGIN_ROOT}/scripts/*)
---
<!-- AUTO-GENERATED by scripts/gen_skills.py — DO NOT EDIT. Edit SKILL.md.tmpl instead. -->
## Kit Preamble — sprint
### Kit Script Root
Kit root: `${CLAUDE_PLUGIN_ROOT}`
- Absolute path above → plugin install (substituted at load time; no project
`scripts/` dir): prefix every kit script command with it, e.g.
`bash <kit-root>/scripts/checkpoint.sh …`. Absolute paths also work from worktrees.
- Literal `${…}` placeholder above → standalone layout: run commands as written.
### Project Context Detection
Run these checks silently at the start. Use results to adapt behavior:
- `[ -f issues.md ]` — if true, this project uses the sprint system. Respect issue numbering and STATUS.md.
- `[ -f docs/sprint_state.md ]` — if true and Status shows `running`, a sprint is active. Be aware of parallel work in worktrees.
- `[ -f docs/prd_digest.md ]` — if true, read it for quick project context before starting.
### Kit Rules
- Verify `gh auth status` before any GitHub operation.
### Checkpoint Verification Pattern
Every phase has a checkpoint. Run the verification command and check the exit code.
- Exit non-zero (blocking gate): **STOP immediately**, report failure, do NOT proceed.
- Exit 0 with an `ADVISORY:` line (advisory gate): report the gap, self-correct, continue.
Standard prefix:
```
bash scripts/checkpoint.sh
```
Append `--skill <name> --phase <phase> --issue <ID>` for the specific check.
`checkpoint.sh` resolves the main repo root internally, so the command stays
a single prefix-matchable form (safe to allowlist as `Bash(bash scripts/checkpoint.sh *)`).
### Worktree Setup Pattern
Pipeline skills operate in git worktrees to isolate changes from main.
- Create + freeze: `WT="$(bash scripts/wt_setup.sh <branch>)"` — creates the
worktree via `scripts/worktree.sh create` and writes `.claude-kit/freeze-dir.txt`
inside it in a single step.
- Resolve main root: `bash scripts/worktree.sh root`
- Remove safely: `bash scripts/wt_cleanup.sh <branch>` — cd's to main root
inside a subshell, then removes the worktree (never leaves CWD dangling).
All file operations happen inside `$WT/`. Shared files live on main only.
### Registry Update Pattern
Shared files (`issues.md`, `STATUS.md`, `CHANGELOG.md`) are managed on main only.
Always use `registry_edit.sh` for concurrent-safe writes — it resolves the
main repo root internally and delegates to `flock_edit.sh`:
```bash
bash scripts/registry_edit.sh issues.md -- bash -c '<update command>'
```
Never commit these files to feature branches.
### Parallel Management Rules
- Respect the `--parallel N` limit for concurrent subagent tasks.
- Use the Task tool for subagent dispatch; track completion in `docs/sprint_state.md`.
- Each parallel track is independent; do not share mutable state between tracks.
- Use `registry_edit.sh` for any shared file writes (issues.md, STATUS.md).
### Escalation and Retry Logic
- If a subagent fails: retry once with the same context.
- If the retry fails: mark the issue as `Status: waiting`, `Reason: <failure-type>` in sprint_state.md.
- After 2 consecutive review failures on the same issue, defer it and move to the next.
- After 3 total failures across any issues, escalate to the user with a summary.
- Report all escalations and deferred issues in the sprint summary.
## Pre-conditions
1) `issues.md` must exist with at least one issue in `backlog` status.
2) `gh auth status` must succeed.
3) All planning docs should exist (docs/architecture.md, etc.) — warn if missing.
## Arguments
- `--parallel N`: Max parallel issues (default: 3)
- `--max-iterations N`: Max loop iterations (default: 20)
## Argument Validation (run before anything else)
1) Parse `$ARGUMENTS` for `--parallel N` and `--max-iterations N`:
- If `--parallel` is present, validate N is an integer between 1 and 10. If invalid, stop with: "Invalid --parallel value: must be an integer between 1 and 10."
- If `--max-iterations` is present, validate N is an integer between 1 and 100. If invalid, stop with: "Invalid --max-iterations value: must be an integer between 1 and 100."
- Unknown flags should be warned but not block execution.
## IRON LAW: implement → review → ship (NEVER SKIP)
**Every issue MUST pass through all three phases in order. No exceptions.**
- An issue is NOT "done" until it is **shipped** (PR merged + smoke test passed).
- New backlog issues are dispatched as **PIPELINE** (implement→review→ship in one invocation). This structurally prevents phase skipping — there is no decision point between phases.
- Issues stuck mid-pipeline (`implemented` or `reviewed`) are retried via standalone REVIEW or SHIP actions.
- You MUST NOT start a new PIPELINE if there are issues stuck in `implemented` or `reviewed` status. **Clear the pipeline first.**
**Pipeline priority order** (enforced by `scripts/sprint_queue.py` — do NOT override):
1. Ship any issues in `reviewed` status (highest priority)
2. Review any issues in `implemented` status
3. Only then: PIPELINE new `backlog` issues
**Violation = sprint failure**: If at sprint end, ANY issue has Status=implemented or Status=reviewed (not shipped), the sprint is considered **incomplete**. Report these as unfinished pipeline items.
## Algorithm
1) Validate pre-conditions:
- Read `issues.md` — if no backlog issues, report "nothing to sprint" and stop.
- Run `gh auth status` — if fails, stop and instruct user to authenticate.
- Check for planning docs (architecture.md, requirements.md) — warn if missing but continue.
2) Check for existing sprint state:
- If `docs/sprint_state.md` exists with Status=running, ask user: resume or start fresh?
- If resuming, load existing state.
- If fresh, delete old sprint_state.md and create a new one from `templates/sprint_state.md`.
- **Pin the roster boundary**: in the new file's `## Meta` block, replace the
`- Roster-Watermark: ISSUE-NNN` placeholder with `ISSUE-<the highest ISSUE-NNN you just
wrote into the Issue Progress table>` — the max rostered ID **at sprint start**. Never
update it again for the life of the sprint: its whole purpose is to record the boundary the
roster had when the sprint was scoped. Leaving the placeholder in place is not fatal but is
announced as a rejection in every `reason` (see **Discovered-issue visibility** below).
3) Gather context (read once, reuse across iterations):
**Read all context files via parallel Read tool calls in a single message. Do NOT read them sequentially.**
- `issues.md` — full content
- `docs/sprint_state.md` — current state
- recalled **review lessons** (native memory) — if exists
- `docs/architecture.md` — if exists
- `docs/data_model.md` — if exists
- `docs/prd_digest.md` — if exists (use as quick PRD context instead of full PRD)
- Parse --parallel and --max-iterations from arguments
4) **Sprint loop** (iteration = 0; repeat while iteration < max-iterations):
**a) Read fresh state**: Re-read `docs/sprint_state.md` and `issues.md` every iteration.
**b-c) Compute next action (deterministic — do NOT override):**
Run the pipeline queue script:
```bash
python3 scripts/sprint_queue.py next-action --sprint-state docs/sprint_state.md --issues issues.md --max-parallel {MAX_PARALLEL}
```
**STOP the sprint and report the error** if the script exits with non-zero and no JSON output, or if step 4f's `validate` exits **3**. A non-zero exit with no JSON indicates a parsing failure or circular dependency; exit **3** means the sprint has lost its scope boundary (step 4f) — that exit DOES print JSON, so "no JSON output" alone never catches it. Either way, do NOT proceed.
Parse the JSON output. The result always contains `action`, `targets`, and `reason`. When
`issues.md` holds backlog issues that are not yet in the Issue Progress table, it also
carries `unrostered` (the IDs the queue auto-considered, ascending) and — when action = DONE —
`stranded` (that same list, repeated under a warning because a DONE means none of them ran).
See **Discovered-issue visibility** below. With no such issues the output is unchanged from
before, and the exit code is unchanged either way: a stranded DONE still exits 1 and still
reports `action: "DONE"`, so the `stranded` key is the only signal you get.
- If action = **DONE** → if the output carries a `stranded` list, do NOT report a clean sprint: carry those IDs into the step 6 report as registered-but-unrun issues. Then **go to step 5.**
- If action = **STUCK** → Log warning with the `reason`. Increment attempt counts for stuck issues in sprint_state.md. If attempts ≥ 3, escalate. Otherwise continue to next iteration.
- If action = **PIPELINE**, **SHIP**, **REVIEW**, or **FINALIZE** → proceed to step 4d with the action and targets from the script output. A target that also appears in `unrostered` has no Issue Progress row yet — see the unrostered-target note in step 4d.
**IMPORTANT**: Do NOT manually compute queues or override the script's action choice. The script enforces strict priority ordering (FINALIZE > SHIP > REVIEW > PIPELINE) to prevent phase skipping. **FINALIZE** is a crash-recovery action (ISSUE-052): the queue detected a `reviewed` issue whose PR is already merged (a ship-phase interruption between the merge and the smoke checkpoint), so only smoke + registry remain — it must NOT be re-shipped/re-merged.
> For reference, the script computes these queues internally:
> - `ship_ready` = issues where Phase = `reviewed`
> - `review_ready` = issues where Phase = `implemented`
> - `pipeline_ready` = issues in `backlog` where Manual ≠ true AND all Depends-On are resolved
> - `in_flight` = issues where Phase ∈ {`implementing`, `reviewing`, `shipping`}
**Discovered-issue visibility**: the queue's roster is the `docs/sprint_state.md` Issue
Progress table. Issues registered in `issues.md` with `Status: backlog` and `Manual ≠ true`
but with **no row** in that table — typically filed mid-sprint by `/review` triage or
`planner` — are auto-considered, so work discovered during a sprint is no longer invisible
to the queue. Current bounds:
- Only IDs numerically **above** the boundary pinned in `## Meta` as `Roster-Watermark` at
sprint start (step 2) qualify. Because that boundary is fixed for the sprint, visibility is
**monotonic**: an issue reported once keeps being reported until it is shipped or dropped,
and the order in which you roster discovered issues no longer matters.
- If the `Roster-Watermark` field is absent, malformed, duplicated, outside `## Meta`, or
above the highest ID on the Board, the queue falls back to re-deriving the boundary as the
highest `ISSUE-NNN` currently in the table and **names that fallback in `reason`**
(`[roster-watermark: rejected (…) — fell back …]` or `[roster-watermark: absent …]`). Under
the fallback the boundary moves as the roster grows, so a lower-ID sibling can drop out of
the report — fix the field rather than working around it.
- **The boundary in force is always named in `reason`** — `[roster-watermark: pinned at
ISSUE-NNN — X of Y Board backlog issue(s) are above it]` when a pin was accepted, a
`rejected`/`absent` fallback note otherwise. An accepted pin at or above the Board's
highest ID empties `unrostered` legitimately, so without this line a boundary that had
silenced the whole control would look exactly like a healthy sprint with nothing to report.
The `X of Y` count is the counter-evidence: `0 of 0` is a genuinely finished sprint, while
`0 of 12` means the pin is suppressing everything — check it. If you see no
`roster-watermark` note at all, the field is absent — treat that as the pre-pin behaviour
below, not as a clean bill of health.
- Above-boundary issues are **flagged but NOT dispatched — but ONLY while the
`Roster-Watermark` field is present** (accepted *or* rejected; a mangled pin still closes
the gate). They then appear in `unrostered` (and in `stranded` on a DONE) but are never
targeted, so a sprint scoped on older debt cannot auto-drive newer out-of-scope work
through implement → review → merge. `reason` says how many were withheld. Export
`KIT_SPRINT_DISPATCH_ABOVE_WATERMARK=1` (also `true`/`yes`/`on`) to dispatch them instead;
when set, the knob's name appears in `reason` so a deliberately widened sprint is
distinguishable from a runaway one. Anything else — including unset, `0`, and `false` —
leaves dispatch off.
- **The gate itself is still NOT fail-safe against a deleted field — the loop is what
refuses.** `next-action` is unchanged: with NO `Roster-Watermark` line it keeps the
pre-ISSUE-069 behaviour byte-identically — above-boundary Board issues are
auto-**targeted** and driven through implement → review → merge, announced as
`[roster-watermark: absent …]`. That backward compatibility is deliberate (an in-flight
pre-pin sprint must not change behaviour mid-flight). What changed is downstream: **step
4f now refuses a `running` sprint whose boundary is `absent` or `rejected`** (`valid`
false, exit **3**), so a field dropped by a 4d rewrite cannot survive to the next dispatch
decision. The arming check reads `Status: running` **anywhere in the document**, so a
renamed, re-levelled, mis-cased, indented, duplicated or fence-wrapped `## Meta` heading
does not disarm it. Residuals that remain, stated so you can recognise them rather than
discover them: the running **vocabulary** is the literal `running` (keep `Status` to
`running | paused | completed` — an off-template value such as `in progress` reads as
`not-running`, so 4f does not fire); invoking `next-action` by hand without running 4f
gets no refusal; and an `issues.md` `Depends-On` cycle makes `next-action` return STUCK
before it parses the boundary, so its own `[roster-watermark: …]` note is suppressed (the
4f `validate` leg is unaffected and still refuses). Keep checking for the
`[roster-watermark: absent …]` note whenever a run targets something you did not scope.
- Nothing is auto-considered unless the table already holds at least one `ISSUE-NNN` row, or
the boundary is pinned.
- Auto-considered issues are withheld while any issue is in flight, so discovery can never
starve the STUCK escalation path.
- For auto-considered issues only, a dependency also counts as resolved when its `issues.md`
Status is `done`, `drop`, or `dropped`. Rostered rows keep table-only dependency resolution.
- `Status` is matched **exactly**: an annotated value such as `backlog (blocked — do not
dispatch)` is not admitted, and `done (sign-off pending)` does not resolve a dependency.
This fails closed by design — keep the bare keyword in the field and put qualifiers in the
issue body.
**d) Invoke team-lead agent via Task tool** with this exact prompt structure:
```
You are the team-lead agent. Execute the {action} phase for these issues.
## Phase: {PIPELINE | SHIP | REVIEW | FINALIZE}
## Target Issues
{For each target: full issue spec from issues.md — ID, title, AC, all fields}
## Current Sprint State
{Full content of docs/sprint_state.md}
## Max Parallel: {N}
## Project Context
{Content of architecture.md, data_model.md, review lessons (native memory), prd_digest.md}
Execute this phase, update docs/sprint_state.md with results, then STOP.
Do NOT loop.
```
**Preserve `## Meta` verbatim**: require the team-lead to copy the `## Meta` block —
including `Roster-Watermark` — unchanged when it rewrites `docs/sprint_state.md`, editing only
`Iteration` and `Status`. Every phase executor rewrites that file, and a dropped
`Roster-Watermark` reverts the sprint to the old re-derived boundary **and re-opens
autonomous dispatch of above-boundary work** (the absent state is the one state the dispatch
gate does not close — see **Discovered-issue visibility** above). The revert is announced as
`[roster-watermark: absent …]`, not silent, but it is a real widening of autonomous scope:
treat the `## Meta` block as copy-only.
The loss is now **detected**, not merely discouraged: step 4f's `validate` runs AFTER this
rewrite and BEFORE the next iteration's `next-action`, so a field dropped here is refused
(`roster_boundary.state` = `absent`, exit **3**) before anything is dispatched on it — as
long as you actually run 4f. Fix the `## Meta` block rather than continuing the loop.
**Unrostered targets**: for any target that appeared in `unrostered`, say so in the prompt and
require the team-lead to **add its Issue Progress row** when it records progress. The queue
synthesizes those rows in memory only; step 4f's `validate` reports a target with no row as
stuck even after a successful phase, and the Attempts counter has no durable home until the
row exists.
**Phase meanings:**
- **PIPELINE**: Full implement→review→ship for backlog issues. Each issue goes through all three phases in one invocation. No phase can be skipped.
- **REVIEW**: Retry review for issues stuck in `implemented` status (recovery only).
- **SHIP**: Retry ship for issues stuck in `reviewed` status (recovery only).
- **FINALIZE** (crash recovery, ISSUE-052): a `reviewed` issue whose PR is already merged. Route it to the team-lead **ship** executor — its merge step is idempotent (`python3 scripts/sprint_queue.py ship-merge-decision --pr <n>` returns `skip`), so it skips the already-done merge and completes only the post-merge smoke checkpoint + registry finalization. Never re-merge. Validate in step 4f with `--action FINALIZE` (expected end phase `shipped`).
**e) After team-lead returns**:
- Re-read `docs/sprint_state.md` to confirm phase transitions happened
- Log: `=== Iteration {N} complete: {action} phase for {count} issues ===`
- Increment iteration
**f) Validate phase transition (deterministic — do NOT skip):**
Run the validation script:
```bash
python3 scripts/sprint_queue.py validate --sprint-state docs/sprint_state.md --issues issues.md --action {ACTION} --targets {COMMA_SEPARATED_TARGETS}
```
Parse the JSON output:
- If `valid` = true: all targets transitioned successfully (or stopped at a phase with logged error). Continue loop.
- If `valid` = false: log the `errors` array in sprint_state.md. The `stuck` list shows which issues failed to transition — they will be retried in the next iteration via REVIEW or SHIP action.
**Roster boundary check** (this step is where a dropped boundary is caught — it runs AFTER
the team-lead's rewrite in 4d and BEFORE the next iteration's `next-action`):
- `roster_boundary` is always present in the output. Its `state` is one of `accepted`,
`absent`, `rejected`, or `not-running` (`not-running` = `## Meta` does not say
`Status: running`, so no boundary is load-bearing and nothing is checked).
- `state: "absent"` or `state: "rejected"` on a `running` sprint → `valid` is false and the
exit code is **3**. The sprint has lost its scope boundary: **do not dispatch another
iteration.** Restore `- Roster-Watermark: ISSUE-<max rostered ID at sprint start>` inside
`## Meta` (for `rejected`, the parser's reason is in `roster_boundary.detail` — fix that
instead of re-adding a second line), then re-run 4f.
- Exit **3** is a distinct class from exit 1: `stuck` is unaffected by this check, so **no
target is retried because of it**. Do not read a boundary refusal as a phase failure.
- `--issues issues.md` is what gives this leg the same Board-range check `next-action` uses;
without it, a boundary above the highest ID on the Board is not detected here. A missing or
unreadable path degrades the same way rather than failing, so it says so on stderr
(`Warning: --issues not supplied or unreadable …`) — if you see that line, the verdict you
just read was computed without the Board-range rule; fix the path and re-run 4f.
**Continue loop from step 4a** — unless step 4f exited **3** (boundary refused): STOP and report.
5) **Pipeline completion gate** (before exiting):
- Read final `docs/sprint_state.md`
- Count issues still in `implemented` or `reviewed` (not shipped)
- If count > 0 AND iteration < max-iterations: **return to step 4** to drain the pipeline
- If count > 0 AND iterations exhausted: report as **INCOMPLETE PIPELINE** items
6) Report sprint results to user:
- Issues shipped (completed)
- Issues stuck in pipeline (implemented/reviewed but not shipped) — flagged as **INCOMPLETE**
- Issues escalated (3+ failures)
- Issues waiting (blocked/deferred)
- New issues discovered during sprint
- **Registered but never run** — the `stranded` IDs from the final `next-action` output: in `issues.md` backlog, never rostered, and not dispatchable (usually an unresolved `Depends-On`)
## Agent Selection
Team-lead uses this table to determine which agent(s) to dispatch per issue:
| Issue characteristic | Agent(s) | Skill reference |
|---------------------|----------|----------------|
| General backend/logic | developer | skills/implement/SKILL.md |
| UI/frontend (web) | uiux-developer | skills/implement/SKILL.md + UI context |
| UI/frontend (mobile) | mobile-uiux-developer | skills/implement/SKILL.md + mobile context |
| Infrastructure/CI/CD | (run the devops skill) | skills/devops/SKILL.md |
| Bug fix | (run the diagnose skill) | skills/diagnose/SKILL.md |
| Refactoring | (run the refactor skill) | skills/refactor/SKILL.md |
| DB migration | (run the migrate skill) | skills/migrate/SKILL.md |
| Architecture change needed | architect → data-modeler → developer | sequential |
| Any completed implementation | reviewer | skills/review/SKILL.md |
| UI implementation completed | reviewer + ui-reviewer | skills/review/SKILL.md |
| Reviewed and approved | (ship steps) | skills/ship/SKILL.md |
**How to determine**: Read the issue's title, Track field, and Implementation Notes. Keywords like "UI", "screen", "component" → UI agent. "Dockerfile", "CI", "deploy" → the devops skill. "migrate", "schema change" → migrator.
## Pipeline Phase Tracking
Each issue progresses through these phases in `docs/sprint_state.md`:
```
backlog → implementing → implemented → reviewing → reviewed → shipping → shipped
```
**Phase meanings:**
- `implementing`: implement in progress
- `implemented`: implement done, checkpoint passed — **MUST review next**
- `reviewing`: review in progress
- `reviewed`: review approved — **MUST ship next**
- `shipping`: ship in progress
- `shipped`: PR merged, smoke test passed — **done**
The team-lead reads these phases to enforce pipeline ordering:
- Any issue in `implemented` → team-lead MUST review before implementing new issues
- Any issue in `reviewed` → team-lead MUST ship before reviewing or implementing
## Error Handling
- If team-lead Task fails (returns error): log the error in sprint_state.md, then **continue the sprint loop** with the next iteration. The failed issues remain in their current phase and will be retried.
- If pre-conditions fail: stop with clear instructions on how to fix.
- Sprint state file ensures progress is never lost — user can re-run `/sprint` to resume.
- **Per-phase recovery**: Each team-lead invocation handles one phase. If it fails, the sprint loop retries that phase in the next iteration. Successful phases are never re-run.
- **Escalation**: If the same issue fails the same phase 3 times (tracked via Attempts column in sprint_state.md), mark as `waiting` with escalation reason and skip it. Report at sprint end.
- **Review rework**: After 2 consecutive review failures on the same issue, mark Status=waiting, Reason=review-rework, defer to human.
## Rollback
- Sprint is composed of individual implement→review→ship cycles, each with their own rollback.
- If sprint must be fully abandoned: issues.md still reflects accurate status per issue.
- Delete `docs/sprint_state.md` to reset sprint state.