Review
Use this skill after implementation to review changes against the diff, plan, and prior learnings.
See shared pipeline instructions for model routing and pipeline behavior.
Core rules
- Load project rules before producing findings (detailed in Workflow step 3): load
../../rules/common/code-review.md + code-smells.md, detect language from changed files, load matching rules/{lang}/ files including review-checklist.md (mark missing (fell back to common) when absent), plus rules/web/ for frontend/browser changes. Emit a Rules loaded: manifest — no manifest, no findings
- Priority: project-level
{repo-root}/rules/ overrides package defaults
- Standards axis baseline: apply
../../rules/common/code-smells.md (Fowler smell baseline). Two binding rules: a documented repo standard overrides the baseline; every smell is a judgement call (report as "possible Feature Envy"), never a hard violation. Map severity via P0/P1/P2 — default P2, escalate when a repo doc endorses it or it harms data flow/testability.
- Determine diff scope before selecting reviewers
- Use
review_router tool to select reviewer personas based on diff metadata
- Read relevant plan artifact when exists
- Run solution search (see
../references/solution-search.md):
- Extract keywords →
grep -rl "tags:.*keyword" docs/solutions/ ~/.pi/agent/docs/solutions/
- Read frontmatter only (first 15 lines) of matches → score by severity + tag relevance
- Fully read top 3 candidates
- Spec axis: determine spec source via
references/spec-source-detection.md (plan → brainstorm → commit issue ref → skip). Against the chosen spec, report missing requirements, scope creep (unrequested behaviour), and wrong implementation (looks done but isn't).
- Produce structured findings using
references/findings-schema.md
- Autofixable findings: apply and re-review (max 3 iterations)
Review discipline
Code review is technical evaluation, not social performance:
- Verify before implementing any suggestion
- YAGNI check: question features nothing uses
- No performative agreement: verify before concurring
- Push back with reasoning when findings are incorrect
- Evidence before assertions: cite specific code, not principles
- Architecture axis: audit module depth and seams using
../references/module-design.md
Precision gate
Favor precision over recall. A false positive costs more trust than a missed minor issue.
- Before reporting a non-local claim (race condition, security boundary, resource leak), use
file_read and code_search to confirm evidence. Do not infer from names alone.
- Stay silent when the surrounding context is unclear. A miss on ambiguous code is acceptable; a false alarm is not.
- Do not flag issues that a compiler, formatter, linter, or type checker already catches, unless the diff shows a concrete user-visible consequence those tools miss.
- Label each finding with severity. Blocking (CRITICAL/HIGH) for correctness and security; non-blocking (LOW) for style and naming.
- Apply language-specific rules from
rules/{lang}/review-checklist.md — they contain precise, actionable defect patterns per language.
Handling findings
- Read — complete all findings without reacting
- Verify — check each against codebase reality
- Evaluate — is it sound for THIS codebase?
- Act — fix confirmed issues, push back on incorrect ones
- Test — verify each fix individually, no regressions
- Close — when findings are resolved and tests green, flip the reviewed plan's Status header to
done and move it to docs/plans/archive/ (skip if no plan artifact)
Workflow
- Load context: consume latest handoff before any broad file reads —
context_handoff load or read .context/compound-engineering/handoffs/latest.md. If found, use activeFiles, artifacts.plan as starting point. If not found, proceed normally. Read CONTEXT.md if it exists at root — see ../references/domain-language.md.
- Determine diff scope — prefer
branch/base from latest handoff if present; else from explicit target; else ask user
- Load project rules (blocking — no findings before this completes):
- Detect language from changed files (
.ts/.tsx→typescript, .py→python, .go→golang, .rs→rust, .java→java) or repo markers, merging {repo-root}/rules/language-detection.md (project-level map, same marker wins); full map in language detection. Mixed-language diffs: load per language
- Check
{repo-root}/rules/ first (overrides package defaults); load rules/common/code-review.md, code-smells.md, matching rules/{lang}/ files including review-checklist.md, rules/web/ for frontend/browser changes
- Emit manifest before any finding:
Rules loaded: language=<lang> (via <files/markers>[, project-level map]), common=<files>, lang=<files>, web=<files or N/A>
- Same-session re-entry: if the transcript already contains a
Rules loaded: manifest for the same language, do not re-read the rule files — reuse them, cite the earlier manifest, and note the skip
- Collect stats (files, insertions, deletions) → call
review_router
- Read matching plan artifact; if absent, follow
references/spec-source-detection.md to probe brainstorm and commit issue refs
- Run solution search
- Apply each reviewer persona from
review_router
- Merge into structured findings — include
rules applied in the review summary (see references/findings-schema.md)
- Verify each finding against codebase
- Apply autofixes, re-run tests, re-review if needed
Optional: QA Test Mode
After code review complete, offer browser QA:
Code review done. Run browser QA?
- A) Done — stop here
- B) Browser QA — find visual/functional bugs
- C) QA + regression tests — find bugs, fix, add tests
If B or C: read references/qa-test-mode.md and execute workflow.
After QA: include findings in handoff, note fix commits/test files.
Handoff
See references/handoff.md for format.
Before finishing this skill, apply the completion checklist in shared pipeline instructions.
1---2name: 04-review3description: Review code changes across five axes with evidence-first findings. Use after implementation is complete and before committing.4---56# Review78Use this skill after implementation to review changes against the diff, plan, and prior learnings.910See [shared pipeline instructions](../references/pipeline-config.md) for model routing and pipeline behavior.1112## Core rules13141. Load project rules before producing findings (detailed in Workflow step 3): load `../../rules/common/code-review.md` + `code-smells.md`, detect language from changed files, load matching `rules/{lang}/` files including `review-checklist.md` (mark `missing (fell back to common)` when absent), plus `rules/web/` for frontend/browser changes. Emit a `Rules loaded:` manifest — **no manifest, no findings**152. **Priority:** project-level `{repo-root}/rules/` overrides package defaults163. **Standards axis baseline:** apply [`../../rules/common/code-smells.md`](../../rules/common/code-smells.md) (Fowler smell baseline). Two binding rules: a documented repo standard overrides the baseline; every smell is a judgement call (report as "possible Feature Envy"), never a hard violation. Map severity via P0/P1/P2 — default P2, escalate when a repo doc endorses it or it harms data flow/testability.174. Determine **diff scope** before selecting reviewers185. Use **`review_router`** tool to select reviewer personas based on diff metadata196. Read relevant **plan** artifact when exists207. Run solution search (see `../references/solution-search.md`):21 - Extract keywords → `grep -rl "tags:.*keyword" docs/solutions/ ~/.pi/agent/docs/solutions/`22 - Read **frontmatter** only (first 15 lines) of matches → score by severity + tag relevance23 - Fully read top 3 candidates248. **Spec axis:** determine spec source via [`references/spec-source-detection.md`](references/spec-source-detection.md) (plan → brainstorm → commit issue ref → skip). Against the chosen spec, report **missing** requirements, **scope creep** (unrequested behaviour), and **wrong implementation** (looks done but isn't).259. Produce structured findings using `references/findings-schema.md`2610. **Autofixable findings:** apply and re-review (max 3 iterations)2728## Review discipline2930Code review is **technical evaluation**, not social performance:31- **Verify before implementing** any suggestion32- **YAGNI check:** question features nothing uses33- **No performative agreement:** verify before concurring34- **Push back** with reasoning when findings are incorrect35- **Evidence before assertions:** cite specific code, not principles36- **Architecture axis:** audit module depth and seams using `../references/module-design.md`3738### Precision gate3940**Favor precision over recall.** A false positive costs more trust than a missed minor issue.41- Before reporting a non-local claim (race condition, security boundary, resource leak), use `file_read` and `code_search` to confirm evidence. Do not infer from names alone.42- Stay silent when the surrounding context is unclear. A miss on ambiguous code is acceptable; a false alarm is not.43- Do not flag issues that a compiler, formatter, linter, or type checker already catches, unless the diff shows a concrete user-visible consequence those tools miss.44- Label each finding with severity. Blocking (CRITICAL/HIGH) for correctness and security; non-blocking (LOW) for style and naming.45- Apply language-specific rules from `rules/{lang}/review-checklist.md` — they contain precise, actionable defect patterns per language.4647## Handling findings48491. **Read** — complete all findings without reacting502. **Verify** — check each against codebase reality513. **Evaluate** — is it sound for THIS codebase?524. **Act** — fix confirmed issues, push back on incorrect ones535. **Test** — verify each fix individually, no regressions546. **Close** — when findings are resolved and tests green, flip the reviewed plan's Status header to `done` and move it to `docs/plans/archive/` (skip if no plan artifact)5556## Workflow57581. **Load context**: consume latest handoff before any broad file reads — `context_handoff load` or read `.context/compound-engineering/handoffs/latest.md`. If found, use `activeFiles`, `artifacts.plan` as starting point. If not found, proceed normally. Read `CONTEXT.md` if it exists at root — see `../references/domain-language.md`.592. Determine diff scope — prefer `branch`/`base` from latest handoff if present; else from explicit target; else ask user603. **Load project rules** (blocking — no findings before this completes):61 - Detect language from changed files (`.ts`/`.tsx`→typescript, `.py`→python, `.go`→golang, `.rs`→rust, `.java`→java) or repo markers, merging `{repo-root}/rules/language-detection.md` (project-level map, same marker wins); full map in [language detection](../references/language-detection.md). Mixed-language diffs: load per language62 - Check `{repo-root}/rules/` first (overrides package defaults); load `rules/common/code-review.md`, `code-smells.md`, matching `rules/{lang}/` files including `review-checklist.md`, `rules/web/` for frontend/browser changes63 - Emit manifest before any finding: `Rules loaded: language=<lang> (via <files/markers>[, project-level map]), common=<files>, lang=<files>, web=<files or N/A>`64 - **Same-session re-entry:** if the transcript already contains a `Rules loaded:` manifest for the same language, do not re-read the rule files — reuse them, cite the earlier manifest, and note the skip654. Collect stats (files, insertions, deletions) → call `review_router`665. Read matching plan artifact; if absent, follow [`references/spec-source-detection.md`](references/spec-source-detection.md) to probe brainstorm and commit issue refs676. Run solution search687. Apply each reviewer persona from `review_router`698. Merge into structured findings — include `rules applied` in the review summary (see `references/findings-schema.md`)709. Verify each finding against codebase7110. Apply autofixes, re-run tests, re-review if needed7273## Optional: QA Test Mode7475After code review complete, offer browser QA:7677> Code review done. Run browser QA?78> - **A) Done** — stop here79> - **B) Browser QA** — find visual/functional bugs80> - **C) QA + regression tests** — find bugs, fix, add tests8182If B or C: read `references/qa-test-mode.md` and execute workflow.83After QA: include findings in handoff, note fix commits/test files.8485## Handoff8687See `references/handoff.md` for format.8889Before finishing this skill, apply the completion checklist in [shared pipeline instructions](../references/pipeline-config.md).