- Two rules from Google's code review guide worth building into your prompts
- Prompts for a first-pass review
- Prompts for security and reliability
- Prompts for readability and maintainability
- Prompts for tests
- Prompts to help you write review comments
- Prompts for reviewing your own code first
- How to get better AI code reviews
- My advice on AI prompts for code review
- Frequently asked questions
Useful AI prompts for code review give the tool the diff, what the change is meant to do and what to look for, then ask for findings ranked by severity with line references. Borrow Google's standard from its engineering practices guide: approve a change once it definitely improves overall code health, even if it isn't perfect.
I'm not a full-time developer, but I've worked with enough of them to know where AI code review helps and where it gets in the way. It's brilliant at a fast first pass: spotting missing error handling, unclear names, untested edge cases. It's poor at knowing your system's history or why a strange-looking choice was deliberate. The prompts below work with ChatGPT, Claude, Gemini or Copilot, and they're written to get specific, checkable findings rather than a wall of generic advice.
Two rules from Google's code review guide worth building into your prompts
Google publishes the engineering practices its teams use for code review. Two points change how you should use AI in the process:
| Google's guidance | How to use it with AI |
|---|---|
| Reviewers should favour approving a change once it definitely improves overall code health, even if it isn't perfect | Ask the AI to separate must-fix issues from nice-to-have polish, so you don't block good changes on nitpicks |
| One business day is the maximum time it should take to respond to a review request | Use an AI first pass to speed up your own review, not to replace it |
The catch: AI reviewers flag everything with equal confidence. OpenAI itself says ChatGPT can give overconfident answers, so the most useful prompts make the tool rank its findings and give a confidence level for each.
Prompts for a first-pass review
Paste the diff or the file and tell the tool what the change is for.
Copy this prompt
Review this diff. The change is meant to [purpose]. List problems ranked as must-fix, should-fix or optional, with the line number and a one-sentence reason for each. [paste diff]
Copy this prompt
Read this function and tell me what it does in plain language, then list any behaviour that looks unintended. [paste code]
Copy this prompt
Check this change for bugs only: logic errors, off-by-one mistakes, null or empty inputs, and wrong conditions. Ignore style.
Copy this prompt
What edge cases does this code not handle? Give an example input for each that would break it.
Copy this prompt
Summarise this pull request for a reviewer in five bullet points: what changed, why, risk areas and what to test.
Prompts for security and reliability
Point the tool at the risks that hurt most when they slip through.
Copy this prompt
Review this code for security issues: unvalidated input, injection risks, secrets in code, unsafe deserialisation and permission checks. Explain each finding and how to fix it.
Copy this prompt
Look at the error handling in this code. Where could a failure be silently swallowed or leave data half-written?
Copy this prompt
Check this database code for queries built from user input and suggest a parameterised version.
Copy this prompt
Does this code behave safely if the network call times out or returns an error? Walk through what happens.
Prompts for readability and maintainability
For changes that work but will be painful to live with.
Copy this prompt
Suggest clearer names for the variables and functions in this code, with a short reason for each change.
Copy this prompt
Which parts of this code would a new team member struggle to understand? Suggest comments or small refactors.
Copy this prompt
Is there duplicated logic in this change that could be pulled into one function? Show me the smallest refactor.
Copy this prompt
Point out anything in this code that goes against [language or framework] conventions, and say how much it matters.
Work with meWant AI doing the heavy lifting in your marketing?
I build the systems that handle the boring 80 percent, so you get your week back. Done properly, with the human kept in.
Prompts for tests
A review isn't finished until you know how the change is tested.
Copy this prompt
Write unit tests for this function covering the normal case, edge cases and error cases, using [testing framework].
Copy this prompt
Look at these tests and the code they cover. What important behaviour isn't tested?
Copy this prompt
Suggest a short manual test plan for this change that a reviewer could follow in a few minutes.
Prompts to help you write review comments
Kind, specific comments get changes made faster.
Copy this prompt
Rewrite this review comment so it's clear, specific and friendly, and suggests a fix: [paste comment].
Copy this prompt
Turn these findings into review comments, marking which are blocking and which are optional suggestions.
Copy this prompt
Explain why this pattern is risky in a way a junior developer would learn from, without sounding harsh.
Copy this prompt
Draft a short summary comment approving this change, noting the optional improvements for a follow-up.
Prompts for reviewing your own code first
Catch the obvious things before a colleague does.
Copy this prompt
Before I open a pull request, review my changes for leftover debug code, commented-out blocks and TODOs.
Copy this prompt
Check my commit message against this change and suggest a clearer one that says what and why.
Copy this prompt
Pretend you're a strict senior reviewer on my team. What three questions would you ask about this change?
How to get better AI code reviews
- Say what the change is for. Without intent, the AI reviews the code it imagines, not the one you wrote.
- Ask for findings ranked by severity, with line numbers, so you can act on them quickly.
- Keep secrets, keys and customer data out of anything you paste into an outside tool.
- Run the code and the tests; never merge on the strength of an AI review alone.
- Follow your team's rules on which AI tools can see your code.
If you work in the terminal, my guides on using Claude Code and using OpenAI Codex show how to run reviews right next to your repository. For automated checks alongside AI review, see my piece on AI-driven static analysis tools.
My advice on AI prompts for code review
Use AI as a fast, tireless first reviewer and keep a human as the last one. Give it the intent, ask for ranked findings and push it on security and edge cases, because that's where it earns its keep. Then apply Google's standard: if the change clearly makes the code healthier, approve it and leave the polish for later. AI makes reviews quicker; it doesn't make them optional.
Frequently asked questions
Can AI do code reviews?
AI tools can do a useful first pass, spotting bugs, edge cases, security risks and unclear code, but a human reviewer should still approve changes.
What should I include in an AI code review prompt?
The diff, what the change is meant to do, what to focus on, and a request for findings ranked by severity with line numbers.
What standard does Google use for code review?
Google's engineering practices guide says reviewers should favour approving a change once it definitely improves overall code health, even if it isn't perfect.
How quickly should code reviews be done?
Google's guide says one business day is the maximum time it should take to respond to a code review request.
Is it safe to paste code into ChatGPT?
Check your company's rules first, and never paste secrets, keys or customer data into an outside AI tool.