AI news

How the Claude Code team verifies code

By 乱码0 viewsSource: 夕小瑶科技说
How the Claude Code team verifies code

The Claude Code team describes verification loops with end-to-end, property and differential tests, human escalation after three failed rounds, targeted reliability checks and isolated review rules. Engineers increasingly define acceptance criteria and review evidence.

AI is writing code faster and faster, yet programmers are getting more exhausted.

Atlassian, the software company behind Jira and Confluence, recently surveyed more than 1,500 software professionals and published these findings in its 2026 State of Developer Experience report:

87% of surveyed developers believe AI helps them deliver work faster. At the same time, 49% spend at least four hours a week reviewing AI output, refining prompts and dealing with the various messes AI leaves behind.

AI writes faster, but checking and adjusting its work still takes time.

The Claude Code team faces the same issue: about 90% of its code is written and reviewed by Claude.

How can a team put more AI agents to work without getting trapped in ever more checking and rework?

Recently, Claude Code engineer Addy Osmani published a technical post in the Engineering section of the official Claude Code blog, claude.dev, titled How the Claude Code team thinks about verification.

The summary draws on the team's real internal practices and offers a central argument:

verification is key. Your verification mechanisms determine how many Claude agents you can safely let work at once.

Article illustration

Without a verification loop, humans must inspect every piece of code, limiting you to watching one or two Claude agents at a time. With reliable verification, you can run dozens or even hundreds simultaneously.

Tests, benchmarks and end-to-end runs used to be too expensive. Agents can now generate these checks cheaply and run them repeatedly with almost no additional token consumption.

Beyond low cost, the most important mechanism is the verification loop.

When an agent repeatedly fails the same check, turn that failure into a hook or an explicit rule in CLAUDE.md, so most such problems are not repeated.

Making this so-called verification loop work requires solving two problems at the same time:

first, how to test reliably—choosing methods the AI cannot simply bluff its way through;

second, how to prevent the AI from exploiting loopholes—controlling its permissions through team processes and rules, and specifying when a human must intervene.

First, consider the tests themselves.

◽ The three test categories most worth investing in

If AI is to run its own verification, tests become the central tool. AI can write them quickly and run them repeatedly at low cost. They must, however, be stable and fast: flaky tests provoke repeated retries, while slow tests discourage frequent execution.

After weighing the options, the Claude Code team focuses on three categories:

First, end-to-end tests (E2E tests): giving AI "eyes and hands".

If you can choose only one category, the team recommends end-to-end tests. They simulate the complete user journey—for example, adding an item to a cart, checking out and viewing the confirmation page—and catch system-level problems that may remain after unit tests pass.

AI can operate real interfaces through browser extensions or mobile emulators. When something fails, screenshots and action traces help locate the problem, rather than leaving it with only a timeout message.

Article illustration

Second, property tests: targeting edge cases AI overlooks.

Human-written and AI-written tests share a weakness: they can miss the same extreme cases. Property testing reverses the approach. First define an invariant that must never be broken, then have a tool bombard it with large numbers of generated inputs.

Article illustration

For example, an account that does not permit overdrafts must never have a negative balance. The tool automatically combines amounts and sequences of operations, probing for cases that violate the constraint.

Third, differential tests: using the old system as a reference.

During a migration or refactor, differential tests feed the same random inputs or production-traffic samples into both the old and new systems and compare their outputs directly. Differences, and whether they are intentional, become immediately visible. Filter irrelevant noise first, however, and do not trust the old system blindly: it can contain bugs too.

Article illustration

◽ Six practical ways to keep AI under control

Test tools alone are not enough. AI may skip checks, repeatedly retry until it gets lucky, or even change the rules used to judge it. To prevent this, the Claude Code team established six demanding engineering practices:

  1. Run the real application The team encodes application startup and inspection steps in a verify skill for Claude to run before committing. Web, mobile and backend changes are verified through a browser, emulator or local service, respectively.
  2. Escalate to a human after three unsuccessful rounds Claude fixes failed checks itself, but if the same check still fails after three rounds, it stops and asks a human to intervene.
  3. Do not change the rules that judge your own work The review system reads rules from the base or default branch, rather than the version in the current changes, preventing a code change from lowering its own review standard.
  4. Choose checks based on the changes The team maintains a 39-item reliability checklist, recording each item's trigger, checks and relevant incidents or PRs. Claude typically selects three to ten items based on the changes—for example, checking that old records still load when session storage changes.
  5. Turn missed problems into rules The team focuses on improving existing reviews rather than continually adding reviewers. Recurring problems become rules. Flaky tests cannot be papered over with retries; if the cause cannot be found, remove the test and record why.
  6. Observe new rules before enforcing them New rules do not immediately block the workflow. They first record which commits they would block and how often they produce false positives, and are enforced only after proving reliable. The official post also describes a commit gate that checks whether a session has run /code-review or /verify: after that gate blocks commits twice in the same session, the next commit may proceed to avoid deadlock. This is not a general exemption from all tests or permission checks.

The process makes the changing engineering role clear. Where time once went into line-by-line inspection and bug fixes, the focus is moving upstream: build the verification environment, define acceptance criteria, then judge whether the AI's submitted evidence is strong enough.

From changing code to setting standards

For programmers, building an acceptance system that AI cannot bluff its way through may become the more important part of writing code.

References

[1]https://claude.dev/blog/how-the-claude-code-team-thinks-about-verification/

This article comes from "Xi Xiaoyao Talks Technology"; author: "Garbled Code".

Related topics

After reading

Join the AINRK community

Read how to join the community and connect with people working in AI.

Community information (opens in a new tab)