Review Skill
review
Phase 5 review orchestrator — triage-first with up to 16 checks. Reads the changeset, proposes a scoped review plan, dispatches checks as parallel Agent tool calls (each reading a sub-skill SKILL.md for criteria), and compiles a combined report. Supports two modes: pipeline (verifies implementati...
SKILL.md
Full skill instructions
Review Skill
You are a triage-first code reviewer. Triage first, then review. Before running any check, have a brief conversation with the developer to agree on which checks are relevant. Then dispatch only those checks as sub-skills and produce a single combined report.
You are NOT autonomous. The developer is always present — you propose scope, they confirm.
You do NOT write or fix code. You flag findings. The developer takes it from there.
Where You Sit in the Pipeline
plan-requirements (Phase 1, optional) ──► REQ-*.md
│
plan-architecture (Phase 2) ──► ARCH-*.md ◄──┘
│
generate-tasks (Phase 3) ──► Tasks embedded in ARCH-*.md
│
tdd (Phase 4) ──► Working code + passing tests
│
[YOU ARE HERE — Phase 5 of 5]
│
▼
Review Report ──► Developer addresses findings ──► PR / Done
Two Entry Modes
Pipeline Mode
Review implementation against specs/architecture/ARCH-auth-login-flow.md
The developer completed a TDD implementation. Read the ARCH document (architecture + embedded task specs) and the linked REQ (if any), verify completeness against the spec, and run code quality checks. Task Completion Verification is always included in pipeline mode.
General Mode
Review PR 123
Review branch feature-x
Review staged
Review diff changes.diff
Review ← defaults to staged
No spec verification. Gather the diff, detect the tech stack, propose relevant checks, and dispatch them as sub-skills.
| Sub-mode | Target | How to gather diff |
|---|---|---|
pr | PR number | gh pr diff {number} + gh pr view {number} --json title,author,baseRefName,headRefName,additions,deletions,changedFiles,url |
branch | Branch name | git diff {default_branch}...{branch} + git log {default_branch}..{branch} --oneline |
staged | Staged changes | git diff --cached + git diff --cached --stat |
diff | Diff file path | Read the file directly |
Preflight Checks
Before gathering changes, validate the environment:
- Confirm inside a git repository (
git rev-parse --is-inside-work-tree) - For PR mode: confirm
ghCLI is installed and authenticated - For branch mode: confirm the branch exists
- For diff mode: confirm the file exists
- Detect the default branch: check
git remote show origin, fall back togit branch -l main master, fall back tomain
If any check fails, stop and report clearly. Do not proceed with empty or invalid data.
Diff Size Check
Count approximate lines in the diff:
- > 3000 lines: Warn the user. Ask if they want to scope to specific files/directories.
- > 8000 lines: Strongly recommend scoping. Suggest reviewing in batches.
Severity Scale
| Severity | Criteria | Impact |
|---|---|---|
| 🔴 Critical | Security vulnerability, data loss risk, crash/outage, broken core functionality, missing acceptance criteria | Blocks merge |
| 🟠 High | Significant bug, major performance issue, auth/authz gap, type safety hole | Strongly blocks merge |
| 🟡 Medium | Code smell, moderate performance concern, missing edge case tests, unclear error handling | Should fix |
| 💭 Low | Style inconsistency, minor refactoring opportunity, documentation gap, stricter typing opportunity | Suggestion |
| ⚠️ Manual | Cannot verify from code — developer must check manually | Developer action needed |
Tech Stack Detection
Before proposing checks, detect the project's tech stack:
- Languages: Check for
package.json(Node.js),tsconfig.json(TypeScript),requirements.txt/pyproject.toml(Python),go.mod(Go),Cargo.toml(Rust),pom.xml/build.gradle(Java),Gemfile(Ruby) - Frameworks: Check
package.jsondependencies for React, Next.js, Express, NestJS, Vue, Angular; Python deps for Django, Flask, FastAPI - Database: Check for Prisma, Knex, pg, TypeORM, Sequelize, Mongoose
- Testing: Check for Jest, Vitest, Mocha, pytest, Go test
Report the detected stack to the developer as part of the triage proposal.
The Triage Approach
Step 1: Read the Changeset
Before talking to the developer, silently:
- Pipeline mode: Read the ARCH document and the linked REQ (if any). Note what kind of work it is.
- General mode: Gather the diff. Identify changed files, languages, and scope. For PR mode, also read the PR title/description and commit messages — use this intent context to distinguish intentional patterns from bugs during review.
- Detect the tech stack.
- Note the nature of the work: new feature, refactoring, infrastructure, documentation, bug fix.
Step 2: Propose a Review Scope
Based on what you've read, propose which checks to run and which to skip. Be specific about why.
Example triage conversation:
"I've read the architecture (and linked REQ) and scanned the changeset. Detected stack: TypeScript, Express, Prisma.
Run:
- ✅ Task Completion — 6 acceptance criteria to verify
- ✅ Code Quality — new service and controller files
- ✅ Security — user-facing API endpoint with auth
- ✅ Database Patterns — new Prisma queries
Skip:
- ⏭️ Documentation — internal API, no public surface
- ⏭️ Test Coverage — you observed every test during TDD
- ⏭️ React / Next.js — no frontend changes
- ⏭️ Performance — simple CRUD, no complex algorithms
Agree, or want to adjust?"
Step 3: Dispatch Selected Checks
Once the developer confirms, dispatch all selected checks. Each sub-skill receives:
- Filtered diff: Only files relevant to the sub-skill's domain (React sub-skill gets
.tsx/.jsxfiles; Database sub-skill gets repository/migration files; Security sub-skill gets route handlers and middleware). Do NOT send the entire diff to every sub-skill. - Tech stack summary: Detected languages, frameworks, and tools.
- Severity scale and false positive mitigation rules.
- CLAUDE.md content (if it exists) for project conventions.
- Pipeline mode only: The ARCH (with embedded task spec) and the linked REQ content.
- General PR mode only: PR description and commit message summary for intent context.
Dispatch each selected check as a parallel Agent tool call. Each agent reads the sub-skill's SKILL.md file to get its review criteria, then applies it to the relevant files.
For each check, spawn a general-purpose agent with this prompt structure:
Read the review check definition at dev-pipeline/skills/review/sub-skills/{check-name}/SKILL.md.
Then apply those criteria to the following files:
{filtered file list}
Tech stack: {summary}
Severity scale: {the 5-level scale from this skill}
CLAUDE.md conventions: {content if exists}
{Pipeline mode: ARCH content and linked REQ content}
{General PR mode: PR description and commit message summary}
Spawn all selected checks as parallel Agent calls in a single message.
Step 4: Collect and Compile
After all checks complete:
- Collect findings from all sub-skills.
- Deduplicate — when the same file:line is flagged by multiple sub-skills: keep the highest severity, merge insights, list under the most relevant category.
- Merge review comments for deduplicated findings.
- Determine verdict based on compiled findings.
Available Checks
Each check is defined in a SKILL.md file at dev-pipeline/skills/review/sub-skills/{check-name}/SKILL.md. The orchestrator reads these files and applies the criteria via Agent calls — they are NOT independently invocable skills.
| # | Check | Path | Description | When to skip |
|---|---|---|---|---|
| 1 | task-completion | dev-pipeline/skills/review/sub-skills/task-completion/SKILL.md | REQ satisfaction, test scenarios, Change Footprint, ARCH decisions | Pipeline mode only; skip if developer wants code-only review |
| 2 | code-quality | dev-pipeline/skills/review/sub-skills/code-quality/SKILL.md | Naming, complexity, TS usage, conventions, layer boundaries, imports | Pure documentation or config-only changes |
| 3 | test-coverage | dev-pipeline/skills/review/sub-skills/test-coverage/SKILL.md | Edge cases, test isolation, regression coverage, assertion quality | When developer closely observed all tests during TDD |
| 4 | performance | dev-pipeline/skills/review/sub-skills/performance/SKILL.md | Algorithm complexity, non-DB N+1, caching, memory, async parallelism | Simple CRUD, config changes, docs, tests-only |
| 5 | security | dev-pipeline/skills/review/sub-skills/security/SKILL.md | Auth/authz, injection, secrets, CORS, rate limiting, OWASP Top 10 | Internal utilities with no user-facing surface |
| 6 | error-handling | dev-pipeline/skills/review/sub-skills/error-handling/SKILL.md | Try-catch, logging, graceful degradation, resource cleanup | Docs, config-only, simple data model changes |
| 7 | documentation | dev-pipeline/skills/review/sub-skills/documentation/SKILL.md | README, API docs, JSDoc, migration guides, CLAUDE.md | Internal impl details, test files, pure refactoring |
| 8 | config-dependencies | dev-pipeline/skills/review/sub-skills/config-dependencies/SKILL.md | Env vars, new deps, CVE scanning, lock files | No config or dependency changes in diff |
| 9 | typescript-strictness | dev-pipeline/skills/review/sub-skills/typescript-strictness/SKILL.md | any, type assertions, non-null assertions, ts-ignore, generics | No TypeScript files changed |
| 10 | runtime-behavior | dev-pipeline/skills/review/sub-skills/runtime-behavior/SKILL.md | Memory leaks, event loop blocking, prototype pollution, megamorphism | No JS/TS files, docs/config-only |
| 11 | async-patterns | dev-pipeline/skills/review/sub-skills/async-patterns/SKILL.md | Unhandled rejections, Promise.all opportunities, race conditions | No async code in diff |
| 12 | react-patterns | dev-pipeline/skills/review/sub-skills/react-patterns/SKILL.md | Hooks rules, stale closures, hydration, server/client boundaries | No React/Next.js files changed |
| 13 | express-patterns | dev-pipeline/skills/review/sub-skills/express-patterns/SKILL.md | Middleware ordering, async handlers, body validation, CORS | No Express route/middleware changes |
| 14 | database-patterns | dev-pipeline/skills/review/sub-skills/database-patterns/SKILL.md | N+1 (DB), transactions, indexes, connection pools, injection | No database operations in diff |
| 15 | migration | dev-pipeline/skills/review/sub-skills/migration/SKILL.md | API contracts, destructive migrations, breaking changes, env vars | Internal-only changes, purely additive changes |
| 16 | accessibility | dev-pipeline/skills/review/sub-skills/accessibility/SKILL.md | WCAG 2.1, ARIA, keyboard nav, semantic HTML, color contrast | No frontend/UI files changed, backend-only |
Orchestrator Checklist
Track your own progress through the review process:
## Review Progress
- [x] Preflight checks passed
- [x] Diff gathered ({N} files, {M} lines)
- [x] Tech stack detected: {stack}
- [x] PR description/commit messages read (general mode)
- [x] CLAUDE.md read for project conventions
- [x] Triage proposed and developer confirmed
- [ ] Sub-skills dispatched: {list of checks}
- [ ] Results collected
- [ ] Findings deduplicated
- [ ] Report compiled
- [ ] Verdict determined
Include this checklist in the report's metadata section as "Review Process" so the developer can see the workflow was thorough.
Report Format
For general mode, save to the repository root. For pipeline mode, present inline.
General mode filenames:
- PR:
CODE-REVIEW-PR-{number}.md - Branch:
CODE-REVIEW-BRANCH-{safe-name}.md - Staged:
CODE-REVIEW-STAGED-{YYYY-MM-DD-HHMM}.md - Diff:
CODE-REVIEW-DIFF-{safe-name}.md
# Review Report
## Metadata
| Field | Value |
|-------|-------|
| **Review Mode** | {Pipeline: ARCH-slug / PR #123 / Branch / Staged / Diff} |
| **Target** | {plan path / PR URL / branch name / staged / diff file} |
| **Date** | {YYYY-MM-DD HH:MM} |
| **Tech Stack** | {detected languages, frameworks, tools} |
| **Checks Run** | {list} |
| **Checks Skipped** | {list with reasons} |
| **Files Changed** | {count} |
| **Lines Changed** | +{additions} / -{deletions} |
## Review Process
- [x] Preflight checks passed
- [x] Diff gathered ({N} files, {M} lines)
- [x] Tech stack detected
- [x] Context read (CLAUDE.md, PR description)
- [x] Triage agreed with developer
- [x] {N} sub-skills dispatched
- [x] Results collected and deduplicated
- [x] Report compiled
## Verdict: {verdict}
{2-3 sentence summary. What's good. What needs attention.}
### Finding Counts
| Category | 🔴 | 🟠 | 🟡 | 💭 | ⚠️ |
|----------|-----|-----|-----|-----|-----|
| [each check that ran] | 0 | 0 | 0 | 0 | 0 |
| **Total** | **0** | **0** | **0** | **0** | **0** |
[Each check section appears here — only for checks that were run.
Each section contains: findings table, review comments, coverage checklist,
and any check-specific extras (WCAG references, tracing notes, impact estimates, etc.)]
## Manual Checks Required
- [ ] [Thing the developer needs to verify manually]
## Prioritized Action Items
### Must Fix (🔴 Critical / 🟠 High)
### Should Address (🟡 Medium)
### Nice to Have (💭 Low)
---
*Generated by Review — {YYYY-MM-DD HH:MM}*
Verdicts
Pipeline mode:
- ✅ PASS — all checks passed, no must-fix findings. Task complete.
- ⚠️ PASS WITH FINDINGS — no must-fix issues, but should-fix or manual checks remain. Complete at developer's discretion.
- ❌ FAIL — must-fix findings or significant task completion gaps. Address and re-review.
General mode:
- ✅ APPROVE — no Critical or High issues. Ready to merge.
- ⚠️ APPROVE WITH COMMENTS — no Critical issues, minor High items. Can merge at discretion.
- ❌ REQUEST CHANGES — Critical issues, or 3+ High, or systemic patterns.
Conversation After the Report
The developer may:
- Disagree with a finding: Accept and adjust verdict if appropriate.
- Ask for clarification: Explain with specific code references.
- Re-review after fixes: See Re-review Protocol below.
- Focused re-review: "Just re-check security" → dispatch only the requested sub-skill.
Re-review Protocol
When the developer says they've addressed findings:
- Load the original report — reference its finding numbers and severities.
- Build a verification checklist from the original must-fix and should-fix findings.
- Re-read only the files that had findings. Do NOT re-run checks that already passed clean.
- Verify each finding — mark as ✅ Resolved, ⚠️ Partially resolved, or ❌ Still present.
- Check for regressions — did the fix introduce new issues in the same file?
- Produce a delta report:
## Re-review Report
**Original report:** {date/reference}
**Findings addressed:** {X of Y}
| # | Original Finding | Status | Notes |
|---|-----------------|--------|-------|
| 1 | SQL injection in auth.ts:45 | ✅ Resolved | Now uses parameterized query |
| 3 | Missing null check | ⚠️ Partial | Added check but no test for null case |
**Updated Verdict:** {new verdict}
You Must NOT
- Write or modify any code — you are read-only
- Fix issues you find — flag them in the report
- Run checks the developer agreed to skip — respect the triage decision
- Verify things you can't check — flag them as manual checks instead of guessing
- Ignore ARCH's decisions or REQ's requirements — if implementation contradicts either, flag it
- Add new requirements — only verify what the REQ, ARCH, task spec, or quality standards define
- Skip the triage conversation — always propose scope before running checks
- Hardcode review criteria in Agent prompts — each agent must read the sub-skill's SKILL.md file for its criteria
- Assume all 16 checks are needed — be selective
Important Reminders
- The triage conversation should be brief — 1-2 exchanges. You're proposing a checklist, not planning a feature.
- Every sub-skill reads CLAUDE.md (if it exists) before starting analysis. Ground all findings in the project's actual conventions, not generic best practices.
- For pipeline mode, the source chain matters: REQ → ARCH → task spec → implementation. Trace decisions back to their origin.
- Today's date should be used in review reports.
- All selected checks should be dispatched as parallel sub-skills for efficiency.
Phase 5 Gate
Before approving the PR, the developer must be able to answer yes to this question:
Would I mass-merge this without reading it? If yes, I haven't reviewed properly.
The discipline is: never approve what you haven't understood.
