DeepDojo.AIPublished 2026-11-15中文

4 Levels of Review for AI-Written Code

Claude CodeAI Coding

Ask Claude Code for a batch rename script and you'll get a dozen lines. How carefully you should check those lines depends entirely on what they touch.

In one case, the script renames personal videos by topic and date, and you have a backup. Spot-check a few names after it runs; if something's wrong, restore from the backup. Five minutes, done.

In another, the script renames raw experiment data on a shared drive with no backup, and the original names get overwritten. Now you review a dry-run list first, rehearse on a copy, verify the results afterwards, and save a mapping of old names to new ones.

Same script. What differs is whether you can recover from a mistake, who it affects, and how long the result has to last. Many people have only two settings for checking AI-written code: ship it once it runs, or review every line. The first causes damage on shared data; the second wastes time on a throwaway script.

A more practical approach is to grade the task first, then pick a checking depth to match:

  • Throwaway experiments and prototypes: confirm the main result by hand.
  • Small features and personal tools: add Git, basic tests, and a file-level understanding.
  • Team code, payments, permissions, migrations, and privacy logic: automated tests, CI, a function-level understanding, and near line-by-line review of the critical parts.

When a technical choice is uncertain, test it with a minimal prototype first. When a behavior has to be maintained long term, write a failing test first, then let it change the implementation.

01 Start With What a Mistake Would Affect

After finishing a small task, how far should you check? First ask what a mistake would affect and how long the result will be used. For a quick experiment, confirm the main result. For core logic that will be maintained, understand the data flow, failure paths, and dependencies.

Quick mode: just confirm the result works
Structure mode: understand file layout and module relationships
Function mode: understand key functions and data flow
Line mode: check every line for necessity and behavior
Dependency mode: check libraries, permissions, security, and long-term maintenance risk

"Mode" here means how deeply you check the result. It has nothing to do with Claude Code's permission modes or model tiers.

02 Four Levels From Vibe Coding to Rigorous Engineering

For easier discussion, common practice can be grouped into four engineering levels. Treat them as a reference for choosing checking depth: pick the one that fits the task, with no need to climb through them in order.

LevelFitsMain quality controls
Level 1: Vibe codingQuick experiments, one-off scripts, fast prototypesConfirm the main result by hand
Level 2: Disciplined agentic codingSmall features, personal tools, non-core modulesGit, file-level understanding, basic tests, security basics
Level 3: Agentic software engineeringTeam features, maintainable projectsFunction-level understanding, automated tests, pre-commit, CI, regression checks
Level 4: High-quality software engineeringCore business, security-sensitive work, long-lived infrastructureLine-by-line review, rigorous tests, multiple platforms, security and performance checks

A practical stance on vibe coding: in one-off scripts and throwaway prototypes, go as fast as you like.

The moment that logic is headed for a team codebase, or touches real users' payments, permissions, or stored data, the casual approach has to go. Hold it to strict unit tests, automated CI, and type constraints. Payments, permissions, data migrations, and privacy logic need at least Level 3, and their critical parts deserve care close to line-by-line review.

When exploring an unfamiliar framework, a loose prototype is a fine way to learn how it behaves. Then rewrite the real solution to proper engineering standards.

Back to the rename script:

  • Personal videos with a backup, renamed by topic and date: Level 1 is enough. Spot-check names after the run and restore from backup if needed.
  • Raw experiment data on a shared drive with no backup, original names overwritten: treat it as at least Level 3. Review the dry-run list, rehearse on a copy, verify the result, and save the rename mapping.

The level comes from scope of impact, how long the code will be maintained, and whether you can recover. A short script can still be hard to recover from, and a one-off experiment on backed-up data doesn't need Level 4 rigor.

Once you've picked a level, tell Claude Code what depth you need:

This touches core data. Explain the key data flow, permission boundaries, failure paths, and how it's verified.
This is a one-off script. Keep it simple and working. No long-term architecture or extra dependencies.

Ask for the evidence that matches how deeply you need to understand the result, and keep the design's complexity at the same depth.

03 Prototype the Choices You're Unsure About

The most painful rework in complex projects usually traces back to a technical decision made too early. Before changing files, get a picture of the project's directory structure, the files likely to be affected, and how the data flows. Enter plan mode with /plan or Shift+Tab so Claude Code explores and plans first.

A plan writes down the technical choices, but it can still hide untested assumptions. Whether the library chosen for the transcription app can load its model on the target system, for example, is something only a run can answer.

Suppose the transcription app has to work offline, and you picked library A because its docs were easy to read. Halfway through the UI, you find that its browser build can't load models offline. All the code already wired to it has to be redone.

Before choosing, test a minimal prototype that "loads the model in the browser and transcribes a fixed audio clip." Questions that decide the whole design, such as offline support, performance, compatibility, and data formats, should be settled with an experiment that actually runs:

Build a standalone minimal prototype that only tests whether this library meets the requirement. Don't connect it to production code.

Move ahead on plan where you're confident; prototype where you're not:

Known path: Research → Plan → Execute → Test
Uncertain path: Research → Minimal prototype → Revise plan → Execute → Test

Research builds an understanding of the problem and current state, Plan sets the approach and boundaries, Execute makes the planned changes, and Test supplies the evidence that it's done. You can lock the current phase in the prompt:

Work in four steps: Research / Plan / Execute / Test.
For now, do only Research and Plan. Don't modify any files.
The plan must include the goal, files involved, implementation steps, risks, verification method, and questions for me to confirm.

04 Make the Test Fail Before Changing the Code

Describe the expected behavior in a test before writing the implementation, and every later change has a standard to check against. That's test-driven development; Martin Fowler's TDD entry sums it up as a three-step cycle: write a test for the next bit of functionality, write code until it passes, then refactor.

The first step is the one that matters most. The test has to fail against the old implementation; otherwise it hasn't shown it can catch the missing behavior.

Write the test
  → Confirm it fails on the old implementation
  → Lock the test contract
  → Change the implementation
  → Test passes
  → Review the implementation's complexity

Give Claude Code the task in two steps:

Write a test that fails against the current implementation. Don't change the implementation. Run it and show why it fails.
Now change only the implementation so that test passes. Don't loosen or rewrite the test along the way.

Say the requirement is "empty audio returns an understandable error." The test should first fail because the old code doesn't handle empty audio.

When the terminal fills with red, step back and read why it failed. Did the code fail your business assertion, or is the local test environment missing something? Those are very different:

  • You expect a friendly format message for empty audio, and the test throws Cannot read properties of null. The test reached the business code and caught the unhandled edge case. That's evidence you can act on.
  • The error says Cannot find module 'vitest', or the sample file path doesn't exist. The test process exited before it ever reached the business code. Hand an environment failure like that to the AI as if it were a business bug, and it will drift further with every fix, mangling code that was working fine.

Review the test itself too: does it check real behavior, does it fail on the old code, does it cover edge cases and failure paths, and is it tied too tightly to internal details?

Test rigor grows with the level:

Manual check of the main flow
  → Automated tests for key functions or APIs
  → CI blocks failing changes from merging
  → Regression, end-to-end, multi-platform, security, and performance checks

Claude Code can help add pre-commit hooks, lint, CI jobs, and regression tests for bugs. These quality gates keep every later fast change held to the same standard.

05 Different Outputs Need Different Evidence

To accept a result, look at the result itself. Whether code does what you expect, whether a research conclusion has sources, whether a remote action actually took effect: each needs different evidence.

Output typeMain evidence
CodeTests, diff, code review, explanation of key data flow, draft PR
DocumentsFact checks, structure checks, rendered preview, usefulness for the intended reader
PagesDOM or accessibility state, screenshots, interaction checks, network errors
CLI tools or scriptsExit code, stdout/stderr, sample input and output, file side effects
Research conclusionsOriginal sources, dates, verifiable claims, inferences, and open items
Automated operationsPlan beforehand, actual changes, command output, diff, and remote state

For code review, use /diff, Git tools, /code-review, or a visual Git client. For important changes, ask for a file-by-file explanation:

For each file, explain why it changed, how the behavior changed, and the evidence that verifies it.

For research conclusions, separate facts from inferences:

Re-check each conclusion and list in a table: the conclusion, its source, its verification status, and what can't be confirmed.

The bigger the impact, the closer to the real runtime environment you need to verify. Once code reaches a PR, the review's own findings need checking too; how to sort real issues from noise in an AI code review shows how to separate verified, needs-testing, and withdrawn findings.

Whether you picked the right level also depends on whether the task was split small enough. Checking depth only means something when each small task has its own verification; what to do when Claude Code edits too many files covers how to split.

Two copies of the same dozen-line rename script, one on backed-up data and one on data with no backup, deserve checking two levels apart.