How to Review AI-Generated Code in a Pull Request
What to look for when a teammate's PR was written by Claude.
There are times when you open a pull request and can tell right away that most of it was written by Claude. Maybe the description says so, maybe it was opened by an agent, or maybe it's just 600 lines of very tidy code with a comment on every function. This is a normal part of the job now. Agents open whole PRs, and most teams have an AI review bot leaving comments before a person ever looks.
Code from Claude tends to look right. It's formatted, the names make sense and it usually passes CI. The syntax and the logic are rarely the problem. The problems are higher up: where the state lives, how the pieces fit together and whether it follows the patterns the rest of the app is built on.
Don't review code Claude wrote the way you'd review code a person wrote. The syntax and logic are usually sound, so spend your time on the high-level architectural decisions it made.
Start with the 20% that matters
A big PR usually has a few files that decide how the feature works and a lot of files that just follow along. Find the 20% of the code that controls 80% of the feature and review that first:
components/CartItem.tsx +40components/CartSummary.tsx +12hooks/useCart.js +85 // state and API callspages/api/cart/[id].js +60 // new endpointstyles/cart.css +30
In this PR, useCart.js and the new API route are the high-level decisions.
Does the state live in the right place? Is the endpoint something we're happy to
support for years? Does it follow the patterns the rest of the app uses? If the
answer to any of these is no, say so before leaving line comments. There's no
point polishing a component that's built on the wrong foundation.
Check the types
Types are how the next person, or the next agent, knows how to use this code
correctly. Claude reaches for any and as casts whenever the types don't line
up, which quietly turns the type checker off:
// components/OrderStatus.tsxtype Props = {order: anyonChange: (value: any) => void}
Can we use the Order type from types/order.ts here, and type the status as
a union so a typo fails the build?
// types/order.tsexport type OrderStatus = "pending" | "shipped" | "delivered"export type Order = {id: stringstatus: OrderStatustotal: number}// components/OrderStatus.tsxtype Props = {order: OrderonChange: (status: OrderStatus) => void}
Search the diff for any, as unknown as and @ts-ignore. Each one is a place
where the code stopped being checked.
Look for duplicate helpers
An agent doesn't always know what's already in your codebase, so it writes its own version:
// components/CartSummary.tsxfunction formatPrice(cents) {return "$" + (cents / 100).toFixed(2)}
Meanwhile the project already has this:
// utils/format.jsexport function formatCurrency(cents, currency = "USD") {return new Intl.NumberFormat("en-US", { style: "currency", currency }).format(cents / 100)}
The two don't even behave the same. A total of 123450 cents shows as $1234.50
with the new one and $1,234.50 everywhere else on the site.
We already have formatCurrency in utils/format.js. Can we use that so
prices look the same everywhere?
To catch these, search the codebase for what the function does (format, price, currency), not just its name.
Make sure the design system is used
The same thing happens with UI. Instead of using the shared components, Claude will often rebuild them inline:
<buttonstyle={{ backgroundColor: "#2563eb", padding: "10px 16px", borderRadius: 6 }}onClick={onSave}>Save</button>
We have a Button component with a primary variant. Can we use that so this
picks up any future theme changes?
<Button variant="primary" onClick={onSave}>Save</Button>
It looks the same today. But when the design team changes the primary color next year, it's one update in one place, and this button won't be the one that gets missed. Watch for hardcoded colors, pixel values and font sizes where the project has tokens for them.
Ask for screenshots
If a PR changes the UI, it should show the UI. A before and after screenshot (or a short recording for anything interactive) takes the author a minute and saves the reviewer from pulling the branch just to see what changed. It also catches the obvious stuff early, like a layout that breaks on mobile or a dark mode that was never checked.
Ask how they tested it
The PR should say how the author checked their own work. Not "tests pass", but what they actually did. A PR description like this makes the review much easier:
## What changedAdds a remove button to each item in the cart.## ScreenshotsBefore: (screenshot)After: (screenshot)Mobile: (screenshot)## How I tested it- Removed items with the mouse and with the keyboard- Removed the last item and checked the empty state shows- Ran the cart tests locally
If this section is missing, ask for it. It's a simple way to make sure the author ran the code and didn't just read it.
Make sure regression tests come with the feature
Claude is really good at writing tests, so there's no reason for a feature to ship without them. Ask for tests that cover what the feature does, so the next change can't break it without someone noticing:
// components/CartItem.test.tsximport { render, screen } from "@testing-library/react"import userEvent from "@testing-library/user-event"import CartItem from "./CartItem"test("removes the item when the remove button is clicked", async () => {const onRemove = jest.fn()render(<CartItem item={{ id: 1, name: "Mug", price: 1200 }} onRemove={onRemove} />)await userEvent.click(screen.getByRole("button", { name: "Remove Mug from cart" }))expect(onRemove).toHaveBeenCalledWith(1)})
This also checks that the button has an accessible name, since getByRole won't
find it otherwise.
Read the tests, though. Tests that Claude writes sometimes mock the very thing they're supposed to test, so they pass no matter what. A quick check: break the code on purpose and run them. If they still pass, they aren't testing anything.
Ask follow-up questions
The most useful comments on a PR Claude wrote are often questions:
- Can you walk me through how this works?
- What happens if the request fails halfway through?
- Why does this live in the hook instead of the page?
- What else calls this function?
If the author can answer, great, the review goes faster. If they can't, that's the real problem, and it's better to find out now than during an incident. The author doesn't need to have typed the code, but they do need to understand it, because they're the one who'll be fixing it later.
It's also fair to ask for smaller PRs. An agent can write 1,000 lines in a few minutes, but nobody can review 1,000 lines well.
Use a different model for a second opinion
AI review bots are good at catching typos, unused variables, missing awaits and the odd real bug. But a model reviewing its own work tends to agree with itself. If the code was written with Claude, have GPT-5 or Gemini review it, or the other way around. A different model has different blind spots and is more likely to push back:
Review this diff as a skeptical senior engineer. Look for bugs, missing edgecases, duplicated helpers and places where it doesn't follow the patterns inthe rest of the codebase. Don't comment on formatting.
Treat what comes back as a first pass. The bots review the diff, not the product. They don't know that the design calls for a different empty state or that this feature was supposed to ship behind a flag. The approval still needs a person who understands what the change is for.
Review the code, not the tool
Keep your comments about the code. "This was obviously written by Claude" isn't
useful feedback, and it puts people on the defensive. "This duplicates
formatCurrency" is something they can act on. The person who opened the PR
owns it, whether they typed it by hand or an agent wrote it.
Reviewing takes longer than it used to, which is part of why AI doesn't always make you faster. But it's the part of the job that keeps the codebase in good shape, and it's worth doing slowly.
Have some feedback on this post? .