AI Code Review Prompt — Get Sorted, Actionable Feedback
Most ‘review this code’ prompts return surface-level praise followed by a wall of unsorted style nits. This template — built from senior-developer review patterns — gets you structured feedback sorted by severity, with specific line numbers and code-snippet fixes you can apply directly.
The template
Replace the [bracketed] fields with your specifics. Send to any AI chat.
Review this code as a senior [language] dev would. For each issue: - Severity: critical / major / minor / nitpick - What's wrong (specific line) - Why it's wrong (the principle, not just the rule) - The fix as a code snippet Sort the output by severity. Skip stylistic-only nits unless they obscure intent. CODE: [paste your code here]
How to use it
- Replace `[language]` with your actual language (Python, JavaScript, Go, Rust, etc.) so the model picks up language-specific conventions.
- Paste your code block where it says `[paste your code here]`. Keep it focused — under 200 lines per request gets better results than dumping a whole file.
- Send to ChatGPT, Claude, or Gemini. Per developer-focused reviews, Claude tends to give the best code reviews; ChatGPT is close behind.
Example output
Here’s an example of what a quality AI returns when you run this template:
Why this prompt works
Severity sorting matters more than completeness.
Without ‘sort by severity’, the model lists issues in code order — which buries the critical bugs under nitpicks. A senior reviewer always front-loads the dangerous stuff.
Naming the four severity levels disciplines the output.
Without explicit categories, models hedge with ‘this could be better’ for everything. Forcing critical/major/minor/nitpick forces a judgment call per issue.
‘Skip stylistic nits unless they obscure intent’ kills the noise.
The default model behavior is to mention every style violation. This line tells it that linter-level feedback is unwanted unless the style actively misleads a reader.
The ‘why’ constraint stops shallow reviews.
Asking for the principle (not just the rule) forces the model to demonstrate understanding rather than parroting standard advice.
Which AI to use
Read the full comparison in ChatGPT vs Claude vs Gemini in 2026 →
Related prompts
Debug code prompt →When you have an error or bug, not just code to review.SQL query prompt →When you need to write a SQL query from an English description. All 27 prompt templates + free generator → Pick a category, fill in the blanks, copy your prompt.Frequently asked questions
Which AI is best for code review?
Per developer-focused reviews (Simon Willison’s blog, JetBrains research, Latent Space podcast), Claude is the consensus pick for code review and refactoring. ChatGPT is close behind and better for multi-step agentic debugging. Gemini lags slightly on this task.
Can I use this for code I didn’t write?
Yes — it’s actually one of the best uses. The ‘review as a senior dev would’ framing helps the AI explain unfamiliar patterns and flag bugs without being defensive about authorship.
How long can my code block be?
Under 200 lines per request gets the sharpest review. For larger files, send 100-200 line chunks separately. Models lose attention on very long inputs even when the context window technically fits.
Can the AI fix my code automatically?
Yes — add ‘Apply your fixes and return the corrected code at the end’ to the prompt. But always read the diff before accepting; AI sometimes introduces new bugs while fixing old ones.
Does this work for code review of pull requests?
It works on the code itself. For PR-level review (commit history, dependency changes, integration concerns), use a more specific prompt that includes the PR context.
Build any prompt in 30 seconds
Free tool, no signup, runs in your browser. Pick a category, fill in the blanks, copy your prompt.
Try the prompt generator → Read the full guide