/pr-autopilot:review-spec [--bootstrap <spec-path> [--force]]from pr-autopilot
Review a spec markdown file before coding (pre-PR adapter layer). Two modes - normal (claim-file-driven, results appended to the claim file `reviewers[]`) and --bootstrap <path> (standalone, advisory only, no claim file). Always runs 2 free Claude subagents (code reviewer + adversarial); adds Codex CLI and Cursor Cloud Agent only when their keys and plan checks pass; prints a copy-paste prompt for an optional manual Composer review. Shows a progress table at dispatch and an aggregated table at the end. Use when - "review my spec", "check the spec before approving", "review this design doc", "zrób review speca", "sprawdź specyfikację przed akceptacją", "przejrzyj dokument projektowy".
Ships in pr-autopilot. 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.
Pre-PR adapter dispatch on a markdown spec file. Idempotent and re-runnable.
Full algorithm + adapter inventory + cursor-cloud poll contract: docs/superpowers/specs/2026-05-28-pr-autopilot-v0.5-pre-pr-lifecycle-design.md (v2.2 §Pre-PR Adapter Layer + §/review-spec).
v0.5.1 changes (this version): docs/superpowers/specs/2026-05-28-pr-autopilot-v0.5.1-review-spec-improvements.md.
If the invocation contains --bootstrap (either --bootstrap=<path> or --bootstrap <path>):
→ go to Bootstrap mode section. Do NOT proceed to "Pre-flight (normal mode)" or "Steps (normal mode)".
Otherwise (no --bootstrap argument):
→ go to Pre-flight (normal mode) section. Do NOT proceed to "Bootstrap mode".
Modes are mutually exclusive. Do not run both. If unclear which mode applies, refuse with:
[pr-autopilot/review-spec] ambiguous invocation; expected either no args (normal mode) or --bootstrap <path>.
This skill is markdown that Claude interprets. There is no bash getopts. The contract for argument parsing:
/pr-autopilot:review-spec with no arguments → normal mode./pr-autopilot:review-spec --bootstrap=<path> → bootstrap mode with <path> as the spec file path. The path is the token immediately following the = sign./pr-autopilot:review-spec --bootstrap <path> (whitespace-separated) → bootstrap mode with <path> as the spec file path. The path is the first non-flag token after --bootstrap.--, Claude MUST treat it as a path (not a flag). E.g., --bootstrap --weird-name.md is a path of --weird-name.md. (Rare; documented for completeness.)--bootstrap is followed by nothing (end of invocation), refuse with: [pr-autopilot/review-spec] --bootstrap requires a path argument; got none.--bootstrap is specified TWICE in the same invocation, refuse with: [pr-autopilot/review-spec] duplicate --bootstrap flag; only one path is supported per invocation.-bootstrap is NOT supported → refuse with [pr-autopilot/review-spec] unknown flag '-bootstrap'; did you mean '--bootstrap'?.--force may appear AFTER the path in bootstrap mode (e.g., --bootstrap path.md --force). It disables the enforcement guard. See B-Pre-flight step 2 in references/bootstrap.md.[pr-autopilot/review-spec] --bootstrap path not found: <path>.Required preconditions for normal mode:
.claude/assignment-claims/<id>.json present.subStatus is spec_drafting, spec_revising, or spec_review_complete (re-run after manual paste).claimFile.specFile or auto-detect newest specs/*-<id>.md.If preconditions fail, refuse with the corresponding error. Do NOT silently fall through to bootstrap mode.
Standalone, advisory-only review with no claim file (a repo's first pr-autopilot PR, a draft spec, or a review without the lifecycle). Read ${CLAUDE_SKILL_DIR}/references/bootstrap.md when the invocation contains --bootstrap and follow it (it reuses normal-mode Steps 1.5–4 but never writes a claim file); in that file <skill-dir> means ${CLAUDE_SKILL_DIR}.
Read .claude/assignment-claims/<id>.json. Update subStatus: spec_review_requested. Increment reviewIteration if existing, else set to 1. Commit:
git add .claude/assignment-claims/<id>.json
git commit -m "chore(pr-autopilot): review-spec start for <id> (iter <n>)"
Before any dispatch, print to chat:
🔄 **Reviewing spec at `<absolute-path>` (iter <n>)** ...
Dispatching reviewers:
| Reviewer | Type | Status |
|---|---|---|
| code reviewer (feature-dev or general-purpose fallback) | Claude subagent (FREE, always) | ⏳ pending |
| general-purpose adversarial | Claude subagent (FREE, hostile) | ⏳ pending |
| codex-exec | <if env+CLI set: ⏳ pending; else: ⏭ skipped (no OPENAI_API_KEY / codex)> |
| cursor-cloud-agent | <after probe: ⏳ pending (Pro) OR ⏭ skipped (Free/invalid/network)> |
| composer-2.5 manual | FREE paste-back | 📋 prompt will print below |
Then write TodoWrite with a single sentinel item for the whole dispatch (NOT one per reviewer). This respects TodoWrite's hard constraint "Exactly ONE task must be in_progress at any time":
TodoWrite([
{ content: "/review-spec dispatch (iter <n>) — N reviewers in parallel",
activeForm: "Running N reviewers in parallel (iter <n>)",
status: "in_progress" }
])
Where N is the count of channels actually dispatching (e.g., 2 for free-only, 3 with codex, 4 with cursor-cloud-agent on Pro). Per-channel status is shown in the chat status table above; TodoWrite is only the sticky sentinel.
In Step 4, this item flips to completed with activeForm: "Done: N reviewers, X P0 / Y P1 / Z P2".
v0.5.1 limitation: status table updates atomically at Step 4 (since subagent dispatch via Agent tool is foreground/blocking — once a single Agent-call message dispatches multiple subagents in parallel, all complete before control returns). TRUE incremental per-reviewer status updates are v0.6+ (Gap D.2 — see ROADMAP for hooks-based vs MCP-server-based architecture choice). The chat status table above provides the visual map; the single TodoWrite sentinel provides sticky persistence.
Graphify dispatch-time filesystem check (v0.5.3+): before dispatching adapters, check whether this repo has a graphify code knowledge graph at graphify-out/graph.json. /review-spec has NO per-PR state file (bootstrap mode has no PR; normal mode hasn't loaded claim state at this point), so the check is purely filesystem-based:
# PR #9 review P1 fix: also gate on `advisory != "off"` so the hint is NEVER injected
# when the user opted out at the config level, even if a graph happens to exist on disk.
# Matches the /step §0.6a contract: advisory=off means "skip entirely" everywhere.
if [ "${config_graphify_advisory:-auto}" != "off" ] \
&& [ -f "graphify-out/graph.json" ] \
&& [ "${config_graphify_promptHint:-true}" = "true" ]; then
_graphifyHintEnabled="true"
else
_graphifyHintEnabled="false"
fi
When _graphifyHintEnabled == "true", the claude-code-reviewer-subagent and claude-self-review prompts (see "Adapter prompts" below) get a graphify hint prepended that tells the subagent to query the graph before grep'ing files.
For cursor-cloud-agent, run the probe FIRST to determine plan eligibility:
# Resolved from this skill's directory, so it works for any installed version
# (replaces the old fallback pinned to the 0.5.2 cache path).
bash "${CLAUDE_SKILL_DIR}/../../hooks/cursor-cloud-agent-probe.sh"
PROBE_EXIT=$?
Based on PROBE_EXIT:
reviewers[]: {kind:"cursor-cloud-agent", status:"skipped", reason:"plan_required", iteration:<n>}. Echo: ℹ️ Cursor Cloud Agent skipped — requires Cursor Pro. Upgrade: https://cursor.com/settings/billing.reason:"invalid_key". Echo: ⚠️ Cursor Cloud Agent skipped — API key invalid or missing. Check ~/.claude/settings.json env.CURSOR_API_KEY.reason:"probe_error". Echo: ℹ️ Cursor Cloud Agent probe failed (network/parse). Probe re-runs on next /review-spec invocation; no caching.reason:"privacy_mode_legacy". Echo: ⚠️ Cursor Cloud Agent skipped — Privacy Mode (Legacy) blocks Cloud Agent. Disable in Cursor Settings → Privacy.skipReason union (v0.5.2 extension): plan_required | invalid_key | probe_error | no_env | privacy_mode_legacy.
Now dispatch all enabled adapters in parallel via a single Agent-tool-call message containing multiple invocations:
Always (FREE):
Agent({ subagent_type: 'feature-dev:code-reviewer', description: 'Pre-PR spec review', prompt: <see "Adapter prompts" below, with <path> = claimFile.specFile or bootstrap argument> })
feature-dev:code-reviewer comes from the official feature-dev plugin, which is recommended but optional. If that agent type is not available in this session, use subagent_type: 'general-purpose' with the same code-reviewer prompt, and label the row general-purpose (code-reviewer fallback). Do not skip the channel.Agent({ subagent_type: 'general-purpose', description: 'Adversarial spec review', prompt: <hostile template, same path substitution> })Opt-in PAID (if env set):
OPENAI_API_KEY set OR which codex succeeds:
# -a/--ask-for-approval is a top-level codex flag (before `exec`), not an `exec` flag.
codex -a never exec --json --sandbox read-only \
--output-last-message "${TMPDIR:-/tmp}/codex-review-<id>-iter<n>.md" \
"$(cat <prompt-template-with-spec-path>)"
RUN=$(curl -sX POST https://api.cursor.com/v1/agents \
-H "Authorization: Bearer $CURSOR_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"prompt\":{\"text\":\"<prompt+spec>\"},\"repos\":[{\"url\":\"<repo-url>\"}],\"model\":{\"id\":\"composer-2.5\"},\"autoCreatePR\":false}")
# Poll run.id every 5s up to 120s
If timeout → record {kind: "cursor-cloud-agent", status: "pending", runId: "<id>", timeoutAt: "<iso>"} in reviewers[]. Re-run /review-spec folds in pending result idempotently.Note on URL contract: the dispatch always uses production https://api.cursor.com/v1/agents. There is NO env-var override on dispatch. The probe accepts CURSOR_API_URL override ONLY when PR_AUTOPILOT_TEST_MODE=1 is also set (test-mode-only path). This asymmetry is intentional: tests validate probe LOGIC; dispatch is exercised by EVAL 43 ("all keys set" — requires Cursor Pro available) and EVAL 50 (Free graceful skip) as live integration tests, not by mocked unit tests.
Print to chat:
🔵 **OPTIONAL: Composer 2.5 review** — for a 3rd perspective beyond the 2 Claude subagents, copy the block below, open Cursor (Ctrl+I on Linux/Windows, Cmd+I on macOS), paste, run, paste reply back into Claude.
Then immediately print a single triple-backtick fenced code block. The block content must have the spec path baked in at skill runtime (no <path> placeholder for user to edit):
```
Review the spec at <ABSOLUTE-PATH-RESOLVED-AT-SKILL-RUNTIME> for:
- internal contradictions
- missing edge cases / failure modes
- scope creep vs declared scope_in/scope_out
- alignment with CLAUDE.md + DESIGN.md (read both first)
- test coverage gaps
- security/correctness for code paths described
Return P0/P1/P2 findings with confidence ratings (5/10-10/10) per PUSHBACK.md.
Format: structured markdown table or per-finding section.
```
After Composer responds: user pastes its reply back into this Claude chat, then re-runs /pr-autopilot:review-spec (or --bootstrap with same path). Findings auto-dedup by body hash.
(Advisory only — does NOT block spec_review_complete transition.)
Aggregate findings from all sync adapters that completed. Increment reviewIteration if not already done in Step 1. Append entries to reviewers[] in claim file:
{
"kind": "claude-code-reviewer-subagent" | "claude-self-review" | "codex-exec" | "cursor-cloud-agent" | "composer-2.5-manual",
"status": "complete" | "pending" | "timeout" | "skipped",
"iteration": <n>,
"findings": { "p0": N, "p1": M, "p2": K, "details": "..." },
"completedAt": "<iso>",
"skipReason": "plan_required" | "invalid_key" | "probe_error" | "no_env" | "privacy_mode_legacy" // only if status: skipped
}
Score derivation (v0.5.2 — DERIVED only, no adapter prompt changes):
For each reviewer with status: "complete", derive a 1-5 score from P0/P1/P2 counts using this rubric:
| Conditions | Score |
|---|---|
| 0 P0 + 0 P1 + ≤4 P2 | 5/5 (ship-ready) |
| 0 P0 + 0 P1 + ≥5 P2 | 4/5 (lots of nits) |
| 0 P0 + 1-2 P1 | 4/5 (minor polish) |
| 0 P0 + ≥3 P1 | 3/5 (revise — lots of P1) |
| 1 P0 | 3/5 (1 blocker) |
| 2 P0 | 2/5 (significant issues) |
| ≥3 P0 | 1/5 (block — fundamental) |
Skipped, pending, timeout, manual reviewers (— rows) → no Score; excluded from aggregate mean.
Model column sourcing (per kind):
| Reviewer kind | Source | Default |
|---|---|---|
claude-code-reviewer-subagent | model alias the subagent ran with, if reported (e.g. opus, sonnet); no hard-coded model id | claude (feature-dev), or claude (general, code-reviewer fallback) when the fallback ran |
claude-self-review | model alias the subagent ran with, if reported | claude (general) |
codex-exec | parse JSON .usage.model or .model | codex (model unknown) |
cursor-cloud-agent | parse API .run.model.id or .agent.model.id | composer-2.5 (we requested it) |
composer-2.5-manual | N/A | — |
Verdict extraction: first sentence of the reviewer's response. If extraction fails or reviewer omitted a summary, synthesize: 0 P0 → Spec ready, N P1, K P2.; 1 P0 → One blocker — revise.; ≥2 P0 → N blockers — significant revision needed.. Truncate to ≤60 chars (append … if cut).
Print final status table to chat (v0.5.2 — 6 columns):
✅ **Review iter <n> complete in <wall-clock-time>s.**
| Reviewer | Model | Score | Time | Findings (P0/P1/P2) | Verdict |
|---|---|---|---|---|---|
| feature-dev:code-reviewer | claude (feature-dev) | 4/5 | 102s | 0/3/5 | Solid spec; minor polish on §5.3 |
| general-purpose adversarial | claude (general) | 3/5 | 84s | 3/6/0 | Three blockers; revise before TDD |
| cursor-cloud-agent | composer-2.5 | 5/5 | 67s | 0/0/2 | Looks ready to ship |
| codex-exec | — | ⏭ skipped | — | — | OPENAI_API_KEY not set |
| composer-2.5 manual | — | 📋 pending | — | — | Optional paste-back |
**Aggregate: P0 X, P1 Y, P2 Z, avg <A>/5 over <M> scored channels** → <decision: spec_review_complete OR spec_revising>
Status column absorbed into Score column (v0.5.2): instead of a separate Status column, the Score cell renders ⏭ skipped (reason), 📋 pending, ❌ failed, ⏱ timeout for non-numeric states. Only completed reviewers get a numeric N/5.
Outlier footer (v0.5.2): if ANY single reviewer's derived Score is ≤ 2, append BELOW the aggregate line:
⚠️ Low score outlier: <reviewer-kind> <N/5> (<P0>P0). Aggregate avg hides blocker.
This surfaces the blocker that the mean would otherwise mask (e.g., 4 reviewers at 5/5/5/1 → mean 4.0/5 looks safe but the 1/5 is a real blocker).
Bootstrap mode parity (v0.5.2): identical 6-column table + outlier footer + Score derivation apply in bootstrap mode (B-Step 5 in references/bootstrap.md). No claim-file write in bootstrap — table printed to chat only.
Update the single TodoWrite sentinel item added in Step 1.5 to completed:
TodoWrite([
{ content: "/review-spec dispatch (iter <n>) — N reviewers in parallel",
activeForm: "Done: N reviewers, X P0 / Y P1 / Z P2 (in <wallclock>s)",
status: "completed" }
])
The per-reviewer outcomes (skipped, failed, completed counts) are visible in the chat status table above. Skipped channels are reflected in the aggregate P0/P1/P2 counts (counted as 0 findings) and the reviewers[] JSON array on the claim file. The TodoWrite sentinel is intentionally summary-level — Claude's chat sidebar shows it as one completed item with the aggregate counts in its label.
If conversation context contains a pasted Composer reply since the last /review-spec invocation, parse it, dedup by body hash (do not duplicate entries), append as {kind: "composer-2.5-manual", status: "complete", iteration: <n>, ...}. Advisory only — re-aggregation may flip state if new P0 surfaces.
0 P0 → subStatus: spec_review_complete. Echo (after the final status table from Step 4):
📋 Spec ready for next step.
When ready, ask the user to run /pr-autopilot:approve-spec.
(Optional: paste Composer 2.5 findings + re-run /review-spec for additional perspective.)
≥1 P0 → subStatus: spec_revising. Echo aggregated P0 list grouped by reviewer (after the final status table):
⚠️ Spec revision needed. <N> P0 findings:
[P0 from <reviewer-kind>, confidence 8/10] <title> — <body>
...
Agent: address findings, re-run /pr-autopilot:review-spec.
git add .claude/assignment-claims/<id>.json
git commit -m "chore(pr-autopilot): review-spec iter <n> for <id> — <N> P0, <M> P1"
Graphify hint prefix (v0.5.3+): when _graphifyHintEnabled == "true" (set in Step 2), prepend the following block to BOTH claude-code-reviewer-subagent and claude-self-review prompts:
**Code knowledge graph available:** This repo has a graphify-built knowledge graph at
`graphify-out/graph.json`. BEFORE grep'ing for symbols or reading source files, query
the graph: `graphify explain "<symbol>"` returns the node + connections + community
in ~1-3k tokens vs ~30-100k for a multi-file grep. Use `graphify path "A" "B"` for
dependency-trace. If `graphify` errors with "command not found" (CLI not installed
locally), fall back to grep + Read without retrying.
When _graphifyHintEnabled == "false", the hint block is omitted entirely (no instruction injection).
claude-code-reviewer-subagent prompt template:
Review the spec at <path> for engineering rigor:
- internal contradictions
- missing edge cases / failure modes
- scope creep vs scope_in/scope_out
- alignment with CLAUDE.md + DESIGN.md (read both first)
- test coverage gaps
- security/correctness for any code paths described
Return P0/P1/P2 findings with confidence ratings (5/10-10/10) per PUSHBACK.md rubric.
Format: structured markdown table or per-finding section.
claude-self-review (hostile) prompt template:
You are a HOSTILE reviewer reading the spec at <path>. Find WEAKNESSES:
- what is underspecified / hand-wavy
- what assumptions might be wrong
- what edge cases / error paths / race conditions are missed
- what scope creep is hidden in scope_in
- what tests would actually catch the failures the author hand-waved
Be ruthless. Do NOT be polite. Tighten the spec by finding weaknesses,
not by validating the author's choices.
Return P0/P1 ONLY (no P2 noise) with confidence ratings.
/review-spec after spec_review_complete is safe — it re-dispatches reviewers and may flip back to spec_revising if new P0 appear.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub marcinsufa/claude-pr-autopilot --plugin pr-autopilot11 skills in this plugin
/allowAdd a repo to the pr-autopilot auto-trigger allowlist. Use /pr-autopilot:allow <owner/repo> (or no arg for the current repo). The auto-trigger hook only fires for allowlisted repos./approve-specUser-only gate from spec to TDD. Asks the user (AskUserQuestion) to approve, show or reject the reviewed spec; on approve the user runs approve-claim.sh in their own terminal, which writes `approvedAt` + `approvedBy` to the claim file and flips sub-status to `implementing`. The PreToolUse hook (`enforce-spec-gate.sh`) then unblocks writes outside `specs/`. Use when - "approve the spec", "give green light to TDD", "spec is good, proceed"./assignAtomically claim an assignment from `assignments.yaml`, create a worktree off `origin/main`, write the claim file, and brief the agent. Uses git branch creation as the atomic lock primitive — concurrent calls on the same id are racing on `git worktree add -b`; loser gets a graceful "claimed by X" message. Use when starting work on a pre-declared unit ("claim admin-d1", "start the next ready assignment")./automergeOpt a repo into pr-autopilot safe auto-merge. Use /pr-autopilot:automerge <owner/repo> (or no arg for the current repo). When the loop reaches SUCCESS, autopilot queues a squash merge to the integration branch (dev) — never to master/main/production, always CI-gated. Separate from /pr-autopilot:allow./finishPost-merge cleanup. After the PR merges (typically via v0.4 automerge), runs /pr-autopilot:finish <id> to update the claim file to `merged`, mirror to ExoVault `done`, update `assignments.yaml` on `main` with merge metadata, and best-effort cleanup of the worktree + local branch. Lists dependent assignments that became READY. Idempotent. Use when - "close the assignment", "PR merged, clean up", "what's next ready"./pauseTemporarily suppress pr-autopilot auto-trigger without changing the allowlist. Use /pr-autopilot:pause. Re-enable with /pr-autopilot:resume.