Skip to main content
Handbook/Build/Page 42 · Code Review

Checking the Agent's Work

Share

Share this page

Pass it to someone who needs it.

Star on GitHub

Key takeaway: Never ship unread code

Your agent writes most of the code now, and it writes it faster than you can read. The temptation is to skim its summary, see the app still runs, and move on. But that summary is a claim, not the code, and review is the first time a human truly looks at what shipped. This chapter makes that look happen every time, before the change lands.

4.7.1Read what the agent wrote

The agent hands you a confident paragraph describing what it did. Open the diff, the exact lines added and removed, and read them against what you actually asked for. That is code review: you deciding whether this change earns a place in your codebase, from the real evidence and not the sales pitch.

Read the whole change, not just the parts you follow at a glance. The lines you skip are exactly where the bug you cannot explain later is hiding.

4.7.2Review even when solo

On a team, a second engineer reads the change before anything merges. Alone with an agent, that second engineer is you, and skipping the step does not make the code safe, it just means nobody looked.

Fresh eyes catch what the author cannot see, so give yourself them: read the diff as if a stranger wrote it. Better, hand it to a second agent whose only job is to review, the same builder-and-reviewer split you use elsewhere, so a different mind grades the work.

Watch out: the change that also quietly renamed, restructured, or "cleaned up" something you never asked about is the one that breaks a working feature. Extra scope is not a bonus, it is unreviewed risk.

A second set of eyes, yours or an agent's, grades the change before merge.

4.7.3Four checks on every diff

You are not re-deriving the code from scratch, you are running it past a fixed set of questions. The same four, every diff:

Review checklist, run on every diff: [ ] Intent: does it do exactly what I asked, no more and no less? [ ] Scope: did it touch files or behavior I never mentioned, or add a package I did not ask for? [ ] Security: is every secret, input, and login path handled with care? [ ] Bugs: any obvious error, missed edge case, or dead code left behind?

Take the package question seriously. Agents pull in libraries you do not need, and they sometimes name one that does not exist at all. Attackers now exploit that: they register the invented name and fill it with their own code. Before you accept a new dependency, have the agent show you its official page and the date of its last release.

Every diff passes the same four gates before you accept it.

4.7.4The common answer is not always the right one

The four checks catch code that is wrong. They miss code that is merely average. An agent predicts the most common solution, and most common is not the same as most appropriate.

Its answer is the average of everything it read. Sometimes that is a solid default. Sometimes it is an outdated choice, a heavier dependency than you need, or a generic approach blind to what makes your case different.

None of that trips the checklist, because the code runs. It is just not the best code for you.

So add one question to the read: is this the choice everyone reaches for by reflex, or the right one here? When you are not sure, ask the agent for two or three alternatives and why it picked this one.

Rule of thumb: "everyone uses this" is how the agent defaults, not why it fits you. Judge the reasoning it gives, not the popularity of the answer.

4.7.5Comments should explain why, not what

While you read the diff, watch how it comments. The agent loves to narrate the obvious (// increment the counter above count++), and that noise buries the lines that matter. What earns its place is a comment where a choice is surprising: why this retry limit, why this workaround, the reason the code itself cannot show. A comment is documentation that lives next to the code, and the agent re-reads it next session, so keep the why and cut the what.

4.7.6Never ship what you don't understand

A change you cannot explain is one you cannot maintain, debug, or trust. If a line does what you asked but you have no idea how, that is not done, it is a liability with a green checkmark.

So make the agent teach you: have it walk you through anything unclear until you could defend it yourself. Then run the review as one command:

Ready prompt
Act as a senior engineer reviewing a colleague's change before it merges. First read my standing context: my rules file, my architecture map, my conventions, and my spec. Then read the actual diff below, not the summary of it, and check it against three things: intent (does it do exactly what was asked, nothing extra), security (secrets, login, and unchecked user input), and bugs (broken logic, missed edge cases, dead or duplicated code). Name anything that contradicts a decision those files already record, and say which one. List every issue by severity, blockers first. Explain anything I would likely not understand in plain words. If it is clean, say so plainly, do not pad. Do not rewrite the code, only review it. If you need the full reasoning behind this step, read https://zalt.me/guides/vibe-coding/build/reviewing-the-agents-code The task I asked for and the diff to review:

Do this now: take the last change your agent made, open its diff, and run it through the four checks and the prompt before you accept it. A reviewed, running app is what you carry into hardening it for real users.

Mahmoud Zalt

Mahmoud Zalt

Software engineer, 16+ yrs · built Sistava.com in 3 months, idea to production, using these methods

Resources
Star on GitHubContribute
Donate

Support my work

A small tip keeps the free work coming.

© 2026 Mahmoud Zalt. Free to read, not to republish.
Copyright & license