Review protocol
Automated code review via Claude Code GitHub Action. Structured JSON findings against project standards.
Review protocol
Purpose: Defines the automated code review process powered by the Claude Code GitHub Action. Every PR is reviewed against project standards and outputs structured JSON findings with formal approve/request_changes decisions.
Quick reference:
- Automated — GitHub Action on every PR with formal approve/request_changes
- Critical —
anytypes,console.log, auth bypass, SQL injection, missing RLS, CLAUDE.md violations- Warning — Perf issues, missing tests, over-engineering
- Self-fix loop — Max 3 rounds, then flag for manual review
- Pre-PR — Run
pnpm type-check && pnpm lint && pnpm test:run && pnpm buildlocally first
Input
You receive:
- Diff — the full git diff of the PR
- PR metadata — title, body, author
- CLAUDE.md — project-specific rules (if present in the repo)
Rules by file type
TypeScript (*.ts)
- No
anytypes — Critical severity - No
console.log— Use Axiom/Sentry logging - No native
Date— Use Luxon (DateTime,Duration,Interval) - Zod validation — Required at system boundaries (API routes, form submissions, external data)
- TODO references — Every TODO must reference a Linear issue (
// TODO [RAJ-XXX]: description)
React components (*.tsx)
- All TypeScript rules above, plus:
- Naming conventions — PascalCase components, camelCase hooks (with
useprefix), kebab-case files - Layout mounting — Layout components (headers, sidebars, nav) must be mounted in a parent layout
- Unmounted components are dead code
- Accessibility (WCAG AA) — Color contrast ≥ 4.5:1, all interactive elements keyboard-navigable, ARIA labels on non-text controls
- See
standards/reference/accessibility.mdfor full requirements
- See
API routes (app/api/**)
- Auth checks — Required (Clerk middleware or explicit
auth()call) - RLS policies — Required for Supabase queries
- Zod validation — Required on all request bodies
- Activity logging — Required for user-facing actions
Database (prisma/**)
- Reversible migrations — Preferred over destructive changes
- RLS policies — Required for multi-tenant tables
- Indexes — Required on frequently queried columns
Shared utilities (lib/**)
- No
anytypes - Parameterized queries — No string interpolation in SQL
- No N+1 patterns — Prefer batch fetches
Markdown / standards (standards/**, CLAUDE.md)
- Internal references — Must resolve (no broken links)
- Counts in CLAUDE.md — Must match actual files
GitHub Actions (*.yml in .github/workflows/)
- GITHUB_TOKEN events — Don't trigger other workflows; verify event chains will actually fire
- Permissions — Must be minimal (principle of least privilege)
- No secret exposure — Never
echo $SECRETin logs - Concurrency groups — Verify they use correct event payload fields
- Self-triggering workflows — Check for infinite loop potential
Prompt construction (any code that builds LLM prompts)
- Content separation — User-controlled content must be separated from system instructions
- Permission flags — Never use
--dangerously-skip-permissionswhen only output is needed (no file access) - Untrusted content — Validate and sanitize untrusted content boundaries
Shell scripts / CI steps
- Unquoted variables — Check for word splitting issues
- Error handling — Verify
set -eand|| fallbacks - Git staging — Prefer
git add -uor explicit files overgit add -A
Severity levels
- Critical — Security vulnerabilities, data loss, auth bypass,
anytype, CLAUDE.md violations, missing RLS policies - Warning — Performance issues, missing tests, over-engineering, unnecessary complexity
- Info — Style, naming, minor improvements
What NOT to flag
- Test files — Unless security-relevant
- Lock files —
pnpm-lock.yaml,package-lock.json - Auto-generated files
- Formatting-only changes
.claude/directory — Agent config, settings- Build artifacts — Files in
node_modules/,dist/,.next/
Output format
Respond with ONLY this JSON. No markdown fences, no explanation, no preamble.
{ "findings": [ { "file": "path/to/file.ts", "line": 42, "severity": "critical|warning|info", "rule": "short rule name", "message": "What's wrong and how to fix it" } ], "summary": "One-paragraph summary of the review", "approved": true }
Set approved: false if there are any Critical or Warning findings.
Set approved: true only when there are zero Critical/Warning findings (Info-only is acceptable).
Review principles
- Be direct — flag the issue, suggest the fix, move on
- Flag over-engineering — unnecessary abstractions, premature generalization, feature flags for one-off changes
- CLAUDE.md is law — any violation of project-specific CLAUDE.md rules is Critical
- Security first — auth, injection, XSS, and OWASP top 10 are always Critical
- Don't nitpick — if the code works, is readable, and follows the rules, approve it
How it works
This protocol powers automated PR review via a GitHub Action (.github/workflows/claude-review.yml):
- Push a PR — The Action runs automatically on PR creation and updates
- Claude reviews — Reads the diff + this protocol, outputs findings as JSON
- Formal review posted — Findings become inline PR comments with approve/request_changes
- Self-fix loop — If changes are requested, Claude auto-fixes and pushes (max 3 rounds)
- Standards reflection — After a clean review, Claude analyzes patterns across recent PRs and suggests protocol updates
Addressing findings
- Agree — Fix the issue, push. The Action re-reviews automatically.
- Disagree — Reply to the inline comment with rationale. Admin can dismiss the review.
- Won't fix — Reply explaining why. The review can be dismissed by an admin.
Escalation
If findings can't be resolved after 3 auto-fix rounds:
- Post comment — The Action flags manual review needed
- Tag @Ameet — On the PR if a human decision is required
- Add
awaiting-inputlabel — To the Linear issue if blocked
Pre-PR verification
Before pushing a PR, always run local verification:
pnpm type-check && pnpm lint && pnpm test:run && pnpm build
Don't rely on the reviewer to catch type errors or lint failures — those should be clean before the PR is created.
Rules
- All PRs get reviewed — The GitHub Action reviews every PR automatically
- Pre-PR verification required — Run type-check, lint, test, build before pushing
- Address all findings — Don't merge with unresolved Critical/Warning findings unless an admin dismisses the review
- No silent bypasses — If you dismiss a finding, explain why in the PR comment
- Formal review blocks merge — The Action posts a formal GitHub review that serves as a required status check
Related standards
standards/core/sdlc.md— Development lifecyclestandards/core/linear-lifecycle.md— Linear statuses, labels, and comment protocol.github/workflows/claude-review.yml— GitHub Action that runs this protocol
Review Protocol v4.0 (Claude Code) — March 2026