Writing

AI · 6 min read

AI-Generated Code Review: What Reviewers Should Still Block

I spend less time polishing generated code, but approval still requires explainable behavior, clear boundaries, and a credible rollback.

In this article4 sections

I spend less review time fixing awkward AI code than I did a year ago. A strong current model can often rewrite another model’s clumsy abstraction in one pass. What I still cannot outsource is approval: I will not ask a teammate to approve code neither of us can explain.

I find it useful to separate those questions in review: can we explain the behavior, and would we prefer a different style?

The current models I use produce much better code than the ones I used when I copied snippets out of ChatGPT. The older output often needed a human to sand down every rough edge. I would spend longer simplifying its first attempt than I saved by generating it.

That has changed in my workflow. A strong current model can read a messy change from an older model, identify an unnecessary abstraction, and rewrite it into something smaller. I expect the cost of correcting yesterday’s AI code to keep falling.

That makes some cleanup cheaper in my workflow. It does not make a permission mistake, a bad data migration, or an unexplained business rule cheap to undo.

Review rule Spend human attention in proportion to blast radius and rollback cost, not generated line count.

A prompt turns constraints into architecture

I usually get a working implementation. The trouble starts when the model treats every detail in my prompt as a first-class system concern.

I describe an airport feature and stress its boundaries: who can access it, when it applies, which cases should not qualify, and what must happen at the edges. The model responds by building gates around every condition. It writes a long ladder of if statements, feature flags, eligibility checks, and fallbacks.

Each condition sounds reasonable in isolation. Together, the code resembles a rule engine that nobody requested.

The model struggles to decide whether those conditions belong in a component, a domain rule, or a policy boundary. It also struggles to distinguish a passing requirement from a constraint that deserves a durable abstraction. In this kind of output, incidental requirements can end up looking like permanent architectural boundaries. The prompt may omit the roadmap, earlier trade-offs, and the cost of changing the code later. Those are things I need to bring back into the review.

This creates an awkward review. The working diff contains three layers of gating. A reviewer asks why, and the honest answer is often: “Claude did it.” That explains the origin. It never justifies the design.

The cost has moved from writing to approval

For code that is easy to replace, I am willing to leave some awkwardness in the first version. That decision still needs to make sense with the tools we have today.

For a reversible feature, I would rather leave a stylistic cleanup for later than delay a change whose behavior is already understood and tested. That only works when the awkwardness is local: no hidden callers, persistent data changes, or permissions that survive a rollback.

Reviewers still pay a cost now. They need enough legibility to decide whether the change is safe, matches the product intent, or silently widens the system’s behavior. A future model cannot retroactively make today’s approval informed.

I lower the bar for polish and keep the bar for comprehension. Generated components do not need beauty on their first merge. Reviewers need explainable control flow and tradeoffs.

I would also separate a real maintenance concern from a team preference dressed up as one. Code review has always carried local taste: whether a helper belongs above or below a component, which abstraction feels clean, and how much indirection looks respectable. Those arguments consume real time because everybody has a mental picture of neat code.

Generated code can still violate a team’s conventions. The useful distinction is whether the convention prevents a concrete problem or merely reflects a preference. Stable, discoverable, cheap-to-change code does not need to satisfy every reviewer’s aesthetic ideal.

Every blocking review comment should name the cost it avoids: a failure mode, an ownership boundary, a likely future extension, or a path that will make incidents harder to diagnose. “This feels ugly” is not a cost. If a team wants a style, it should encode it in a formatter, a linter, or a short written convention. It should not rediscover the rule in every pull request.

The same shift is why fast validation matters more in AI workflows. AI writes the initial diff quickly, but the team still needs feedback before the context disappears. I made that case while moving to Biome: fast checks keep the review loop from becoming a CI archaeology project.

Give automated review a specific job

As generated diffs get larger, I want automated checks to handle more of the mechanical work. That leaves time to read the parts whose behavior or failure modes need a closer look.

Formatting, import order, spelling and mechanically detectable convention violations belong in configured checks. Those checks cannot establish that an apparently unused branch is safe to remove; that still depends on the behavior and callers.

AI needs a distinct review job. One agent writes the change. Another examines the diff against the ticket, the relevant tests, and the parts of the repository it touches. It should flag expanded permissions, duplicate business rules, missing tests, and behavior that does not match the stated requirement.

I would give the reviewing agent the requirements and diff in a fresh context, rather than ask it to endorse the writer’s explanation. A different model may offer another perspective, but neither setup guarantees independent mistakes. Tests, type checks and human review still need to challenge the result.

A shared component makes that concrete. In the TanStack Table migration, column types and selection behavior cross component boundaries. A tidy diff is not enough if those callers stop behaving correctly.

Reversibility should set the bar

ChangeSensible review barBlock when
Isolated UI change without persistent side effectsBehavior is tested; rollback is cheapControl flow is unexplained or scope quietly expands
Business rule or data migrationIntent, edge cases, and ownership are explicitRules are duplicated or recovery is uncertain
Authentication, payments, shared infrastructureDesign and failure modes are understood end to endPermissions, callers, observability, or rollback remain unclear

I would accept an inelegant AI-generated condition tree in code that is easy to replace: a local UI flow with no persistent side effects, understood callers, and tested behavior. An internal tool can still change production data or grant access; its audience does not make it low-risk. The team can ship, observe, and refactor once reality tells us which rules matter.

Payments, authentication, and shared infrastructure require the stricter standard. Those systems accumulate callers, permissions, data, and operational assumptions. The cost of a bad abstraction rises before the next model gets a chance to repair it. “We can ask Opus to clean it up later” cannot serve as a rollback plan.

For low-stakes code, the question is whether the change works and remains cheap to rewrite. For high-stakes code, the old standard holds: understand it, challenge the design, and reject the abstraction if it is not earned.

Was this useful?

What was missing?

Thanks for the feedback.