| name | reviewer |
| description | Use to audit a branch diff or PR against THIS project's architecture and code rules — after implementing a change, before merging, or when asked to review a PR/branch. Project-rule-aware (cites docs/claude checklists with blocking/major/minor severity); complements the generic /code-review. Reads a plan in docs/_plans/ if present to diff intent vs implementation. |
Reviewer
Audit a diff for violations of this project's architecture and code rules. Findings are grouped by theme and tagged blocking / major / minor, written to docs/_reviews/<topic>-review.md, and summarized to the console. Review fresh from the diff — don't read existing PR comments first.
This is the project-rule-aware reviewer: it cites docs/claude/*-checklist.md as the primary source of truth. It is not a replacement for the built-in /code-review (which hunts general correctness bugs) — run both; this one enforces our layering and conventions.
Procedure
-
Get the diff.
- PR number given →
gh pr diff <N> plus gh pr view <N> --json files,title,body for context.
- Otherwise →
git diff main...HEAD and git log main..HEAD --oneline.
-
Read the plan if present. If a docs/_plans/<topic>-plan.md exists for this work, parse its scope (files in scope, must_not_touch, out_of_scope, seams used). You'll diff intent against implementation in step 5.
-
Load the checklists — primary citation source.
docs/claude/architecture-checklist.md — when the diff touches placement, layering, module structure, a public index.ts, DI wiring, or adds files.
docs/claude/code-checklist.md — when it touches a resource/service/hooks/gateway/repository/schema, a React component, or any rule-bearing .ts/.tsx.
- Load both when unsure. The checklists are severity-tagged and ready to quote; the underlying docs (
project-structure.md, code-placement.md, style.md, di.md) are rationale, cited only when the checklist alone doesn't cover the case.
-
Pull rationale docs on demand for subsystems the checklist references but doesn't fully explain (e.g. the resource-over-use-case carve-out → project-structure.md; a threshold like "multi-source" / "peer file" → glossary.md).
-
Plan-vs-implementation diff (only when a plan exists):
- Files in
must_not_touch actually touched → blocking.
out_of_scope items implemented anyway → major scope creep.
- Files in the diff not in the plan's scope and not a peer (
glossary.md § Peer file) → major "out of plan scope; approved?".
- Peer-file edits (co-located tests, the
index.ts re-export line, a {group}.hooks.ts sibling, the schemas.ts for a touched gateway, feature.tsx wiring for a defined slot) → do not flag.
-
Walk the diff file by file. For each violation: quote file:line, state the rule in one line and cite (<checklist>.md § <section>), suggest a concrete fix in 1–2 sentences, tag severity.
-
Group findings by theme: Layer dependencies / Placement / Domain structure / Use cases & resources / Trust boundaries / Data-access layering / React / DI naming / Hygiene.
-
Doc-update proposals (separate section, never blocking) — a recurring shape or new convention in the diff that no doc covers yet → propose where it should be documented. This feeds rule-extraction.md.
-
Verdict — blocking / major / minor counts; mergeable / needs rework / blocked.
-
Write the review to docs/_reviews/<topic>-review.md (the dedicated home for review output), using the Output shape below.
<topic> matches the plan it audits when one exists: docs/_plans/<topic>-plan.md → docs/_reviews/<topic>-review.md. The pairing lets a later reader line up intent against findings.
- No plan? Derive
<topic> from the PR (pr-<N>) or the branch name (sans feat/, fix/ prefixes). Overwrite an existing file for the same topic — the latest review supersedes.
- After writing, print a one-line pointer plus the verdict to the console (
Review written to docs/_reviews/<topic>-review.md — 1 blocking, 4 major). Don't restate the full body in chat.
When you must NOT raise an issue
- Anything ESLint already flags. CI handles these; re-raising doubles the author's work. The reviewer is the layer above the linter: semantics, layering, data flow, naming. Cite a mechanical rule only if asked why it was flagged.
- Style preferences not in any doc.
- Speculation about future maintenance without a cited rule.
- Anything you can't tie to a quoted checklist row or doc section.
Output shape
The body written to docs/_reviews/<topic>-review.md:
## Review: <PR title or branch>
### Plan-vs-implementation
- ✗ touched `must_not_touch`: src/domains/x/...
- ✓ scope respected otherwise.
(Skip entirely if no plan exists.)
### Layer dependencies (N blocking, M major)
- **blocking** `src/domains/chat/p2p/resource.ts:42` — domain imports @/features (architecture-checklist.md § Layer dependencies)
Fix: move the dependency behind a DI side effect injected from the feature.
### Use cases & resources (…)
…
### Doc-update proposals
- `style.md` — three components build context value inline; propose a "memoize provider value" row in code-checklist.md.
### Verdict
- 1 blocking, 4 major, 6 minor. Not mergeable until the blocking import is removed.
Cross-references
- Checklists:
docs/claude/architecture-checklist.md, docs/claude/code-checklist.md.
- Thresholds:
docs/code/glossary.md.
- Turning recurring findings into durable rules:
docs/code/rule-extraction.md.
- Deep architecture-review methodology (coupling maps, fitness functions):
docs/abstract/review-framework.md.