Skip to content

How the Claude Code Team Thinks About Verification

Automated code verification using E2E testing, property tests, and observe-mode commit gates scale AI development without breaking production.

Tuan Tran Van
10 min read
Contents (5 sections)
  1. Evidence Over Claims: The Bottleneck When AI Writes 90% of the Code
  2. Three Tests Hard to Fool: E2E, Property, and Differential Testing
  3. Building a Verification Harness: The Verify Skill and Running the App
  4. Moving from Reading Diffs to Defining Done
  5. References

How do developers maintain code quality when AI writes most of the code? The answer lies in rigorous code verification. When AI models generate ~90% of a codebase, manual human line-by-line diff reading becomes physically impossible and stalls engineering throughput. Maintaining high quality requires shifting your effort away from inspecting syntax changes manually and toward building automated, evidence-generating verification loops.

By equipping with concrete execution mechanisms to verify their own outputs, you transform software development from manual review into parallelized task delegation. Effective verification loops provide empirical evidence of correctness, catching runtime failures, logic regressions, and edge cases before code reaches a pull request.

Instead of reading raw diffs, your primary task becomes setting clear criteria for success, providing local testing environments, and enforcing strict checks to ensure verification systems operate reliably.

Multi-tiered code verification process using execution evidence for AI agents

Evidence Over Claims: The Bottleneck When AI Writes 90% of the Code

At Anthropic, Claude writes ~90% of Claude Code’s own codebase. Driven by agentic workflows, total monorepo changes expanded from ~2,500 per day in May to >30,000 per day in September. Scaling code production to this degree fundamentally breaks traditional manual code review workflows. Human engineering attention becomes the primary system bottleneck when every pull request requires manual line-by-line inspection.

Comparison between text claims and verifiable execution evidence for AI agents

Without automated verification loops, a developer can only operate 1 to 2 AI agents concurrently because they must manually validate every diff. Automated verifiers eliminate this bottleneck by replacing prose claims with execution evidence, allowing a developer to safely run dozens or hundreds of agents in parallel. Rather than relying on text assurances from a model stating that a task is complete, verifiers require the model to produce verifiable execution evidence.

Empirical testing validates this operational shift. In internal tests on structured file generation, adding an independent evaluator or grader to inspect outputs against a strict rubric increased task success by up to 10 percentage points over a standard prompting loop. The largest performance gains consistently occurred on the hardest tasks. Furthermore, generating tests, benchmarks, and specs with is fast and token-efficient, while running those generated tests as software execution loops consumes zero additional model .

Three Tests Hard to Fool: E2E, Property, and Differential Testing

Not all test suites provide equal value to AI agents. To prevent agents from satisfying unit tests while leaving system features broken, verification strategies must focus on three resilient testing methodologies.

The three resilient test tiers for coding agents: E2E, Property, and Differential testing

E2E Tests

End-to-end (E2E) tests evaluate full user flows—such as completing a checkout or running a signup sequence—where a feature either works completely or fails. Unlike isolated unit tests, which can pass even when integrated components fail, E2E tests are extremely difficult for an agent to fool. Unit tests frequently fail with uninformative outputs like "Error: Timeout after 30 seconds", whereas E2E tests provide rich, actionable failure data including visual screenshots, DOM element selectors, and network traces. Agents execute and visually inspect applications using tools such as the Chrome DevTools Protocol (CDP), mobile simulators, or dedicated API harnesses.

Property Tests: Constraints That Can't Break

Property-based testing surfaces subtle edge cases that human bias and agent context miss. Instead of writing fixed assertions for specific sample inputs, property tests assert universal invariants and execute thousands of randomly generated inputs against them. Libraries like fast-check (JavaScript/TypeScript), Hypothesis (Python), and proptest (Rust) shrink failing inputs down to the minimal reproducing case. Focus your property testing on four core properties:

  • Round-trip encoding: Serializing and deserializing data yields the original input (decode(encode(x)) == x).
  • Invariants: Conditions that must hold true under all circumstances, such as non-negative account balances.
  • Idempotency: Executing an operation multiple times produces the identical outcome as running it once (f(f(x)) == f(x)).
  • Equivalence: Optimized or refactored code yields identical output to a naive reference implementation.

Differential Tests: The Old System is the Oracle

During large-scale system migrations or heavy refactoring, differential testing uses the legacy system as the source of ground truth. Identical sets of production traffic or synthetic inputs are fed into both the legacy service and the newly generated service. The verification harness compares outputs to flag unexpected behavioral deltas while normalizing non-functional variance, such as whitespace formatting or timestamps.

Building a Verification Harness: The Verify Skill and Running the App

Automated verification relies on a core execution principle: verification means running the change. An agent must execute the code end-to-end within a runtime environment rather than assuring completion in chat prose.

To implement this, place dedicated verify skills within the .claude/skills/ directory structure as close to the target application code as possible. These skill files act as executable smoke-test harnesses. A verify skill defines the exact local operational sequence needed to boot background services, initialize database state, execute browser automation via Chrome extensions or CDP, or launch headless mobile drivers.

The following configuration demonstrates a production-ready verify skill located at .claude/skills/verify/SKILL.md:

markdown
---
name: verify
description: Executes local build verification, linter, and integration test suite prior to opening a PR.
---
 
# Verification Protocol
 
Run the following steps in sequence to verify the codebase changes:
 
1. **Clean and Build**:
   ```bash
   npm run build
   ```
  1. Lint and Typecheck:

    bash
    npm run lint && npm run typecheck
  2. Execute Local Integration Suite:

    bash
    npm run test:integration -- --filter=changed
  3. Verify Application State:

    • Boot local dev server: npm run dev &
    • Confirm endpoint response: curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/healthz
    • Ensure response code equals 200.

If any step fails, capture stdout/stderr, resolve the underlying error, and re-run this verification skill.


Executing `/verify` or running local verification hooks—including formatters, linters, static type checks, and local test runners—stamps the commit metadata locally before the branch ever reaches shared CI infrastructure or remote commit gates. If a commit is pushed without running these checks, its metadata is stamped as `"none"`. Enforcing local execution prevents agents from wasting shared CI build resources and human code review bandwidth on preventable syntax or build errors.

## Six Operational Rules That Keep Agent Verifiers Honest

To prevent AI agents from gaming verification steps or getting stuck in infinite remediation loops, enforce six non-negotiable operational rules across your development pipeline:

1.  **Human Escalation**: If an agent fails to fix a failing test suite after 3 iterative rounds, it must stop execution immediately and request human intervention.
2.  **Owner-Written Checks**: Domain experts and code owners must write and refine their own automated checks. Verification output must explicitly explain *why* a failure triggered so developers do not have to deduce intent from raw diffs.
3.  **Diff-Triggered Reliability Checklists**: Maintain a dedicated reliability checklist (e.g., 39 standardized items) where each rule maps to specific diff patterns. An agent reads the pull request diff and executes only matching checks (typically 3 to 10 items), such as validating backward compatibility for session storage (`--resume loads old transcripts`) when message structures change.
4.  **Branch Protection on Rulesets**: Store review criteria and [`REVIEW.md`](/en/for/developers/how-the-claude-code-team-does-code-review) instruction files strictly on protected default or base branches. Never allow an agent to evaluate a pull request using `REVIEW.md` rules defined within its own unmerged diff, preventing changes from altering their own pass/fail requirements.
5.  **Single Reviewer, Multiple Rounds**: Avoid stacking multiple automated review agents sequentially. Instead, use a single reviewer guided by `REVIEW.md` that carries context forward across multiple rounds, building on prior failure logs rather than re-evaluating the diff from scratch.
6.  **Commit Gates with Observe Mode**: Roll out automated gate enforcement in three distinct modes: `off`, `observe` (logging unverified commits without blocking developers to identify false positives), and `enforce` (blocking unverified sessions). In `enforce` mode, every commit message can carry an explicit bypass explanation. If an agent session is blocked **twice** in succession, the third commit attempt is automatically allowed through to prevent unrecoverable agent session lockups.

In addition to these rules, maintain a strict protocol for test flakiness: agents are prohibited from adding arbitrary sleep delays, skipping failing tests, or retrying suites until they pass. If an agent cannot resolve the root cause of a flaky test, it must delete the test entirely and document the explicit reason for deletion.

## Evaluating the Reviewers: Turning Outages into REVIEW.md Rules

To continuously improve reviewer accuracy, treat production outages and reverted pull requests as deterministic evaluation datasets (evals). When an incident occurs, extract the exact repository state prior to the merge, write a single-sentence ground-truth description of the bug, and add it to your permanent eval suite. To prevent over-flagging and false positives, include a size-matched control set of clean, stable PRs alongside incident PRs. Measure recall across raw findings, post-verification, and final review separately to confirm subagent filters do not drop valid bugs. Tune recall only up to the point where further changes would overfit the eval set rather than catch real defects.

Convert missed bugs into `REVIEW.md` rules using a dual-method rule extraction pipeline:
*   **Method 1 (Pattern Extraction)**: Extract recurring patterns from human code review comments and PR reverts. A candidate rule must appear in at least 2 independent PRs and be identifiable directly from diff patterns. Three separate subagents attempt to disprove candidate rules on clean codebases before a human engineer approves merging them into `REVIEW.md`.
*   **Method 2 (Incident Replay)**: Replay 3 bug finders against a PR associated with a known incident. If at least 2 finders catch the bug, it is classified as detectable. If missed on a small diff, add the missing pattern directly to `REVIEW.md` as an explicit rule.

Categorize findings into explicit severities (`Important`, `Nit`, or `Pre-existing`). Tagging existing code debt as `Pre-existing` prevents reviewers from incorrectly penalizing PR authors for legacy bugs.

The following production `REVIEW.md` configuration demonstrates severity boundaries, nit capping, path exclusions, and evidence requirements:

```markdown
# Repository Review Instructions

## Severity Definitions
- **Important**: Reserve exclusively for logic errors, unauthenticated API endpoints, unscoped database queries, tenant isolation breaches, data loss risks, or backward-incompatible schema changes.
- **Nit**: Naming conventions, minor refactoring, and code formatting suggestions.
- **Pre-existing**: Flag issues in unmodified legacy code as Pre-existing; do not block PR author.

## Limits and Constraints
- Report at most 5 Nits per review.
- Require concrete evidence: any logic or security finding must include a `file:line` citation pointing directly to modified lines in the source diff.

## Do Not Report
- Syntax, linting, or formatting issues enforced by CI.
- Generated code paths under `src/gen/` or lockfiles (`*.lock`).
- Intentional mock failures located in `tests/fixtures/`.

## Always Check
- Database operations enforce tenant ID scoping.
- Logs scrub sensitive PII, security tokens, and user credentials.
- New public routes include accompanying integration tests.

Moving from Reading Diffs to Defining Done

Scaling software development with AI agents requires shifting your daily operational role. Instead of reading line-by-line diffs to verify syntax and logic by hand, your job is to define objective success criteria ("done"), construct and maintain robust verification harnesses, and evaluate execution evidence produced by agents.

By combining end-to-end testing, property checks, protected instruction rulesets, and continuous reviewer , you build high-throughput verification loops. Equipping agents with reliable tools to test their own work maximizes development velocity while maintaining strict production stability.

References

Check yourself

Three quick questions to see whether the main ideas stuck.

  1. Why does the Claude Code team refuse to trust an agent's claim that 'unit tests pass'?
  2. Which testing methodology is considered the most resilient against agent self-deception and false success?
  3. How does the team prevent a pull request from weakening or altering the checks that judge it?

Share this article

AI glossary