AI code review: how to review AI-written code, and what AI reviewers do
AI code review means two things: a human reviewing code that an AI wrote, and an AI tool reviewing a pull request. Do both. Read every changed line, run the tests yourself, and check scope, edge cases, security and dependencies. Then let a review tool such as GitHub Copilot code review or Claude Code Review add a second pass. Their own documentation says to validate their feedback and not to treat it as a replacement for a human.
What does AI code review mean?
People use the phrase for two different jobs, and a good workflow covers both.
| Reviewing AI-written code | AI reviewing code | |
|---|---|---|
| Who reads | You | A model, then you read its findings |
| Question | Is this change correct, in scope and safe to merge? | Did a second pass find bugs the author missed? |
| When | Before you accept a change from a coding agent | When a pull request opens, or on request |
| Main risk | Approving a diff you did not understand | Trusting a clean report as proof of correctness |
| Tools | git diff, tests, a checklist, your own judgment | GitHub Copilot code review, Claude Code Review, review commands in agents |
If you build with a coding agent, the first job is the one that matters most, because the agent produces code faster than you can write it and nobody else will read it before it runs. The second job is a useful extra pair of eyes. It does not remove the need for the first.
How do you review code an AI wrote?
Review the diff, not the app. An app can look right and hide a bug in a branch you did not click. Follow the same order each time so you do not skip steps when the diff is dull.
- Check the size first. Run
git diff --stat. If the change touches many more files than the task needed, ask why before reading a line. - Check scope. Compare the changed files with what you asked for. Look for renamed functions, reformatted code, new dependencies and new features you did not request.
- Run the tests yourself. Do not rely on "all tests pass" in the agent's summary. Run them, and run the app once on the main path.
- Read the tests. Tests the AI wrote may assert whatever its code does. Ask what each new test would catch. Delete the fix and confirm the test fails.
- Read every changed line. Look for the failure patterns in the table below.
- Probe the edges. Empty input, a huge input, a duplicate, a missing value, a user without permission, a slow network.
- Check secrets and data. No key in client code, no personal data in logs, no new public endpoint that returns more than it should.
- Check dependencies. Does every new package exist, with the name spelled right, and is it maintained? Does the code call functions that exist in the version you have installed?
- Commit or revert. Accept the step as a commit, or throw it away. Do not leave half-reviewed changes lying in the working tree.
What do AI-written changes get wrong?
These are patterns, not statistics: places to look first because a fluent model produces them in a convincing way.
| Pattern | What it looks like | How to catch it |
|---|---|---|
| Invented API | A call to a function, option or package that does not exist | Run the code; check the library's documentation for the installed version |
| Happy-path only | Works for normal input; crashes on empty, null or very large input | Try the edge list above; ask for tests for each |
| Tests that mirror the code | The test copies the implementation's logic, so it can never fail | Break the code on purpose and see if a test fails |
| Scope creep | Extra options, abstractions, files and renames | Compare git diff --stat to the task; reject extras |
| Swallowed errors | catch blocks that hide a failure, or a default that masks bad data | Search the diff for empty catches and silent fallbacks |
| Secrets in the wrong place | A key or token in client code, a config file or a log line | Search the diff for key-like strings and environment variable names |
| Missing authorization | The route works but never checks who is asking | For each new endpoint ask: who can call this, and where is that checked? |
| Copy of old patterns | Deprecated methods or outdated library usage | Check the framework's current docs for anything unfamiliar |
| Quiet deletion | A check, a test or a validation removed to make something pass | Read the removed lines in the diff, not only the added ones |
What prompts help the AI review its own work?
Ask for criticism explicitly. A model that wrote the code leans toward defending it, so start a fresh session or a sub-agent for the review where you can, and ask for faults, not reassurance. These prompts are tool-agnostic. For more of this kind, see coding prompts to copy.
Act as a strict senior reviewer. Review the diff between main and the current branch (`git diff main...HEAD`). Report only real problems, ordered by severity: 1. Bugs and logic errors, with the line and a failing example. 2. Missing edge cases: empty, null, large, duplicate, concurrent. 3. Security: secrets, injection, missing authorization, unsafe file or URL handling. 4. Anything that goes beyond the task described below. 5. Tests that would still pass if the code were wrong. Task that was requested: <paste the task>. Do not praise. Do not suggest style changes. If you find nothing in a category, say what you checked.
Compare this diff to the task below. List every change that was not required by the task: new files, renamed symbols, new dependencies, behavior changes, deleted code. For each one say whether I should keep it or revert it, and why. Task: <paste the task>
For each test added in this diff, name one realistic bug in the code under test that this test would catch, and one that it would miss. If a test would pass even when the code is wrong, say so and rewrite it.
List every route, server function or API endpoint added or changed in this diff. For each, answer: who can call it, where is that checked in the code, and what happens if an anonymous user calls it directly? Quote the lines.
List every new dependency in this diff or lockfile change. For each: what it is for, whether the standard library or an existing dependency could do the same, and whether the package name and the functions used are real for the installed version. Say which claims you were unable to verify.
Which AI code review tools exist?
Two are documented by their makers in enough detail to compare. Both are described below as of October 2026; plans and settings change, so check the linked pages before relying on them.
| GitHub Copilot code review | Claude Code Review | |
|---|---|---|
| What it does | Reviews pull requests, identifies issues and suggests fixes you can apply in a couple of clicks | Reviews pull requests with several agents, verifies findings to filter false positives, ranks them and posts them |
| Where | GitHub.com, GitHub CLI, GitHub Mobile, VS Code, Visual Studio, Xcode, JetBrains IDEs; Azure DevOps in public preview | Pull requests on repositories hosted on GitHub |
| Who can use it | Paid Copilot plans; members without a license in organizations that enable the policy | Organizations on Claude Team or Enterprise plans, once an owner turns it on |
| Depth settings | Lite, Balanced (default) and Max effort levels; Max is in public preview | A review level set per repository, and when reviews run: on open, after every push, or on request |
| Default focus | Bugs, security vulnerabilities and style, from several angles | Correctness: bugs that would break production, not formatting or missing tests |
| How to steer it | Custom instructions for the repository | REVIEW.md and CLAUDE.md files in the repository |
| Its own caveat | Not guaranteed to spot all problems; validate its feedback and supplement it with a human review | Findings go on the pull request for a person to read and decide |
GitHub's Copilot code review documentation states plainly that the tool is not guaranteed to spot all problems, sometimes makes mistakes, and that its feedback should be validated and supplemented with a human review. Anthropic's Code Review documentation describes four stages: find, verify, rank and post. It also lists a command you can run yourself from a Claude Code session on any plan, /code-review, and a way to run Claude inside your own CI with GitHub Actions or GitLab CI/CD.
Other AI review products exist. Judge any of them on the same questions: does it read the whole repository or only the diff, how many of its comments are noise, can you tell it what your project cares about, and who sees your code.
How do you combine human and AI review?
Give each reviewer the work it does best. A tool never gets tired of checking the fiftieth null case. A person knows what the product is supposed to do.
| Check | AI reviewer | Human reviewer |
|---|---|---|
| Typos, null checks, off-by-one errors, unused code | Good first pass | Spot check |
| Does it match what we meant to build? | Weak, it only sees the diff and the repository | You. This is your job |
| Security basics (injection, secrets, missing checks) | Useful second pass | Required for anything handling money, identity or personal data |
| Architecture and long-term cost | Can raise questions | Decide |
| Test quality | Can flag tests that cannot fail | Confirm by breaking the code |
| Merge decision | Never | Always |
A simple pipeline for a solo builder: the agent writes a change on a branch; you read the diff with the checklist; a review tool runs on the pull request; you read its findings, fix what is real and ignore what is not; you merge. For a larger team, the same pipeline adds one human reviewer who did not write the prompt.
[ ] I read every changed line, including deleted lines. [ ] The diff only touches what the task required. [ ] I ran the tests myself and they pass. [ ] I broke the code on purpose and a test failed. [ ] Each new endpoint has an explicit authorization check. [ ] No secret, key or personal data in code, logs or client bundles. [ ] Every new dependency is real, needed and maintained. [ ] Empty, large, duplicate and missing inputs behave sensibly. [ ] An AI review ran, and I looked at every finding (fixed or dismissed with a reason). [ ] I can explain this change to someone else.
Review habits are easier to build on small projects. Pick a small idea from the board, have an agent build it, and run this checklist on the result. A tool such as Which env var changed between the deploy that worked and the one that didn't is a good size for it. If you are doing the building as a pair, the routine in AI pair programming covers the earlier steps.
Frequently asked questions
What is AI code review?
AI code review means either using an AI tool to review a pull request, or a person reviewing code that an AI wrote. Both are useful. The first adds a tireless second pass for bugs and security issues, and the second protects you from merging a diff you did not understand.
Can AI replace human code review?
No. The documentation for GitHub Copilot code review says it is not guaranteed to find every problem and recommends supplementing it with a human review. AI reviewers see the diff and repository but do not know what the product is meant to do. Use them as a second pass, and keep the merge decision with a person.
How do I review code written by an AI?
Read the whole diff, not only the running app. Check its size and scope, run the tests yourself, break the code to confirm a test fails, probe empty and extreme inputs, search for secrets and missing authorization, and verify that each new dependency exists. Then commit the step or revert it.
What are the best AI code review tools?
It depends on where your code lives. GitHub Copilot code review works inside GitHub and several editors on paid Copilot plans, and Claude Code Review works on GitHub pull requests for Team and Enterprise organizations. Compare noise level, repository awareness, customization and data handling before choosing.
Is it safe to ship code an AI reviewed?
Not on that basis alone. A clean AI report is not proof of correctness. For code that handles payments, sign-in, personal data or health data, have an experienced person review it. The AI helps you find problems, but it cannot take responsibility for the release.
Should the same AI that wrote the code review it?
Preferably not in the same session. A model that wrote the code tends to defend it. Use a fresh session, a sub-agent or a different tool, and ask for faults specifically. Better still, write the tests before the code so the result is judged against facts.
Created with AI assistance and edited for this site. Examples are illustrative and do not represent customer research. About the publisher.