Code Review
Purpose
Produce a consistent, evidence-based review verdict for a pull request or diff. The skill
replaces ad-hoc "looks good to me" reviews with a repeatable pass that classifies every
finding by severity, verifies the tests actually exercise the change, and blocks merges
that violate repository standards.
When to Use / When NOT to Use
Use when:
- A reviewer is asked to "review this PR", "check this diff", or "approve before merge".
- A pre-merge audit is requested for a hotfix or release branch.
- A review is disputed and a second, standards-based opinion is needed.
Do NOT use when:
- The request is a full refactor or rewrite — use
code-quality/refactoring instead.
- The request is a security-only audit — use
security for the CWE-mapped process.
- The code cannot be built or tested at all; fix that first.
Prerequisites & Assumptions
- The diff is available (PR URL,
git diff, or pasted changes) and builds.
- CI status is visible or reproducible locally (
make check, test command from README).
- Language-specific rules come from
language-specific/golang, language-specific/java,
or language-specific/python; commit/branch rules come from git-workflow.
Step-by-Step Workflow
- Context — read the PR description, linked issue, and the diff. Restate in one
sentence what the change claims to do. If you cannot, the PR description fails review.
- Automated gates first — confirm lint, tests, and SAST pass. Never review style
findings a linter already catches; report them once and point to
static-analysis.
- Correctness pass — trace the happy path and every error branch. Classify defects
with the defect taxonomy below.
- Design pass — check boundaries, dependencies, and whether the change follows the
existing architecture. Flag new abstractions that duplicate existing ones.
- Test pass — verify new logic has tests that fail without the change; check error
paths, not just happy paths. Coverage policy lives in
testing/test-coverage.
- Security pass — apply the fast checks from
security (input validation, secrets,
authz). Deep audits are out of scope for a normal review.
- Verdict — post findings with severity and rationale, then Approve, Request
Changes, or Block. Every Blocker or Major finding must have a concrete fix suggestion.
Defect taxonomy (from the legacy audit skill)
| Category |
Examples |
| Business logic |
Off-by-one, wrong operator, violated invariant, silent truncation |
| Concurrency |
Data race, goroutine/executor leak, deadlock, wrong lock scope |
| Error handling |
Swallowed errors, broken error chains, panic on nil |
| Resources |
Leaked files/connections/rows, cleanup deferred outside the loop |
| API contract |
Breaking signature change, missing validation, wrong status code |
| Security |
Injection, missing authz check, hardcoded secret |
Severity rubric
| Severity |
Meaning |
Merge policy |
| Blocker |
Data corruption, security hole, production outage risk |
Merge blocked |
| Major |
Incorrect behavior in a realistic path, missing required tests |
Merge blocked |
| Minor |
Maintainability, naming, small gaps with a safe workaround |
Fix now or fast-follow |
| Nit |
Style and preference |
Optional, never blocks |
Enterprise Rules & Standards (MUST / SHOULD / MUST NOT)
- MUST give every finding a severity, a file/line reference, and a reason grounded in
a named standard (a rule in this repository, OWASP, or a language style guide).
- MUST verify tests exist for each new behavior and each bug fix; a fix without a
regression test is a Major finding.
- MUST state the review verdict explicitly; silence is not approval.
- SHOULD limit one review round to at most ~20 findings; defer the rest to follow-up
issues so the author can act.
- SHOULD ask questions before assuming intent when the diff is ambiguous.
- MUST NOT approve with failing CI, unresolved Blocker/Major findings, or secrets in
the diff.
- MUST NOT review only the diff hunks in isolation when a hunk changes a public
contract — read the callers.
Examples
Good review comment (actionable, severity, rationale):
[Major] api/handler.go:42 — The handler returns the raw database error text to the
client, which leaks schema details. Return a sanitized problem response per
api-design, and log the cause server-side (see observability for the log format).
Bad review comment:
LGTM, but maybe consider refactoring this a bit? Also the naming feels off.
Why it fails: no severity, no location, no standard invoked, and two vague opinions the
author cannot act on.
Checklist
Common Pitfalls
- Style archaeology — hand-commenting formatting the linter owns; waste and noise.
Route it to
static-analysis.
- Bike-shedding — debating taste instead of correctness; park it as a Nit or an issue.
- Approval inflation — "LGTM" under deadline pressure; the severity rubric exists to
keep Blockers non-negotiable.
- Diff blindness — approving a refactor without reading call sites; always check
callers of changed public symbols.
References
1---2name: code-review3description: 'Performs an enterprise-grade pull-request review covering correctness, security, design, tests, and maintainability with severity-graded findings. Trigger with phrases like "review this PR", "review these changes before merge", or "is this diff ready to ship".'4metadata:5 source: https://skillmd.com/skills/pnguyen215/code-review6---78# Code Review910## Purpose1112Produce a consistent, evidence-based review verdict for a pull request or diff. The skill13replaces ad-hoc "looks good to me" reviews with a repeatable pass that classifies every14finding by severity, verifies the tests actually exercise the change, and blocks merges15that violate repository standards.1617## When to Use / When NOT to Use1819Use when:2021- A reviewer is asked to "review this PR", "check this diff", or "approve before merge".22- A pre-merge audit is requested for a hotfix or release branch.23- A review is disputed and a second, standards-based opinion is needed.2425Do NOT use when:2627- The request is a full refactor or rewrite — use `code-quality/refactoring` instead.28- The request is a security-only audit — use `security` for the CWE-mapped process.29- The code cannot be built or tested at all; fix that first.3031## Prerequisites & Assumptions3233- The diff is available (PR URL, `git diff`, or pasted changes) and builds.34- CI status is visible or reproducible locally (`make check`, test command from README).35- Language-specific rules come from `language-specific/golang`, `language-specific/java`,36 or `language-specific/python`; commit/branch rules come from `git-workflow`.3738## Step-by-Step Workflow39401. **Context** — read the PR description, linked issue, and the diff. Restate in one41 sentence what the change claims to do. If you cannot, the PR description fails review.422. **Automated gates first** — confirm lint, tests, and SAST pass. Never review style43 findings a linter already catches; report them once and point to `static-analysis`.443. **Correctness pass** — trace the happy path and every error branch. Classify defects45 with the defect taxonomy below.464. **Design pass** — check boundaries, dependencies, and whether the change follows the47 existing architecture. Flag new abstractions that duplicate existing ones.485. **Test pass** — verify new logic has tests that fail without the change; check error49 paths, not just happy paths. Coverage policy lives in `testing/test-coverage`.506. **Security pass** — apply the fast checks from `security` (input validation, secrets,51 authz). Deep audits are out of scope for a normal review.527. **Verdict** — post findings with severity and rationale, then Approve, Request53 Changes, or Block. Every Blocker or Major finding must have a concrete fix suggestion.5455### Defect taxonomy (from the legacy audit skill)5657| Category | Examples |58| -------------- | ----------------------------------------------------------------- |59| Business logic | Off-by-one, wrong operator, violated invariant, silent truncation |60| Concurrency | Data race, goroutine/executor leak, deadlock, wrong lock scope |61| Error handling | Swallowed errors, broken error chains, panic on nil |62| Resources | Leaked files/connections/rows, cleanup deferred outside the loop |63| API contract | Breaking signature change, missing validation, wrong status code |64| Security | Injection, missing authz check, hardcoded secret |6566### Severity rubric6768| Severity | Meaning | Merge policy |69| -------- | -------------------------------------------------------------- | ---------------------- |70| Blocker | Data corruption, security hole, production outage risk | Merge blocked |71| Major | Incorrect behavior in a realistic path, missing required tests | Merge blocked |72| Minor | Maintainability, naming, small gaps with a safe workaround | Fix now or fast-follow |73| Nit | Style and preference | Optional, never blocks |7475## Enterprise Rules & Standards (MUST / SHOULD / MUST NOT)7677- **MUST** give every finding a severity, a file/line reference, and a reason grounded in78 a named standard (a rule in this repository, OWASP, or a language style guide).79- **MUST** verify tests exist for each new behavior and each bug fix; a fix without a80 regression test is a Major finding.81- **MUST** state the review verdict explicitly; silence is not approval.82- **SHOULD** limit one review round to at most ~20 findings; defer the rest to follow-up83 issues so the author can act.84- **SHOULD** ask questions before assuming intent when the diff is ambiguous.85- **MUST NOT** approve with failing CI, unresolved Blocker/Major findings, or secrets in86 the diff.87- **MUST NOT** review only the diff hunks in isolation when a hunk changes a public88 contract — read the callers.8990## Examples9192Good review comment (actionable, severity, rationale):9394```text95[Major] api/handler.go:42 — The handler returns the raw database error text to the96client, which leaks schema details. Return a sanitized problem response per97api-design, and log the cause server-side (see observability for the log format).98```99100Bad review comment:101102```text103LGTM, but maybe consider refactoring this a bit? Also the naming feels off.104```105106Why it fails: no severity, no location, no standard invoked, and two vague opinions the107author cannot act on.108109## Checklist110111- [ ] CI (lint, tests, SAST) is green, or failures are explained and unrelated.112- [ ] Every finding has severity + location + rationale.113- [ ] New behavior and error paths have tests that fail without the change.114- [ ] No secrets, tokens, or credentials in the diff.115- [ ] Public contracts (API, exported functions, schemas) are backward compatible or116 explicitly versioned (see `api-design` and `git-workflow`).117- [ ] Follow-up issues exist for accepted Minor findings.118119## Common Pitfalls120121- **Style archaeology** — hand-commenting formatting the linter owns; waste and noise.122 Route it to `static-analysis`.123- **Bike-shedding** — debating taste instead of correctness; park it as a Nit or an issue.124- **Approval inflation** — "LGTM" under deadline pressure; the severity rubric exists to125 keep Blockers non-negotiable.126- **Diff blindness** — approving a refactor without reading call sites; always check127 callers of changed public symbols.128129## References130131- Google Engineering Practices — Code Review Developer Guide: https://google.github.io/eng-practices/review/132- OWASP Code Review Guide: https://owasp.org/www-project-code-review-guide/133- Conventional Comments: https://conventionalcomments.org/