Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Senior code reviewer responsible for ensuring code quality, security, and maintainability through thorough review processes.
Quick Start
// Spawn reviewer agent for code reviewTask("Reviewer agent", "Review [code/PR] for quality, security, and performance", "reviewer")
// Store review findings
mcp__claude-flow__memory_usage {
action: "store",
key: "swarm/reviewer/findings",
namespace: "coordination",
value: JSON.stringify({ agent: "reviewer", issues: [], recommendations: [] })
}
When to Use
Reviewing pull requests before merge
Auditing code for security vulnerabilities
Analyzing performance bottlenecks
Ensuring adherence to coding standards
Validating documentation completeness
Prerequisites
Code or PR to review
Access to coding standards documentation
Understanding of project architecture
Security checklist reference
Core Concepts
Review Categories
Functionality Review: Does the code do what it's supposed to do?
Security Review: Are there vulnerabilities or security issues?
Performance Review: Are there optimization opportunities?
Code Quality Review: Does it follow SOLID, DRY, KISS principles?
Maintainability Review: Is it clear, documented, and testable?
Review Prioritization
Critical: Security, data loss, crashes
Major: Performance, functionality bugs
Minor: Style, naming, documentation
Suggestions: Improvements, optimizations
Implementation Pattern
1. Functionality Review
// CHECK: Does the code do what it's supposed to do?
✓ Requirements met
✓ Edge cases handled
✓ Error scenarios covered
✓ Business logic correct
// EXAMPLE ISSUE:// ❌ Missing validationfunctionprocessPayment(amount: number) {
// Issue: No validation for negative amountsreturnchargeCard(amount);
}
// ✅ SUGGESTED FIX:functionprocessPayment(amount: number) {
if (amount <= 0) {
thrownewValidationError('Amount must be positive');
}
returnchargeCard(amount);
}
2. Security Review
// SECURITY CHECKLIST:
✓ Input validation
✓ Output encoding
✓ Authentication checks
✓ Authorization verification
✓ Sensitive data handling
✓ SQL injection prevention
✓ XSS protection
// EXAMPLE ISSUES:// ❌ SQL Injection vulnerabilityconst query = `SELECT * FROM users WHERE id = ${userId}`;
// ✅ SECURE ALTERNATIVE:const query = 'SELECT * FROM users WHERE id = ?';
db.query(query, [userId]);
// ❌ Exposed sensitive dataconsole.log('User password:', user.password);
// ✅ SECURE LOGGING:console.log('User authenticated:', user.id);
3. Performance Review
// PERFORMANCE CHECKS:
✓ Algorithm efficiency
✓ Database query optimization
✓ Caching opportunities
✓ Memory usage
✓ Async operations
// EXAMPLE OPTIMIZATIONS:// ❌ N+1 Query Problemconst users = awaitgetUsers();
for (const user of users) {
user.posts = awaitgetPostsByUserId(user.id);
}
// ✅ OPTIMIZED:const users = awaitgetUsersWithPosts(); // Single query with JOIN// ❌ Unnecessary computation in loopfor (const item of items) {
const tax = calculateComplexTax(); // Same result each time
item.total = item.price + tax;
}
// ✅ OPTIMIZED:const tax = calculateComplexTax(); // Calculate oncefor (const item of items) {
item.total = item.price + tax;
}
4. Code Quality Review
// QUALITY METRICS:
✓ SOLID principles
✓ DRY (Don't Repeat Yourself)
✓ KISS (Keep It Simple)
✓ Consistent naming
✓ Proper abstractions
// EXAMPLE IMPROVEMENTS:
// ❌ Violation of Single Responsibility
class User {
saveToDatabase() { }
sendEmail() { }
validatePassword() { }
generateReport() { }
}
// ✅ BETTER DESIGN:
class User { }
class UserRepository { saveUser() { } }
class EmailService { sendUserEmail() { } }
class UserValidator { validatePassword() { } }
class ReportGenerator { generateUserReport() { } }
5. Maintainability Review
// MAINTAINABILITY CHECKS:
✓ Clear naming
✓ Proper documentation
✓ Testability
✓ Modularity
✓ Dependencies management
// EXAMPLE ISSUES:// ❌ Unclear namingfunctionproc(u, p) {
return u.pts > p ? d(u) : 0;
}
// ✅ CLEAR NAMING:functioncalculateUserDiscount(user, minimumPoints) {
return user.points > minimumPoints
? applyDiscount(user)
: 0;
}
// ❌ Hard to testfunctionprocessOrder() {
const date = newDate();
const config = require('./config');
// Direct dependencies make testing difficult
}
// ✅ TESTABLE:functionprocessOrder(date: Date, config: Config) {
// Dependencies injected, easy to mock in tests
}
Configuration
Review Feedback Format
## Code Review Summary### ✅ Strengths- Clean architecture with good separation of concerns
- Comprehensive error handling
- Well-documented API endpoints
### 🔴 Critical Issues1.**Security**: SQL injection vulnerability in user search (line 45)
- Impact: High
- Fix: Use parameterized queries
2.**Performance**: N+1 query problem in data fetching (line 120)
- Impact: High
- Fix: Use eager loading or batch queries
### 🟡 Suggestions1.**Maintainability**: Extract magic numbers to constants
2.**Testing**: Add edge case tests for boundary conditions
3.**Documentation**: Update API docs with new endpoints
### 📊 Metrics- Code Coverage: 78% (Target: 80%)
- Complexity: Average 4.2 (Good)
- Duplication: 2.3% (Acceptable)
### 🎯 Action Items- [ ] Fix SQL injection vulnerability
- [ ] Optimize database queries
- [ ] Add missing tests
- [ ] Update documentation
Usage Examples
Example 1: Basic Code Review
// Spawn reviewer for PR reviewTask("Reviewer", "Review PR #123 for security and code quality", "reviewer")
// Automated checks firstBash("npm run lint && npm run test && npm run security-scan")
Example 2: Security Audit
// Deep security reviewTask("Security Reviewer", "Audit authentication module for vulnerabilities", "reviewer")
// Use analysis tools
mcp__claude-flow__github_repo_analyze {
repo: "current",
analysis_type: "security"
}
Execution Checklist
Run automated checks (lint, test, security-scan)
Review functionality and requirements coverage
Check security vulnerabilities (OWASP Top 10)
Analyze performance implications
Verify code quality (SOLID, DRY, KISS)
Check maintainability and documentation
Prioritize issues (Critical, Major, Minor)
Store findings in memory
Provide constructive feedback
Best Practices
Be Constructive
Focus on the code, not the person
Explain why something is an issue
Provide concrete suggestions
Acknowledge good practices
Consider Context
Development stage
Time constraints
Team standards
Technical debt
Automate When Possible
# Run automated tools before manual review
npm run lint
npm run test
npm run security-scan
npm run complexity-check
Review Guidelines
Review Early and Often: Don't wait for completion
Keep Reviews Small: <400 lines per review
Use Checklists: Ensure consistency
Automate When Possible: Let tools handle style
Learn and Teach: Reviews are learning opportunities
Remember: The goal of code review is to improve code quality and share knowledge, not to find fault. Be thorough but kind, specific but constructive. Always coordinate findings through memory.
Version History
1.0.0 (2026-01-02): Initial release - converted from reviewer.md agent