Verification Loops: The Core Agentic Coding Skill

A verification loop is the act-observe-correct cycle applied to code: the agent makes a change, runs a check that returns a clear pass or fail, reads the result, and adjusts until the check passes. The check can be tests, type checking, a linter, a build, or a runtime probe. It gives the agent ground truth instead of leaving it to declare victory on its own judgment.
A language model is a strong generator but a weak self-critic, so an external check does the criticism for it and turns an open-ended task into a search with a clear goal. Boris Cherny, who built Claude Code, has described this feedback cycle as the reason the tool works. It is the highest-leverage habit you can add to an agent workflow.
Collapse everything you care about, tests, types, lint, and build, into a single command that returns an unambiguous result, then point the agent at it. A short verify script or a make verify target works well. Document it in your CLAUDE.md so the agent uses that one command instead of inventing ad-hoc checks.
A good signal is fast, so the agent can run it on every change; deterministic, so the same code always gives the same verdict; and meaningful, so passing actually correlates with correct work. Automated tests are the richest signal, followed by type checks, linters, a production build, and runtime probes or screenshots for UIs and endpoints.
Yes. A thin or flaky suite teaches the agent to optimize for the check rather than the goal, so it confidently declares broken code done. An agent with a bad loop is more dangerous than one with none, because its wrong answer arrives with a green checkmark. Keep the loop fast, deterministic, and genuinely meaningful.

Key Takeaway
A verification loop is any fast, deterministic check, tests, types, lint, build, or a runtime probe, that an agent runs to grade its own work and iterate until it passes. It is the difference between an agent that guesses it is done and one that can prove it, and it is the highest-leverage habit in agentic coding.
Ask an experienced Claude Code user what makes an agent effective and you rarely hear about the model. You hear about the loop: give the agent a way to run its work, see the result, and correct. Boris Cherny, who built Claude Code, has described this feedback cycle as the reason the tool works at all.
This is the verification loop, and it is less a feature than a skill you design into your project. An agent with a tight loop grinds toward a correct answer; an agent without one produces something that looks correct and stops. This piece explains what the loop is, how to build one, and how to keep it honest.
A verification loop is the act-observe-correct cycle applied to code. The agent makes a change, runs a check that returns a clear pass or fail, reads the result, and adjusts. It repeats until the check passes or it runs out of ideas and asks for help.
The check is the whole point. Without one the agent is writing into the dark and has to declare victory on vibes; with one it has ground truth to push against. The best loops share three traits:
You build a verification loop by giving the agent a single command that returns an unambiguous result. The goal is to collapse everything you care about, tests, types, lint, and build, into one pass-or-fail signal the agent can call after every change.
A short script does the job and doubles as documentation of what done means in your repo:
#!/usr/bin/env bash
# scripts/verify.sh - the agent's single source of truth
set -euo pipefail
npm run lint
npx tsc --noEmit
npm test
npm run build
echo "VERIFY OK"Expose the loop as one command, something like a verify script or a make verify target, and put it in your CLAUDE.md. When the agent has one obvious way to check itself, it uses it constantly instead of inventing ad-hoc checks that drift from your real standards.
A loop is only as good as its signal, and different work needs different signals. Reach for the strongest one the task allows.
The loop works because it replaces the agent's judgment about whether it is done with an external fact. A language model is a strong generator and a weak self-critic, and a failing test does the criticism for it, turning an open-ended task into a search with a clear goal.
It also compounds. Addy Osmani's writing on orchestrating agents makes the same point: an agent that can verify its own output can be trusted with longer, more autonomous runs, because each step is checked before the next one builds on it.
A weak signal teaches the wrong lesson. If your suite is thin or flaky, the agent optimizes for the check rather than the goal and confidently declares broken code done. An agent with a bad verification loop is more dangerous than one with none, because it comes with a green checkmark.
Treat the loop as part of your codebase, not an afterthought. A little investment here pays back on every agent run you will ever do.
Models keep getting better, but the verification loop is the part you control, and it is what turns raw capability into reliable work. Give your agent a fast, honest, meaningful way to check itself, and it stops guessing and starts converging. Master this one habit and most other agentic-coding advice becomes easy to follow.