Code Review Skill
Use this skill when performing code reviews that require thorough analysis beyond automated checks.
When to Use
- Reviewing uncommitted changes before commit
- Pull request reviews
- Historical commit or branch inspection
- Interactive code review sessions
- Reviews needing operational verification (build/test status)
Prerequisites
- Access to the code to review (diff, PR, commit, or working tree)
- Build toolchain for the project (for STEP 0 verification)
- Test suite available (if tests don't exist, note that as a finding)
Table of Contents
Review Process
STEP 0 - Operational Verification (MANDATORY)
Before analyzing code, verify it actually works:
- Load the code to review — uncommitted diff, PR, commit, or pasted code. Inspect the changes using the project's version control system (AGENTS.md governs which VCS to use).
- If no changes are present, report "Nothing to review" and stop.
- Identify project type (look at Cargo.toml, package.json, pyproject.toml, go.mod, etc.)
- Run build: see project commands first, if not found then
cargo build, npm run build, go build ./..., etc.
- Run tests: see project commands first, if not found then
cargo test, npm test, pytest, go test ./..., etc.
- If build or tests fail: log as Critical Issue #1 with the exact error and stop.
If the build environment is not available (e.g. reviewing a PR remotely), note this limitation and proceed with analysis only.
Scope Summary
Summarize scope:
- Files touched
- Rough size of changes
- Key areas impacted
Review Axes (Cover All)
Review along these 4 axes, always addressing each even if "no issues found":
1. Bugs & Correctness
- Logic errors
- Edge cases
- Error handling
- Test coverage
2. Security
- Secrets exposure
- Injection risks (SQL, command, XSS)
- Authz/authn pitfalls
- Unsafe shell usage
- Unsafe file permissions
- Supply-chain risks
3. Quality & Maintainability
- Clarity and naming
- API boundaries
- Code duplication
- Types/contracts
- Performance footguns (avoid micro-nitpicks)
4. Compliance (Project Rules)
- Project style and naming conventions
- No secrets or credentials in committed files
- Shell and scripting conventions (e.g. nix/shell style)
- Commit message quality and conventions when relevant
Issue Format
For each issue found:
- Concise title - Clear problem statement
- Severity - low/med/high
- Confidence - low/med/high
- Explanation - Why it matters
- Concrete fix - Code snippet or exact change suggestion
Output Structure
## Scope
[Files touched, size, key areas]
## Positives (1-3)
- [Good thing about the code]
## Findings
### Bugs & Correctness
- **[SEVERITY/CONFIDENCE]** Title
- Explanation
- Fix: [code suggestion]
### Security
- **[SEVERITY/CONFIDENCE]** Title
- Explanation
- Fix: [code suggestion]
### Quality & Maintainability
- **[SEVERITY/CONFIDENCE]** Title
- Explanation
- Fix: [code suggestion]
### Compliance
- **[SEVERITY/CONFIDENCE]** Title
- Explanation
- Fix: [code suggestion]
## Suggested Follow-ups
- [Tests to run]
- [Checks to perform]
- [Verification steps]
Constraints
- Read-only mode — do not edit files during review
- Avoid nitpicks unless they prevent bugs or reduce maintenance cost
- Every issue must be actionable with a concrete fix
Example Usage
User: "Review my changes before I commit"
→ Load skill, run STEP 0 to verify build and tests, inspect the diff, review across all 4 axes, output structured findings with severity and concrete fixes.
User: "Review this PR — tests pass but something feels off"
→ Skip STEP 0 build verification (already passing in CI), focus on Security and Quality axes, look for subtle logic errors or API boundary issues.
1---2name: code-review3description: Use when reviewing code changes (diffs, PRs, or commits) that need operational verification, project-rule checks, and actionable findings across bugs, security, quality, and compliance.4---56# Code Review Skill78Use this skill when performing code reviews that require thorough analysis beyond automated checks.910## When to Use1112- Reviewing uncommitted changes before commit13- Pull request reviews14- Historical commit or branch inspection15- Interactive code review sessions16- Reviews needing operational verification (build/test status)1718## Prerequisites1920- Access to the code to review (diff, PR, commit, or working tree)21- Build toolchain for the project (for STEP 0 verification)22- Test suite available (if tests don't exist, note that as a finding)2324## Table of Contents2526- [When to Use](#when-to-use)27- [Review Process](#review-process)28- [Constraints](#constraints)29- [Example Usage](#example-usage)3031## Review Process3233### STEP 0 - Operational Verification (MANDATORY)3435Before analyzing code, verify it actually works:36371. Load the code to review — uncommitted diff, PR, commit, or pasted code. Inspect the changes using the project's version control system (AGENTS.md governs which VCS to use).382. If no changes are present, report "Nothing to review" and stop.393. Identify project type (look at Cargo.toml, package.json, pyproject.toml, go.mod, etc.)404. Run build: see project commands first, if not found then `cargo build`, `npm run build`, `go build ./...`, etc.415. Run tests: see project commands first, if not found then `cargo test`, `npm test`, `pytest`, `go test ./...`, etc.426. **If build or tests fail:** log as Critical Issue #1 with the exact error and stop.4344If the build environment is not available (e.g. reviewing a PR remotely), note this limitation and proceed with analysis only.4546### Scope Summary4748Summarize scope:49501. Files touched512. Rough size of changes523. Key areas impacted5354### Review Axes (Cover All)5556Review along these 4 axes, always addressing each even if "no issues found":5758**1. Bugs & Correctness**59- Logic errors60- Edge cases61- Error handling62- Test coverage6364**2. Security**65- Secrets exposure66- Injection risks (SQL, command, XSS)67- Authz/authn pitfalls68- Unsafe shell usage69- Unsafe file permissions70- Supply-chain risks7172**3. Quality & Maintainability**73- Clarity and naming74- API boundaries75- Code duplication76- Types/contracts77- Performance footguns (avoid micro-nitpicks)7879**4. Compliance (Project Rules)**80- Project style and naming conventions81- No secrets or credentials in committed files82- Shell and scripting conventions (e.g. nix/shell style)83- Commit message quality and conventions when relevant8485### Issue Format8687For each issue found:88891. **Concise title** - Clear problem statement902. **Severity** - low/med/high913. **Confidence** - low/med/high924. **Explanation** - Why it matters935. **Concrete fix** - Code snippet or exact change suggestion9495### Output Structure9697```98## Scope99[Files touched, size, key areas]100101## Positives (1-3)102- [Good thing about the code]103104## Findings105106### Bugs & Correctness107- **[SEVERITY/CONFIDENCE]** Title108 - Explanation109 - Fix: [code suggestion]110111### Security112- **[SEVERITY/CONFIDENCE]** Title113 - Explanation114 - Fix: [code suggestion]115116### Quality & Maintainability117- **[SEVERITY/CONFIDENCE]** Title118 - Explanation119 - Fix: [code suggestion]120121### Compliance122- **[SEVERITY/CONFIDENCE]** Title123 - Explanation124 - Fix: [code suggestion]125126## Suggested Follow-ups127- [Tests to run]128- [Checks to perform]129- [Verification steps]130```131132## Constraints133134- Read-only mode — do not edit files during review135- Avoid nitpicks unless they prevent bugs or reduce maintenance cost136- Every issue must be actionable with a concrete fix137138## Example Usage139140User: "Review my changes before I commit"141→ Load skill, run STEP 0 to verify build and tests, inspect the diff, review across all 4 axes, output structured findings with severity and concrete fixes.142143User: "Review this PR — tests pass but something feels off"144→ Skip STEP 0 build verification (already passing in CI), focus on Security and Quality axes, look for subtle logic errors or API boundary issues.