How I Review AI-Written Code
AI can write a whole feature in a few minutes. It can also put a bug in that feature that nobody sees for months. So the speed only helps you if something checks the work.
I write code with Claude and Codex. This page explains what checks it, and what it found on a SaaS I built end to end.
What one weekly review found
Here is a real run, from the job-alert app I build, on October 18, 2026:
- 504 files, read in 25 parts
- 4 critical problems
- 85 important problems
- 72 false alarms, thrown out before I saw them
A few of the real problems from that run:
- A payment change could get lost if the payment service had to send it twice.
- A first-time customer could not finish checkout at all.
- A link on a sign-in step could send someone to another website.
- Some admin pages did not check who was looking.
- Turning tracking off did not fully stop it.
Each of those changes looked fine the day it was written. The next day I shipped 17 fixes. 13 of them came with a new test, so the same bug cannot quietly come back.
The false alarms matter too. Review tools flag things that look wrong but are fine. A second pass opens the code and checks each warning. If I had to sort 72 false alarms by hand, I would stop trusting the tool.
Two checks on every change
Every change I make goes through two separate reviews before it ships.
The first looks for bugs. Does the code do what it should? What happens with empty input, a slow network, or two people clicking at once?
The second looks at structure. Is the code in the right place? Does it follow the architecture rules I hold every project to? Code that works today but sits in the wrong place is what makes a project slow and costly to change next year.
I keep the two apart on purpose. One review asked to look for everything tends to find less.
Both passes run from one tool I wrote: the PR review skill. It is free to use.
One full review every week
Small checks miss things that only show when you look at the whole app. So once a week I run a full review of everything, not just what changed. That is the run above. The tool is the weekly review skill, also free.
The same review also says how the app should be structured, so simple screens stay simple and payments and logins get extra protection. Which structure fits when: the code patterns I use, and when I skip them.
How much I read by hand depends on the project
A fast MVP has one job: get in front of users and test the idea. Every change still goes through my review tools. But I don’t read every line by hand, because much of that code may be thrown out next month.
Production code is different. Real users, real money, real data. The tools still do the first sweep, then I read the sensitive parts myself, line by line: logins, payments, permissions and anything that touches user data. If AI wrote it, I still own it.
You pick the level. Many projects start fast and tighten the checks before launch. What I look for when I read by hand is in the Technical tab.
Five questions to ask whoever writes your code
- What checks each change before it goes live? Listen for a named check, not “I test it”.
- When was the whole app last checked, not just the newest part?
- Who reads the login and payment code by hand? One named person.
- When a bug gets fixed, does a test come with it? Without one, the same bug can come back.
- What did the last review find? A list you can see, not “all good”.
You don’t need to read the code yourself. Every change I make goes through these checks, and you see what each weekly review found and fixed.
The short version
AI writes fast; checks keep it safe. Two checks on every change, a full review every week, and a test for every fix, so the same bug can’t quietly come back. On a SaaS I built end to end, one weekly run found 4 critical problems, and 17 fixes shipped the next day.
What checks the code in your project before it reaches your users?
I write most code with Claude and Codex. The review tools below are Claude Code skills I wrote. Each one runs as a fresh subagent with no memory of the session that wrote the code, so it reviews what is there, not what was meant.
Per change: two passes, kept apart
Every diff gets two passes, one after the other.
Code pass. Bugs, regressions, edge cases, missing tests, broken behavior.
Architecture pass. The diff checked against my architecture rules, one by one. A few of them:
- Routes only coordinate. No business logic or SQL in a handler.
- Validate at every boundary. Request bodies, provider responses, and JSON columns all go through Zod.
- Every UPDATE and DELETE carries an ownership predicate.
- A read-then-write runs in a transaction with
FOR UPDATE.
The two reports merge into one list ordered by severity. Keeping the passes apart stops the reviewer from finding one bug and calling the job done.
Source: pr-review skill.
Weekly: the whole codebase
Diff review only sees what changed. A weekly run, the full-review-weekly skill, reads whole files, in order:
- Tool checks. Lint, typecheck, unit tests, migration check,
npm audit. - Slices. The repo is split by folder. Each slice gets a code pass and an architecture pass.
- Verify. One more agent opens the code behind every critical and important finding and marks it
CONFIRMEDorFALSE, with a reason. - Specialists. Security, ownership and locking, query scale, schema, module borders, API and JSON boundaries, types, test gaps, dead code.
- Follow-up. Last week’s confirmed findings get checked again. Anything open two runs in a row moves up to critical.
- Tally. Counts by category across runs. A category in 2 or 3 slices suggests a rule change. In 4 or more, it suggests a new checker.
Every finding is one line:
severity | category | file:line | issue | fix
Each phase writes to disk before it reports back, so a crash or token limit picks up where it stopped.
The run on October 18, 2026: 25 slices, 504 files. 4 critical, 85 important, 72 false alarms removed by the verify step. The next day, 17 fixes shipped. 13 added a test.
Example: a redirect check that was not enough
The old code tried to allow only paths on the same site:
const next = raw && raw.startsWith('/') && !raw.startsWith('//') ? raw : '/dashboard';
/\evil.com passes that check. Browsers read the backslash as a slash, so it becomes //evil.com, which is another site. The fix parses the value the way the browser will:
const BASE = 'https://internal.invalid';
export function safeInternalPath(raw: string | null | undefined, fallback: string): string {
if (!raw || !raw.startsWith('/')) return fallback;
let url: URL;
try {
url = new URL(raw, BASE);
} catch {
return fallback;
}
if (url.origin !== BASE) return fallback;
return `${url.pathname}${url.search}${url.hash}`;
}
It shipped with a unit test that covers the backslash case.
Example: a webhook that dropped changes
Payment providers retry a webhook on any non-2xx reply. To skip duplicates, the handler saved the event id first, then applied the change:
const isNew = await recordBillingEvent(db, event);
if (!isNew) return { handled: false, reason: 'duplicate' };
const applied = await applyStripeSubscriptionState(db, event.change);
If the apply step threw, the event id was already saved. The retry was then skipped as a duplicate, and the plan change was lost. The fix puts both steps in one transaction, so they succeed or fail together:
return db.transaction(async (tx) => {
const isNew = await recordBillingEvent(tx, event);
if (!isNew) return { handled: false, reason: 'duplicate' };
if (!event.change) return { handled: false, reason: 'no_subscription_state' };
const applied = await applyStripeSubscriptionState(tx, event.change);
if (!applied) return { handled: false, reason: 'unknown_customer' };
return { handled: true, userId: applied.userId };
});
What gets read by hand depends on the stage
MVP. The per-change passes run on every diff. No line-by-line read, so the build stays fast.
Production. The weekly run on top, and I read auth, payments, permissions, and anything that writes user data line by line. The tools find candidates. I read the code and decide.
The same rules apply from day one, so MVP code is ready for the stricter checks when it goes to production.
What I look for when I read by hand
I read in a fixed order and stop when a pass stops finding things:
- Does it work? Bugs, empty input, edge cases, things that used to work and now don’t.
- Can someone else read it? Clear names, one job per function, no clever tricks.
- Is it easy to change later? No copy-paste, no hidden links between parts.
- Is it fast enough? Only if there is a measured slowdown. I don’t guess.
On sensitive code I ask a few more questions, taken from my 15 architecture rules:
- Can a user touch data that isn’t theirs? Every update and delete must check who owns the row, at the moment it writes.
- What if two requests arrive at once? A read followed by a write needs a lock, or two clicks can spend the same credit twice.
- Is every input checked? Anything from a form, a URL or another service is validated before it is used.
- What happens when it fails? If a login or limit check breaks, the answer must be “no”, not “let them in”. Errors get reported, not swallowed.
- What leaks? No passwords, keys or personal data in logs, error messages or responses.
And a few habits most teams agree on. Google’s code review guide is a good summary:
- Keep changes small. Nobody reviews 2,000 lines well. About 400 lines at a time is a common limit.
- Let tools handle style. Formatting and lint run on their own, so the human reads the logic.
- Read the tests too. A test that can never fail proves nothing.
- Explain the why. Each comment says what is wrong, why it matters, and what would fix it. Specific and kind.
More Posts
All posts
November 25, 2026
Why Your App Went Offline on Vercel's Free Plan (and How to Stay Under the Limits)
Vercel's free plan pauses every site on the account when one monthly limit runs out. What the limits mean in plain words, what uses them up, and the fixes, from a real case.
November 24, 2026
Why Your Project Starts With a Small Paid Step: Requirements and an Estimate Before the Build
A price given before the work is measured is a guess, and someone pays for it later. What a small paid first step gets you: written decisions, a cost range and a time range, and the choice to stop there.