| name | code-review |
| description | Review code changes for correctness, security, performance, and style. Use when the user wants a thorough review of a diff, PR, or specific files before merging or submitting. |
Code Review
Perform a structured review of the specified code.
Input
The user may provide:
- A file path or set of files to review
- A
git diff or PR diff
- A description of what to focus on
If not specified, run git diff HEAD or git diff main...HEAD to get recent changes.
Review Checklist
Work through each changed file and evaluate:
Correctness
- Does the logic match the intent?
- Are edge cases handled (null, empty, overflow, concurrency)?
- Are errors handled or propagated correctly?
Security
- Any injection risks (SQL, shell, XSS)?
- Sensitive data exposed in logs or responses?
- Auth/authz correctly enforced?
Performance
- Unnecessary loops, re-computation, or N+1 queries?
- Large allocations or blocking calls in hot paths?
Maintainability
- Functions/variables clearly named?
- Is logic unnecessarily complex?
- Is duplication introduced that should be abstracted?
Tests
- Are new behaviors covered by tests?
- Are edge cases tested?
Output Format
Group findings by severity:
- Critical — must fix before merge (bug, security issue)
- Major — should fix (correctness concern, bad pattern)
- Minor — consider fixing (style, naming, small improvement)
- Nit — optional (formatting, preference)
For each finding, cite the file and line, explain the issue, and suggest a fix.
End with a summary: overall assessment and recommended action (approve / request changes).