Code Reviewer
Perform thorough code reviews with actionable feedback using this comprehensive
prompt template.
The Prompt
1You are an experienced senior developer conducting a code review. Please review the following code and provide detailed feedback.
2
3Code to review:
4```[LANGUAGE]
5[CODE]
6```
7
8Review criteria:
91. **Code Quality**
10 - Readability and clarity
11 - Naming conventions
12 - Code organization and structure
13
142. **Best Practices**
15 - Language-specific idioms and patterns
16 - SOLID principles adherence
17 - DRY (Don't Repeat Yourself) violations
18
193. **Performance**
20 - Time complexity analysis
21 - Memory usage
22 - Potential bottlenecks
23
244. **Security**
25 - Vulnerability assessment
26 - Input validation
27 - Authentication/authorization issues
28
295. **Error Handling**
30 - Exception handling
31 - Edge cases
32 - Error messages and logging
33
346. **Testing**
35 - Test coverage suggestions
36 - Edge cases to test
37 - Testing best practices
38
39Please provide:
40- A summary of the overall code quality
41- Specific issues with severity levels (Critical/High/Medium/Low)
42- Code suggestions with examples
43- Positive feedback on what was done well
Variables to Customize
[LANGUAGE]
: Programming language (e.g., JavaScript, Python, Java)
[CODE]
: The actual code to be reviewed
- Additional context about the project, framework, or specific requirements
Example Usage
1You are an experienced senior developer conducting a code review. Please review the following code and provide detailed feedback.
2
3Code to review:
4```javascript
5async function getUserData(userId) {
6 const response = await fetch(`/api/users/${userId}`);
7 const data = await response.json();
8 return data;
9}
10
11function processUserData(users) {
12 let result = [];
13 for (let i = 0; i < users.length; i++) {
14 if (users[i].age > 18) {
15 result.push(users[i].name);
16 }
17 }
18 return result;
19}
20```
21
22Review criteria:
23[... rest of the criteria ...]
Tips for Best Results
- Provide Context: Include information about the project, its purpose, and
any specific requirements
- Specify Standards: Mention any coding standards or style guides your team
follows
- Focus Areas: Highlight specific areas of concern if needed
- Include Dependencies: Mention relevant frameworks or libraries being used
Common Variations
Security-Focused Review
1Focus primarily on security vulnerabilities:
2- SQL injection risks
3- XSS vulnerabilities
4- Authentication bypasses
5- Sensitive data exposure
6- OWASP Top 10 compliance
Performance Review
1Emphasize performance optimization:
2- Algorithm efficiency
3- Database query optimization
4- Caching opportunities
5- Memory leaks
6- Async/await optimization
Refactoring Review
1Focus on code improvement:
2- Design pattern opportunities
3- Code duplication removal
4- Method extraction suggestions
5- Class/module reorganization
6- Dependency injection improvements
Advanced Usage
With Specific Framework Context
1Additional context:
2- Framework: React 18
3- State management: Redux Toolkit
4- Testing framework: Jest + React Testing Library
5- Build tool: Vite
6- TypeScript strict mode enabled
With Team Standards
1Our team standards:
2- Maximum function length: 20 lines
3- Maximum file length: 200 lines
4- Required JSDoc comments for public methods
5- Prefer functional components over class components
6- Use TypeScript strict null checks
Tags
#code-review
#programming
#best-practices
#quality-assurance
#technical