| name | code-review |
| description | Comprehensive code review checking for security, performance, maintainability, and best practices |
| allowed-tools | Read, Glob, Grep |
Code Review Skill
Purpose
Perform thorough code reviews to ensure high-quality, secure, maintainable code before delivery. This skill is invoked automatically when code needs review.
When to Use This Skill
- Reviewing pull requests or code changes
- Validating implementation against requirements
- Ensuring code follows project standards
- Identifying potential bugs or issues
- Checking for security vulnerabilities
Review Process
Step 1: Understand Context
Before reviewing code:
- Read the associated technical specification
- Understand what the code is supposed to do
- Review acceptance criteria
- Check related architecture decisions (ADRs)
Step 2: Code Quality Review
Readability
Structure
Error Handling
Step 3: Security Review
Input Validation
Authentication & Authorization
Data Protection
Common Vulnerabilities
Step 4: Performance Review
Efficiency
Scalability
Database Operations
Step 5: Testing Review
Test Coverage
Test Quality
Step 6: Maintainability Review
Documentation
Consistency
Simplicity
Review Output Format
# Code Review: [Feature/PR Name]
## Summary
[Brief overview of changes reviewed]
## Overall Assessment
✅ Approved | ⚠️ Approved with Comments | ❌ Changes Requested
## Critical Issues (Must Fix)
1. **[Issue Title]** - [file:line]
- **Problem**: [Description]
- **Impact**: [Why this is critical]
- **Recommendation**: [How to fix]
2. [More critical issues...]
## High Priority Issues (Should Fix)
1. **[Issue Title]** - [file:line]
- **Problem**: [Description]
- **Recommendation**: [How to fix]
## Medium Priority Issues (Consider Fixing)
1. **[Issue Title]** - [file:line]
- **Problem**: [Description]
- **Recommendation**: [How to fix]
## Positive Aspects
- [Something done well]
- [Good practice observed]
- [Effective solution]
## Recommendations
- [General suggestion for improvement]
- [Pattern to consider]
- [Resource to check out]
## Security Assessment
✅ No security issues found | ⚠️ Minor concerns | ❌ Security issues present
[Details of any security concerns]
## Performance Assessment
✅ Performance acceptable | ⚠️ Minor concerns | ❌ Performance issues present
[Details of any performance concerns]
## Test Coverage Assessment
✅ Well tested (>80%) | ⚠️ Adequate testing (60-80%) | ❌ Insufficient testing (<60%)
[Details of test coverage]
---
**Reviewer**: [Agent name]
**Review Date**: [Date]
**Files Reviewed**: [Number] files, [Number] lines changed
Common Issues to Look For
Security Anti-Patterns
Bad:
const query = `SELECT * FROM users WHERE id = ${userId}`;
element.innerHTML = userInput;
const apiKey = "sk_live_12345";
Good:
const query = 'SELECT * FROM users WHERE id = ?';
db.query(query, [userId]);
element.textContent = userInput;
const apiKey = process.env.API_KEY;
Performance Anti-Patterns
Bad:
const users = await User.findAll();
for (const user of users) {
const posts = await Post.findByUserId(user.id);
}
for (let i = 0; i < items.length; i++) {
const total = calculateExpensiveTotal();
}
Good:
const users = await User.findAll({
include: [{ model: Post }]
});
const total = calculateExpensiveTotal();
for (let i = 0; i < items.length; i++) {
}
Code Quality Anti-Patterns
Bad:
function processOrder(order) {
validateOrder(order);
calculateTax(order);
applyDiscount(order);
processPayment(order);
sendEmail(order);
updateInventory(order);
logTransaction(order);
}
if (status === 3) {
}
Good:
function processOrder(order) {
const validatedOrder = validateOrder(order);
const pricedOrder = calculatePricing(validatedOrder);
const paidOrder = processPayment(pricedOrder);
await fulfillOrder(paidOrder);
return paidOrder;
}
const STATUS_COMPLETED = 3;
if (status === STATUS_COMPLETED) {
}
Decision Criteria
✅ Approve
- No critical or high-priority issues
- Code meets quality standards
- Tests are comprehensive
- Security reviewed
- Performance acceptable
⚠️ Approve with Comments
- Minor issues noted
- Suggestions for improvement
- Non-blocking concerns
- Low-priority fixes
❌ Request Changes
- Critical bugs present
- Security vulnerabilities
- Performance issues
- Insufficient testing
- Doesn't meet requirements
Tips for Effective Reviews
- Be specific: Point to exact lines, provide examples
- Be constructive: Explain why and how to improve
- Be balanced: Note positive aspects, not just problems
- Be consistent: Apply same standards to all code
- Be thorough: Check every aspect systematically
- Be practical: Focus on real issues, not nitpicks
Remember
Good code review catches bugs before they reach production, maintains code quality, and helps the team learn and improve.
Review as if you'll be maintaining this code - because you might be!