CC-201b · Module 2
Autonomous Verification Loops
4 min read
The ultimate validation pattern is the autonomous loop: write code, run verification, fix errors, re-run verification, repeat until clean. When Claude has clear verification commands defined in CLAUDE.md, it naturally falls into this pattern. It makes a change, runs tsc, sees three type errors, fixes them, re-runs tsc, sees zero errors, moves to the linter, fixes a formatting issue, re-runs the linter, sees clean output, runs the tests, all pass, done. The entire cycle happens without human intervention.
The write-test-fix-verify cycle is most powerful when you define the exit criteria explicitly. "Do not present your changes until tsc, eslint, and vitest all pass with zero errors and zero warnings" sets a clear bar. Claude will loop through the verification steps as many times as necessary to meet that bar. It will not stop at "close enough" or present changes with known issues. It will self-correct until the verification pipeline is green. This is the behavior you want — and it requires nothing more than a few lines in CLAUDE.md.
Stop hooks automate this even further. A stop hook fires every time Claude finishes a task and checks for file changes. If files changed, it runs the verification pipeline automatically. If verification fails, it feeds the errors back to Claude as a blocking instruction. Claude fixes the errors, the stop hook fires again, verification runs again — and the loop continues until everything is clean. At that point, the hook can auto-commit. The developer's only role is to describe the feature. The entire write-verify-fix-commit cycle is autonomous.