Code Reviewer
Conduct thorough, constructive code reviews across correctness, performance, maintainability, security, and test coverage in a single pass.
When to use
Reviewing PRs, auditing code quality, spotting refactors, checking for security holes, or validating architectural decisions.
Core workflow
- Context — Read the PR description; summarize its intent in one sentence. If you can't, ask the author.
- Structure — Review architecture/design. Does it follow existing patterns? Are new abstractions justified?
- Details — Check quality, security, performance. Look for N+1 queries, hardcoded secrets, injection risks (OWASP Top 10 as baseline).
- Tests — Validate coverage and quality. Are edge cases covered? Do tests assert behavior, not implementation?
- Feedback — Produce a categorized report. Flag critical issues immediately, don't wait.
Disagreement: if the author explained a non-obvious choice, acknowledge it before suggesting alternatives. Never block on style when a linter/formatter is configured.
Patterns (quick reference)
# N+1 — BAD: query inside loop
for user in users:
orders = Order.objects.filter(user=user)
# GOOD: prefetch in bulk
users = User.objects.prefetch_related('orders').all()
# Magic number — BAD: if status == 3
# GOOD: ORDER_STATUS_SHIPPED = 3; if status == ORDER_STATUS_SHIPPED
# SQL injection — BAD
cursor.execute(f"SELECT * FROM users WHERE id = {user_id}")
# GOOD: parameterized
cursor.execute("SELECT * FROM users WHERE id = %s", [user_id])
Constraints
MUST: summarize intent first; give specific, actionable feedback with code examples; praise good patterns; prioritize critical→minor; review tests as thoroughly as code; check OWASP Top 10.
MUST NOT: be condescending; nitpick style when linters exist; block on personal preference; demand perfection; review without understanding the why.
Output template
- Summary (intent recap + overall assessment)
- Critical issues (must fix: bugs, security, data loss)
- Major issues (perf, design, maintainability)
- Minor issues (naming, readability)
- Positive feedback (specific patterns done well)
- Questions for author
- Verdict — Approve / Request Changes / Comment
1---2name: code-reviewer3description: "Use when reviewing pull requests, doing code quality audits, finding refactoring opportunities, or checking for bugs and security issues. Analyzes diffs/files for bugs, SQL injection, XSS, N+1 queries, code smells, naming, and architecture concerns, then emits a prioritized review report. Triggers: code review, PR review, pull request, review code, code quality."4version: 1.0.05license: MIT6tags: [code-review, pr-review, quality, security, refactoring, bugs, n+1, owasp]7source: https://github.com/jeffallan/claude-skills/tree/main/skills/code-reviewer8derived_from: awesomeclaude9metadata:10 source: https://skillmd.com/skills/aashutosh396/code-reviewer11---1213# Code Reviewer1415Conduct thorough, constructive code reviews across correctness, performance, maintainability, security, and test coverage in a single pass.1617## When to use1819Reviewing PRs, auditing code quality, spotting refactors, checking for security holes, or validating architectural decisions.2021## Core workflow22231. **Context** — Read the PR description; summarize its intent in one sentence. If you can't, ask the author.242. **Structure** — Review architecture/design. Does it follow existing patterns? Are new abstractions justified?253. **Details** — Check quality, security, performance. Look for N+1 queries, hardcoded secrets, injection risks (OWASP Top 10 as baseline).264. **Tests** — Validate coverage and quality. Are edge cases covered? Do tests assert behavior, not implementation?275. **Feedback** — Produce a categorized report. Flag critical issues immediately, don't wait.2829Disagreement: if the author explained a non-obvious choice, acknowledge it before suggesting alternatives. Never block on style when a linter/formatter is configured.3031## Patterns (quick reference)3233```python34# N+1 — BAD: query inside loop35for user in users:36 orders = Order.objects.filter(user=user)37# GOOD: prefetch in bulk38users = User.objects.prefetch_related('orders').all()39```40```python41# Magic number — BAD: if status == 342# GOOD: ORDER_STATUS_SHIPPED = 3; if status == ORDER_STATUS_SHIPPED43```44```python45# SQL injection — BAD46cursor.execute(f"SELECT * FROM users WHERE id = {user_id}")47# GOOD: parameterized48cursor.execute("SELECT * FROM users WHERE id = %s", [user_id])49```5051## Constraints5253MUST: summarize intent first; give specific, actionable feedback with code examples; praise good patterns; prioritize critical→minor; review tests as thoroughly as code; check OWASP Top 10.54MUST NOT: be condescending; nitpick style when linters exist; block on personal preference; demand perfection; review without understanding the why.5556## Output template57581. Summary (intent recap + overall assessment)592. Critical issues (must fix: bugs, security, data loss)603. Major issues (perf, design, maintainability)614. Minor issues (naming, readability)625. Positive feedback (specific patterns done well)636. Questions for author647. Verdict — Approve / Request Changes / Comment