Issue 00 · Autumn 2026日本語 · RSS
AgentKoji

Before You Trust AI Output: Verification and Review

Judge an AI agent's "done" by checks that return pass or fail and by evidence. Move rules that can't bend into hooks and deny rules, and decide where review stops. Checked 2026-11-15.

TL;DR

  • Claude Code instructions come in two kinds: ones the model reads and decides on (prompts, CLAUDE.md, skills) and ones the harness always executes (hooks, deny rules, managed settings). Rules that can't have exceptions belong in the second kind.
  • Decide whether work is done with a check that returns pass or fail, such as tests, a build's exit code or a linter. "All tests pass" on its own tells you little, so ask for the command that ran and its output.
  • When a review checks work against a spec, keep "skip style" in the prompt. A reviewer asked to find problems always finds something, and fixing every finding adds needless abstraction and tests for cases that can't happen.

Judge an agent’s output by checks that come back pass or fail and by evidence (the command that ran and its output), not by its report that it is done. Move rules that can’t have exceptions out of instructions to the model and into hooks and deny rules that the harness always runs. Treat review as something you scope and stop on purpose: decide what it should report against your spec, and when to stop.

This page is a map for checking the quality of an agent’s work. It lists what the official best practices say and the order in which to read our guides. Official facts were checked against the docs on 2026-11-15, when the latest Claude Code on npm (@anthropic-ai/claude-code) was 2.1.325. We did not run any command on this page for this hub. Where the docs did not state something, we left it out or marked it “unverified”, and we label our own views as ours.

What the model decides and what the harness enforces

The official best practices split every Claude Code instruction into two kinds:

Claude decidesClaude Code enforces
What to doYour prompt, CLAUDE.md, skills Claude picks up itselfHooks, and skills only you can start
What it can touchAuto mode’s classifierDeny rules, the sandbox in strict mode, managed settings
When it’s doneA request for evidence, /goal, /code-reviewTests, typecheck, a Stop hook, CI
How much it spendsEffort level, Claude’s own pace--max-turns or --max-budget-usd with -p, a spend limit you’ve set
Who has the last wordClaude’s summary of what it didBranch protection, a person who approves the merge

Source: https://code.claude.com/docs/en/best-practices (checked 2026-11-15)

Most of the time the docs want Claude to decide, because with the code in front of it Claude is usually better placed than a rule written in advance. The deterministic kind is for things that must always (or never) happen, whatever the model decides. Source: https://code.claude.com/docs/en/best-practices (checked 2026-11-15)

If you keep adding emphasis to a CLAUDE.md line and Claude still misses it, that line belongs in a hook. The reverse holds too: delete hooks for things that are only preferences. Source: https://code.claude.com/docs/en/best-practices (checked 2026-11-15)

Hook events and exit codes are in Claude Code Hooks: Events, Exit Codes and Examples. How a written ban failed to stop a repeat, and how hooks and git numbers did, is in Don’t Trust an Agent’s “Done”.

Deciding whether work is done

Without a way to check, Claude stops when the work looks done, which makes you the test suite. Give it something that comes back pass or fail and it closes the loop itself: change, run the check, read the output, fix, run again. Source: https://code.claude.com/docs/en/best-practices (checked 2026-11-15)

Checks the docs list:

If your repo already has one, the most useful line in CLAUDE.md is the command that runs it. Source: https://code.claude.com/docs/en/best-practices (checked 2026-11-15)

You choose how strict the check is.

LevelHowWho decides
Prompt“Run the auth tests after, and keep going until they pass”Claude, when it is satisfied. No setup
/goalA condition that a separate model checks against the conversation after every turn; Claude keeps going until it’s metA separate model. Matters for long background runs that end a turn with a progress summary while items are open
Stop hookYour script runs whenever Claude tries to end its turn; exit code 2 sends it back to workThe harness. The turn doesn’t end until the check passes or the block limit is reached
Someone who didn’t write it/code-review reviews the diff in a fresh subagent that never saw your conversationA reviewer not swayed by the reasoning that produced the code

Source: https://code.claude.com/docs/en/best-practices (checked 2026-11-15)

The Stop hook example is a few lines in .claude/settings.json, such as pnpm tsc --noEmit 1>&2 || exit 2. The compiler output goes to stderr because stderr is what Claude gets back as the reason it can’t finish. If the hook blocks eight stops in a row with no tool call between them, Claude Code overrides the next block and ends the turn; raise the cap with CLAUDE_CODE_STOP_HOOK_BLOCK_CAP. Source: https://code.claude.com/docs/en/best-practices (checked 2026-11-15)

Whatever the level, ask for evidence: the command and its output, or the screenshot. “All tests pass” on its own tells you very little, and for a session you weren’t watching it is the only evidence you have. After Claude says it’s done, /verify has Claude build and run the app and look at the result, which catches problems tests and typechecks miss. Source: https://code.claude.com/docs/en/best-practices (checked 2026-11-15)

Whether the check itself is real is a separate question. How green tests failed to guard anything, and how to break the code on purpose to find out, is in Green Tests Prove Nothing.

Using review, and where to stop

To check work against your plan rather than hunt for bugs in general, write the review prompt yourself. The docs’ example has a subagent review the diff against SPEC.md, check that every requirement is implemented and the listed edge cases have tests, report gaps that affect correctness, and skip style. Don’t drop skip style. A reviewer asked to find problems always finds something; fix every finding and you get extra abstraction layers and tests for cases that can’t happen. Source: https://code.claude.com/docs/en/best-practices (checked 2026-11-15)

There is more than one way in:

Where to stop is our own view. Tell apart work that won’t pass in one round from a loop that never ends. Fix commits produce new findings too, so review just the fixing diff once more. When a reviewer without the conversation history reopens a settled point, reject it by citing the agreed document. Cases and rough round counts are in When to Stop AI Code Review. For design, a different model’s strongest rebuttal is cheaper before any code exists; the steps are in Have Another AI Rebut Your Design.

Doubting root causes and fixes

This section only points to our guides, and these are our views.

Narrowing what the LLM does

The earliest way to make work checkable is not to hand an LLM work you can’t check. This is also our view.

Details are in Let LLMs Only Pick and Extract.

Reading order

Starting points, not a ranking. Read top to bottom for the full picture.

  1. Green Tests Prove Nothing: it isn’t a test until breaking the target makes it fail.
  2. Don’t Trust an Agent’s “Done”: check completion reports against hooks and git numbers.
  3. Doubting the AI’s Root Cause: controls, environment, artifact freshness, then measurement.
  4. Don’t Make It Fix the Same Thing Thrice: stop after repeated misses and write down when to retreat and resume.
  5. When to Stop AI Code Review: an endless loop versus one you must not cut short.
  6. Have Another AI Rebut Your Design: the strongest rebuttal before code, checked against settled decisions.
  7. Deleting Thousands of Lines in a Refactor: map dependencies and delete callers first, one step per commit.
  8. Let LLMs Only Pick and Extract: no prose; pick, extract and verify against the source by machine.
  9. Claude Code Code Review: /code-review vs Managed PR Reviews: managed Code Review for Team and Enterprise versus local /code-review.
  10. Claude Code Ultrareview: Cost, Limits and How to Run It: /code-review ultra, where several cloud agents reproduce each finding.

Summary

FAQ

Does Claude always follow the rules in CLAUDE.md?
There is no guarantee. Prompts, CLAUDE.md and skills are instructions the model reads and decides on; it follows them nearly every time, but whether it does on a given turn is still its call. Anything that must happen every time belongs in a hook, a deny rule or a managed setting.
How do I check an agent's claim that it is done?
Give it a check that returns pass or fail: a test file, a build's exit code, a linter, a script that diffs output against a fixture, or a browser screenshot next to the mockup. Then ask for evidence: the command it ran and its output.
How do I stop Claude from finishing with a Stop hook?
Add a command to the Stop hooks in .claude/settings.json and exit with code 2 when the check fails. Whatever the command prints to stderr goes back to Claude as the reason it can't finish. After eight blocked stops in a row with no tool call between them, Claude Code overrides the next block; raise the cap with CLAUDE_CODE_STOP_HOOK_BLOCK_CAP.
Should I fix every review finding?
The official best practices warn that a reviewer asked to find problems will always find something, and fixing every finding leads to extra abstraction layers and tests for cases that can't happen. In a spec review, ask only for gaps that affect correctness and keep skip style in the prompt.