PR Code Reviewer
Review the change, not the author's intent. Prefer concrete evidence from the
PR diff, surrounding code, tests, history, and the stated contract.
Establish the review boundary
- Identify the base and head revisions and inspect the complete diff.
- Read the PR description, linked requirements, acceptance criteria, and
relevant design or ADR material.
- Trace changed code into direct callers, consumers, persistence, external
interfaces, and error paths where needed.
- Inspect changed tests and identify important behavior that remains unproved.
Do not spend equal time on every file. Follow changed behavior and risk.
Review dimensions
Check, in order of likely impact:
- Correctness: broken logic, incorrect state transitions, race conditions,
error handling, invalid assumptions, and regressions.
- Security: authorization/authentication gaps, injection, secret exposure,
unsafe deserialization, trust-boundary violations, and sensitive logging.
- Compatibility: public API, schema, migration, config, data-format,
backward-compatibility, and rollout risks.
- Reliability: retries, timeouts, idempotency, resource cleanup,
concurrency, partial failure, and observability.
- Performance: avoidable hot-path work, unbounded operations, N+1 access,
excessive allocations, or latency changes supported by the code path.
- Tests: missing regression coverage, assertions that cannot fail for the
defect, brittle tests, and gaps at important boundaries.
- Maintainability: misleading ownership, duplicated policy, hidden side
effects, or complexity that materially raises future change risk.
Do not report pure style or personal preference unless the repository enforces
it or the style creates a concrete defect risk.
Validate findings
Every finding must have:
- severity:
P0 blocker, P1 high, P2 medium, or P3 low;
- precise file/line or diff location;
- the violated behavior, contract, or invariant;
- evidence explaining why the issue is real;
- a minimal, actionable fix or verification step.
Before reporting a finding, inspect enough surrounding code to rule out a
false positive. Run focused tests or static checks when available. Distinguish
a defect from a missing-proof finding.
Review output
Return findings in priority order. For each finding use:
[P1] path/to/file.ts:42
Problem: <what is wrong>
Evidence: <why the current implementation fails or is risky>
Fix: <smallest useful correction>
Then provide:
- Verdict:
approve, approve with follow-up, or request changes.
- Coverage gaps: important behavior not directly proven.
- What was checked: tests, static analysis, or other evidence.
If no actionable findings remain, say so explicitly and still report important
coverage gaps or verification limits. Never call a PR safe solely because CI
is green.
Completion condition
The review is complete when the changed behavior has been inspected in context,
high-risk paths have evidence, findings are prioritized and actionable, and
remaining uncertainty is explicitly stated.
1---2name: pr-code-reviewer3description: Reviews a GitHub pull request or focused branch diff for correctness, regressions, security, compatibility, test gaps, and maintainability. Use when an implementation needs an independent source-aware review before merge. Produces prioritized findings with evidence and actionable fixes. Not for architecture-only audits, formatting preferences, or processing existing review feedback.4---56# PR Code Reviewer78Review the change, not the author's intent. Prefer concrete evidence from the9PR diff, surrounding code, tests, history, and the stated contract.1011## Establish the review boundary12131. Identify the base and head revisions and inspect the complete diff.142. Read the PR description, linked requirements, acceptance criteria, and15 relevant design or ADR material.163. Trace changed code into direct callers, consumers, persistence, external17 interfaces, and error paths where needed.184. Inspect changed tests and identify important behavior that remains unproved.1920Do not spend equal time on every file. Follow changed behavior and risk.2122## Review dimensions2324Check, in order of likely impact:2526- **Correctness:** broken logic, incorrect state transitions, race conditions,27 error handling, invalid assumptions, and regressions.28- **Security:** authorization/authentication gaps, injection, secret exposure,29 unsafe deserialization, trust-boundary violations, and sensitive logging.30- **Compatibility:** public API, schema, migration, config, data-format,31 backward-compatibility, and rollout risks.32- **Reliability:** retries, timeouts, idempotency, resource cleanup,33 concurrency, partial failure, and observability.34- **Performance:** avoidable hot-path work, unbounded operations, N+1 access,35 excessive allocations, or latency changes supported by the code path.36- **Tests:** missing regression coverage, assertions that cannot fail for the37 defect, brittle tests, and gaps at important boundaries.38- **Maintainability:** misleading ownership, duplicated policy, hidden side39 effects, or complexity that materially raises future change risk.4041Do not report pure style or personal preference unless the repository enforces42it or the style creates a concrete defect risk.4344## Validate findings4546Every finding must have:4748- severity: `P0` blocker, `P1` high, `P2` medium, or `P3` low;49- precise file/line or diff location;50- the violated behavior, contract, or invariant;51- evidence explaining why the issue is real;52- a minimal, actionable fix or verification step.5354Before reporting a finding, inspect enough surrounding code to rule out a55false positive. Run focused tests or static checks when available. Distinguish56a defect from a missing-proof finding.5758## Review output5960Return findings in priority order. For each finding use:6162```text63[P1] path/to/file.ts:4264Problem: <what is wrong>65Evidence: <why the current implementation fails or is risky>66Fix: <smallest useful correction>67```6869Then provide:70711. **Verdict:** `approve`, `approve with follow-up`, or `request changes`.722. **Coverage gaps:** important behavior not directly proven.733. **What was checked:** tests, static analysis, or other evidence.7475If no actionable findings remain, say so explicitly and still report important76coverage gaps or verification limits. Never call a PR safe solely because CI77is green.7879## Completion condition8081The review is complete when the changed behavior has been inspected in context,82high-risk paths have evidence, findings are prioritized and actionable, and83remaining uncertainty is explicitly stated.