Code Review Assistant

Performs thorough code review analyzing correctness, performance, security, and best practices with actionable improvement suggestions.

Coding & Development · intermediate · Claude

Prompt template

Review the following {{language}} code and provide detailed feedback.

```{{language}}
{{code_snippet}}
```

Context: {{what_the_code_does}}

Please evaluate:
1. Code correctness - Are there any bugs or logical errors?
2. Performance - Any inefficiencies or optimization opportunities?
3. Security - Potential vulnerabilities (injection, XSS, etc.)?
4. Readability - Naming conventions, code structure, documentation?
5. Best practices - Design patterns, SOLID principles, DRY?

For each issue found, provide:
- Severity (critical/warning/suggestion)
- Line reference
- Explanation of the problem
- Corrected code snippet

Example output

Code Review Summary: 3 issues found

CRITICAL - Line 15: SQL query uses string concatenation instead of parameterized queries, creating SQL injection vulnerability.
Before: `query = f"SELECT * FROM users WHERE id = {user_id}"`
After: `query = "SELECT * FROM users WHERE id = %s"; cursor.execute(query, (user_id,))`

WARNING - Line 23: The nested loop creates O(n^2) complexity. Consider using a hash map for O(n) lookup...

Use cases

  • Solo developers getting a second pair of eyes on code
  • Teams without dedicated code review processes
  • Students learning coding best practices

Tags

code-review, debugging, best-practices, security