Code Review Assistant
Get a thorough, senior-level code review with actionable feedback on quality, security, performance, and best practices.
Prompt Template
You are a principal software engineer conducting a thorough code review. Review the following code with the rigor of a senior developer at a top tech company. **Language/Framework:** [e.g., TypeScript/React, Python/FastAPI] **Context:** [what this code does, where it fits in the system] **PR Description:** [what changed and why] ``` [paste your code here] ``` Review for: 1. **Correctness** — bugs, edge cases, off-by-one errors, race conditions 2. **Security** — injection vulnerabilities, auth issues, data exposure, input validation 3. **Performance** — N+1 queries, unnecessary re-renders, memory leaks, algorithmic complexity 4. **Readability** — naming, structure, comments (or lack thereof), cognitive complexity 5. **Best Practices** — SOLID principles, DRY, error handling, testing considerations 6. **Architecture** — does this fit the broader system design? any coupling concerns? Format your review as: - 🔴 **Critical** — must fix before merge - 🟡 **Suggestion** — would improve quality - 🟢 **Nitpick** — optional style preference - 💡 **Note** — educational context or explanation For each finding, provide: - The specific line/section - What the issue is - Why it matters - A concrete code fix or alternative End with an overall assessment: Approve / Request Changes / Needs Discussion.
Example Output
Code Review: UserAuthService.ts
🔴 Critical
Line 23: SQL Injection vulnerability
// Current
const user = await db.query(`SELECT * FROM users WHERE email = '${email}'`);
// Fixed
const user = await db.query('SELECT * FROM users WHERE email = $1', [email]);
User input is directly interpolated into the SQL query. This allows an attacker to execute arbitrary SQL. Always use parameterized queries.
🟡 Suggestion
Line 45: Missing error handling
The `bcrypt.compare()` call isn't wrapped in try/catch. If bcrypt throws (corrupted hash), the entire auth flow crashes with an unhandled exception.
Overall: Request Changes
The SQL injection issue is a showstopper. The auth logic is sound otherwise, but please address the critical and suggestion items before merging.
Tips for Best Results
- 💡Include the full file — AI can catch issues in the interaction between functions
- 💡Mention the framework version, as best practices change between versions
- 💡If it's a large PR, break it into logical chunks and review each separately
- 💡Ask for test suggestions along with the review for maximum value
Frequently Asked Questions
What is the Code Review Assistant prompt?
Get a thorough, senior-level code review with actionable feedback on quality, security, performance, and best practices. It's a free ChatGPT prompt template from our Coding collection — copy it, fill in the bracketed variables, and paste it into your AI tool.
Which AI tools work with this prompt?
It's written and tested for ChatGPT, Claude and Gemini. Any AI assistant that accepts free-form text prompts will handle it well.
How do I customize this ChatGPT prompt?
Replace the bracketed variables — such as [e.g., TypeScript/React, Python/FastAPI], [what changed and why], [paste your code here] — with your own details before running it. Include the full file — AI can catch issues in the interaction between functions
Is this prompt free to use?
Yes. Every prompt on PromptAtlas is free to copy, customize, and use — no signup required.
Related Prompts
Python FileNotFoundError Debugging Prompt
Debug Python FileNotFoundError from the exact traceback, resolved path, working directory, filesystem context, deployment environment, and failing operation.
Python ZeroDivisionError Debugging Prompt
Debug Python ZeroDivisionError from the exact traceback, operand values and types, data path, numeric semantics, runtime context, and failing input.
Python IndentationError Debugging Prompt
Debug Python IndentationError from the exact parser message, whitespace, block structure, source bytes, formatter settings, and runtime version.
Python SyntaxError: Invalid Syntax Debugging Prompt
Debug Python SyntaxError invalid syntax from the exact parser location, surrounding tokens, Python version, generated code, execution context, and minimal reproduction.
Python AttributeError: Object Has No Attribute Debugging Prompt
Debug Python AttributeError from the exact traceback, runtime object type, attribute contract, construction path, version, imports, and minimal reproduction.
Python UnboundLocalError Debugging Prompt
Debug Python UnboundLocalError from the exact traceback, binding scope, assignments, branches, closures, imports, runtime path, and minimal reproduction.