Skip to content
Back to skills

Prospec Review

ASecurity

Adversarial Code Review → Fix Loop - Between implement and verify, an independent fresh-context reviewer audits the whole change diff; verifier-confirmed criticals are auto-fixed, majors are proposed, and a spec-aware lens checks delta-spec/dependency-direction — the SDD station between implement and verify, not ad-hoc PR review. Triggers: code review, adversarial review, find bugs, 審查, 程式碼審查, 對抗式審查, 找 bug, 找問題

  • 6 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 2, 2026
ai-agentsrustgobashgitsecurityperformancedocumentation

Works with

  • terminal
  • cli

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned November 9, 2026

npx -y skills add benwu95/prospec --skill prospec-review --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Prospec Review?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Prospec Review
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/benwu95-prospec-review/badge)](https://www.skillsdirectory.com/skills/benwu95-prospec-review)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: prospec-review
description: "Adversarial Code Review → Fix Loop - Between implement and verify, an independent fresh-context reviewer audits the whole change diff; verifier-confirmed criticals are auto-fixed, majors are proposed, and a spec-aware lens checks delta-spec/dependency-direction — the SDD station between implement and verify, not ad-hoc PR review. Triggers: code review, adversarial review, find bugs, 審查, 程式碼審查, 對抗式審查, 找 bug, 找問題"
---
<!-- Generated by `prospec agent sync`. Do not edit — this file is regenerated on every sync. -->

# Prospec Review Skill

## Activation

When triggered, briefly describe:
- That an independent reviewer (fresh context) will audit the entire change diff between implement and verify
- That only verifier-confirmed criticals are auto-fixed; majors are proposed and passed to verify as WARN
- That the loop converges to zero unresolved critical or escalates to you at a hard cap — review never silently passes

## CLI Prerequisite (required)

> The prospec CLI is a required file for this skill — its deterministic steps call `prospec`
> commands. Probe BEFORE any other step; there is no manual fallback.

1. Run `prospec --version` (Bash).
2. **Command not found / not executable** → STOP. Ask the user to install the prospec standalone
   executable — the one-click installer script from the project README (macOS/Linux `install.sh`,
   Windows `install.ps1`) or a release binary from GitHub Releases; prospec is NOT published to
   npm. Then re-run this skill.
3. **Version older than 2.11.0** → STOP. Report the installed vs required version
   and ask the user to upgrade, then re-run this skill.

Hand-executing a CLI-owned mutation is NEVER the fallback — that re-introduces the
nondeterministic serialization this contract exists to remove.

Evidence uses `snapshot-v2` / `repository-inputs-v2`: working-tree content of git index members. Unchanged members and effective content preserve evidence across staging and equivalent commits. Revalidate legacy records once.

## Startup Loading

1. [STABLE] Run `prospec constitution show --station review` (Bash)
2. [STABLE] **MANDATORY** — Read [`references/review-format.md`](references/review-format.md) for the severity contract, review.md format, and reviewer lenses
3. [DYNAMIC] Read `.prospec/changes/[name]/tasks.md`, `plan.md`, `delta-spec.md`, `proposal.md` — the contract this change must honour
4. [DYNAMIC] Read `prospec/ai-knowledge/_conventions.md` + each affected module `README.md` — patterns and ripple effects
5. [DYNAMIC] Compute the change diff relative to the branch base (`git diff`), reviewing source + tests; exclude generated artifacts (`dist/`, lockfiles, deployed skills)

## Entry Gate

> Blocking precondition check before this skill runs. If any item FAILs, stop and tell the user what is missing — do not proceed.

- Implementation is done: metadata status is `implemented` **or later** and code tasks are complete (`prospec change status implemented` already enforces that; unchecked `[M]`/`[V]` do not block; kind schema: tasks-format reference); if still before `implemented` (`story`/`plan`/`tasks`), FAIL and point to `prospec-implement`. This item is a **floor, not a ceiling** — a `verified` change whose code moved after verify re-enters here (its stale `review-provenance` demands it), stamping a fresh baseline with no status regression.
- Planning artifacts exist: proposal.md, plan.md, delta-spec.md, tasks.md. **Exception — `metadata.scale: quick`**: only proposal.md + tasks.md are required (a quick change legitimately has no plan/delta-spec); do not FAIL on their absence. **Exception — `metadata.scale: backfill`**: only proposal.md + delta-spec.md are required (a backfill change records existing code — no forward plan/tasks); do not FAIL on their absence.
- Prior unresolved WARN: surface the `warn:` lines `prospec status` prints for this change.

## Core Workflow

### Reviewer Modes

- **B — single reviewer, multi-lens (default)**: one fresh-context reviewer covers every must-run lens in a single pass. Token-friendly; independence from the implementer is already satisfied.
- **A — parallel lenses (opt-in)**: N independent lens agents run concurrently — available only when the capability line below resolves `can_spawn_subagent` to yes; it has no single-context equivalent. Use for large or high-risk diffs, or Scale=Full. Higher first-round cost buys maximum inter-lens independence.

**Route the reviewer to the strongest model / agent tier the harness makes available**, in fresh context — reviewer strength bounds detection. Name the tier abstractly, never a model or vendor. Record the baseline (`prospec check --record-review`) with honest `--graded-by`: `fresh-subagent` for an independent context, `in-session` for the implementing session. The CLI stores `review_provenance.graded_by` for downstream verify; verify's grade cap keys on each dimension's own `graded_by`.

### Review Lenses

Must-run: every round. Conditional: by applicability.

| Lens | Classification | Summary |
|------|----------------|---------|
| Correctness & edge cases | must-run | Logic, boundaries, errors and state transitions. |
| Security & data integrity | must-run | Injection, secrets, authorization, filesystem writes, preservation, model/tool trust and dependencies; web checks when applicable. |
| Spec-architecture | must-run | REQ contradictions, dependencies, conventions and ripple. |
| Efficiency / performance | conditional | Hot paths, repeated I/O, resource use or latency-sensitive changes. |
| Maintainability / DRY | conditional | Abstractions, duplicated helpers/guards/writers, documented single-source bypass. |
| Docs-claims | conditional | Documentation claims affected by changed behavior or interfaces. |
| Parallel-site completeness | conditional | Sibling sites implementing the same changed behavior. |
| Test-quality | conditional | Changed tests or test-gate configuration: behavior coverage, independent oracles, failure sensitivity and loosening. |

**spec-architecture** checks implementation **contradicting** REQs. Completeness: verify 2/5 Key Difference from Other Skills; do not restate.

**Quick degradation** (`metadata.scale: quick`): without delta-spec, comparison is `not-applicable`; never report it as PASS. The dependency direction, module conventions, and ripple checks still run in full. For existing Feature Spec behavior, raise an early warning; `prospec-archive` Entry Gate re-checks it.

Installed review skills add criteria via the delegation protocol's criteria selection and review-criteria brief item (The Loop step 1); the spec-architecture lens is always added by prospec, never replaced by the vendored lens criteria.

Check security each round. Load [criteria](references/review-lenses-content.md) for inputs, filesystem writes, auth, secrets, external calls, dependencies or applicable conditional lenses. Otherwise its details stay on demand, never Startup mandatory. File under one primary lens; related concerns go in its summary.

### Severity Routing

Apply `references/review-format.md`. In short: **critical** blocks the loop and is auto-fixed; **major** does not block (proposed, passed to verify as WARN, never counted in verify's grade); **minor** is recorded but does not block, is not auto-fixed, and is not surfaced to verify's grade.

### The Loop

1. Run the reviewer (mode B or A; **Harness Degradation** below) over the diff, whole functions/classes and grep ripple; return the round per Persistence.
   - **Delegation & receipt**: ticket every delegate before its spawn and receive its payload the moment it returns — before any fix — per [`references/delegation-protocol.md`](references/delegation-protocol.md), which holds the Physical Receipt Verification Protocol, its bounded wait and the hand-off of a mutation to the human; the payload is a `ReviewFindingsInputSchema` array for `prospec review merge`. A terminal failure takes **Harness Degradation** below and discloses `--graded-by in-session` when it grades in-session.
2. For each **critical**, run its `repro` and read cited code; an **independent verifier** writes a single-entry `ReviewFindingsInputSchema` JSON array using the same finding `id` and `repro`, with a `status` of `confirmed` or `not-found`; it returns only the payload path plus that status; ticket it under its verifier role and receive before acting, per delegation protocol. On terminal verifier failure, disclose degradation, leave the critical unresolved and escalate; NEVER self-confirm or fabricate synthetic verdicts. Before fixing, construct a **fail-then-pass regression test (pin)** with mutation verification guarding later rounds. Auto-fix only confirmed criticals with local, drop-in fixes and regression pins; escalate architectural, large-refactor or ambiguous fixes to the human.
3. Apply each fix to the **working tree** (no commit); `prospec review merge` refuses the round without a fresh green `test_attempt` and prints its remediation (runner per [`references/project-test-runner.md`](references/project-test-runner.md)) — on `ESCALATE_TO_HUMAN` stop automated retries.
   - **Class sweep**: before applying a fix, derive a structural predicate for the failure mode (see Auto-Fix Boundary in review-format), scan the cumulative diff and its touched files, and fix every match. For omission defects, list sites still missing the required content; use locale-safe scanning for non-ASCII content.
   - **Fix ripple**: inspect affected parallel-language pages, docs, JSDoc/comments, delta-spec, task implementation deviations, module READMEs and test-count sites after adding tests. When changing a shipped claim, check its trust-zone owner requirement for a MODIFIED delta in the same change.
   - **Shape check**: ask whether the fix only changed the failure's shape. When a documentation-claim wording loop occurs a second time, delete the claim rather than rewrite it.
4. Re-review defaults to **full-lens re-review**: treat the fix as a new diff and re-run all review lenses over the cumulative diff in a fresh minimal context (input: cumulative diff + lenses + list of pinned findings + classes repaired this round and their predicates). The reviewer reruns those predicates; remaining instances keep the original finding id open. Regression tests guard pinned findings; do not re-adjudicate them. Continue until **0 unresolved critical** (review-clean).
5. **Circuit Breakers & Hard Cap**: Read [`references/circuit-breaker.md`](references/circuit-breaker.md) on demand. Hard cap: **3 rounds** (maximum 5). The CLI evaluates the breakers on every merge: the round cap, the **Oscillation Breaker** (state flips `FAIL → PASS → FAIL` ≥ 2), the **fix-induced defect ratio** (trips if > 0.5 in round > 1) and **persistent test failure** (consecutive failed test attempts). Historical ratio and flip history remain recorded; findings-based triggers stop when the complete snapshot is all resolved, or only carried minor/major advisories remain with explicitly inactive current-round activity. Missing activity does not establish advisory convergence. Recovery still requires current-event review authorization and the test gate; see the reference. Observe the reference’s early-stop conditions (zero delta, suite regression, regression pin gate); the CLI does not compute them.
6. **Escalation**: On a cap, breaker or early-stop, present the CLI `EscalationReport` using the guidance below.

### Harness Degradation

**Harness capabilities** (resolved by `prospec agent sync` from this agent's registry entry — act on them, do not re-derive them at runtime): `can_spawn_subagent`: yes · `can_worktree`: no · `can_background`: yes

Sub-agents are available here, so take the sub-agent path. Should a spawn fail at runtime anyway, degrade — where the delegation protocol allows a fresh run, offer a choice between the harness's own reviewer command and a single-pass fresh-context review, and let the developer decide; otherwise review in-session — and name the path you took. A degraded path is never a silent skip: the developer is told which path ran, every time.

### Persistence

Follow the Spawn brief's class-granularity guidance in the delegation protocol when filing review findings.

Emit this round's findings as a `ReviewFindingsInputSchema` JSON array — whose executable field projection and cross-field rules live in [`references/delegated-evidence-format.md`](references/delegated-evidence-format.md) — to the payload path its ticket assigns (Mode A: each lens's received payload, combined by you into the round's file), then run `prospec review merge --findings <file> --lenses <lens,lens,…> [--round <n>]` (Bash). Pass `--lenses` with every lens this round actually ran (the must-run set plus any conditional lens you loaded), even on a clean round: a lens that ran and found nothing is essential data for `prospec learn yield`. The CLI stamps `origin_round` on each finding based on the current round — `origin_round` is stamped by the CLI, never declared by the reviewer. When passing `--round <n>`, `<n>` is this review loop's round counter starting at 1 (a change re-entering review after verify starts again at 1; the CLI offsets it internally by earlier loops so the `Origin` column stays monotonic). Omit `--round` and the CLI re-runs the round `review.md` records until `prospec change log` has closed it, then opens the next — so re-running one round's merge is byte-idempotent. A delegated reviewer or verifier **writes that file itself and returns only its path plus the counts** — evidence never travels back. The CLI owns the cumulative `review.md` bookkeeping: merge by finding identity, origin round tracking (`origin_round`), severity taken as the maximum, rows carried forward across rounds so resolved items are not re-raised, `repro` into its own table column, and `evidence` into the evidence section (both cumulative — a round re-reporting a finding without them keeps what the artifact holds). Every `critical` needs a `repro`; the shared reference owns its exact cross-field contract. **Finding IDENTITY is your judgment**: code edits shift line numbers, so reuse the prior round's `id` for a finding you consider the same one — the CLI never infers identity from the location string. An id no row carries opens a NEW row (only a row with no id at all — the pre-ids shape — is adopted by one), and a finding you leave id-less keys by location+lens against the rows that predate this round, so two id-less findings you file at one Location in one round stay two rows.

> **Review artifact generation**: Follow `prospec review merge` for artifact generation. The CLI records this round's counts at merge time; `change log` only closes the round and audits self-reported counts.

Read each gate command's whole output before the next step — circuit-breaker, escalation and refusal messages can appear mid-output, even when the command succeeds — and judge whether a state-changing step succeeded by its own exit code, not by a command chained after it; run each such step as its own command.

### Review Provenance (machine gate)

Stage intended new files with `git add`; tracked edits need no staging.

Review must leave a machine-queryable record so `prospec-verify`'s Entry Gate can prove it ran and is still current:

1. **Every round** — including a **review-clean** round (0 critical / 0 major) and **circuit-breaker tripped rounds** — close the round via `prospec change log --skill prospec-review --result PASS|WARN [--warning "circuit breaker tripped: <type>"|"<unresolved item, in the artifact language>"]` (Bash; result `PASS` when clean, `WARN` when unresolved majors/FAIL or circuit-breaker trips carry forward). The CLI records this round's counts at merge time; `change log` only closes the round and audits self-reported counts. A clean review that records nothing is indistinguishable from a review that never ran.
2. **At loop convergence** (review-clean or escalation), run `prospec check --record-review --graded-by <fresh-subagent|in-session>` — the CLI writes its computed digest and grading context to `review_provenance` in `metadata.yaml`. This is the baseline the `review-provenance` drift check compares against.

Later input edits stale `review-provenance` and require a fresh review.

## Escalation Decision (CLI-Owned)

- Present CLI trigger/lifetime ordinal/exits/recommendation; stop.
- Only human `Manual override: <reason>` composed WARN grants one event/station attempt; observations/report warnings grant none. Replay consumes none; resolution expires grants; tests independent.
- Re-scope keeps amendment gates/status, no unlock. PASS retains history/prose/fences.

### Abandon an attempt

`prospec change abandon <name> --reason <text>` → `archiveDir` (main worktree `.prospec/abandoned/`). `--overturned`: disproved leaves. Save work → stage metadata → verify/publish → clean source; inspect partial paths; no auto-unlock.

Report preservedFileCount: manifest entries, not gitlink pins; worktree not restored. Human decides keep/restore via preservation/version control. Restore requires explicit authorization; reuse prior decision.

## Output Contract

> After running, self-assess and emit a concise Output Summary. Every Success Criterion must be objectively checkable (file existence / grep / test result / count) — no subjective adjectives.

### Success Criteria
- [ ] no unresolved critical (loop converged, or escalated to the human with the list)
- [ ] every fix round left the project test suite (per [`references/project-test-runner.md`](references/project-test-runner.md)) green
- [ ] `review.md` written with the findings table
- [ ] a `prospec-review` `quality_log` round-close entry recorded (every round, incl. review-clean) and the review baseline stamped via `prospec check --record-review --graded-by <context>`
- [ ] every auto-fixed critical was verifier-confirmed before the fix and guarded by a fail-then-pass regression pin (manual)

### Failure Conditions
- a critical auto-fixed without an existence-verification step or without a regression pin
- tests left red, or the loop exceeded the hard cap without escalating

### Output Summary
Emit one line: `Met N/M | Unmet: <items> | Overall: PASS|WARN|FAIL | Next: <one-line>`

### Exit Gate (Constitution)

Verify the output against this skill's **site-specific** Constitution rule (**dependency-direction/layering** — the spec-architecture lens's concern), not the full Constitution; the every-principle audit is `prospec-verify` V3/5 only. When the rule carries RFC-2119 severity, grade by weight — MUST→FAIL, SHOULD→WARN, MAY→informational (the grade vocabulary stays PASS/WARN/FAIL). A free-text Constitution falls back to judgment-based grading. **Always** close the round with a `prospec-review` entry to `metadata.yaml` `quality_log` (`skill: prospec-review` / `date` / `result` / `warnings`) — **every round, including review-clean** (result `PASS` when clean, `WARN` when unresolved majors/FAIL carry forward) — so `prospec-verify` can machine-verify review ran and surface any majors; majors are advisory and do not block. Then record the review baseline (`prospec check --record-review --graded-by <context>`, see Review Provenance) and suggest `prospec-verify`.

## NEVER

- **NEVER** return evidence prose to this context — a delegated reviewer or verifier writes it to the payload file and returns the path; an unbounded relay costs the very context delegation was meant to save
- **NEVER** proceed on verbal completion claims or promises without physical receipt verification of the payload file — trusting prose without file inspection masks execution errors
- **NEVER** fabricate mock findings, dummy JSON `[]`, or synthetic passes when a payload file is missing or unreadable — fail closed with concrete diagnostic errors
- **NEVER** auto-fix a critical that was not independently confirmed to exist — acting on a hallucinated finding edits correct code and erodes trust
- **NEVER** apply a fix to a confirmed critical without a fail-then-pass regression test (pin) with mutation verification — unpinned fixes risk silent regression during subsequent full-lens re-reviews
- **NEVER** record a review round after a `prospec review merge` test refusal — follow its remediation
- **NEVER** loop without a hard cap or silently pass unresolved criticals — unbounded retries waste tokens; unresolved criticals must escalate to the human
- **NEVER** auto-apply an architectural or large-refactor fix — only concrete, local, drop-in fixes are safe to apply unattended; the rest are proposed
- **NEVER** count major findings in verify's grade — review and verify are separate axes; majors pass as advisory WARN, not as a grade penalty
- **NEVER** silently skip review when the capability line says no sub-agents, or when a spawn fails — offer the degraded path so the developer decides knowingly
- **NEVER** commit during review — the commit boundary is after `prospec-verify` reaches S/A; review only edits the working tree

## Error Handling

| Scenario | Action |
|----------|--------|
| metadata status is BEFORE `implemented` (`story`/`plan`/`tasks` — implementation unfinished) | Stop; point to `prospec-implement` to finish tasks first. A status at or past `implemented` — `verified` included — is NOT this scenario: the Entry Gate item is a floor |
| No change diff vs branch base | Report nothing to review; suggest proceeding to `prospec-verify` |
| Sub-agent spawn fails at runtime | Offer the harness reviewer or single-pass fallback; do not skip |
| Fix repeatedly turns tests red | Roll back, mark the critical unresolved, escalate to the human |
| Reviewer and verify disagree on layering | Keep both — review catches it first, verify re-checks independently; no mutual exemption |

## Next-Step Handoff

After the Output Summary, recommend the next step in the SDD workflow order
(`story → plan → tasks → implement → knowledge-update → review → verify → archive`, then periodic `learn`) — read
`metadata.yaml` status and `prospec/ai-knowledge/_status-lifecycle.md` (review and learn own no
status transition, so follow this order, not status alone). Provide the direct, actionable Skill
identity or CLI command for the next step (e.g. `prospec-plan`), allowing smooth continuation
without blocking on a separate confirmation turn. If the stage is terminal (`archived`), the linear
flow is complete — point to periodic `prospec-learn` rather than a workflow successor. If the result
does not advance (e.g. verify grade B/C/D), say so and point to the corrective step instead of
offering the next skill.

Files in this skill

  • SKILL.md20.7 KB
  • references/circuit-breaker.md4.5 KB
  • references/delegated-evidence-format.md11.2 KB
  • references/project-test-runner.md2.7 KB
  • references/review-format.md9.6 KB
  • references/review-lenses-content.md11.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.