The best thing you can do is give Claude a way to check its own work. A verification loop gets you 2-3x better results.
Types of Feedback Loops
Tests (the most common and reliable):
Write the implementation for the new rate limiter.
After each change, run `npm test -- --grep "rate-limit"`
and fix any failures before moving on.
Visual verification (for UI work):
After each change, take a screenshot with the Playwright MCP
and compare it to the design mock at ./designs/modal.png
Type checking / linting:
After each edit, run `tsc --noEmit` and fix any type errors
before proceeding.
CLI output:
Run the CLI command after your changes and verify the
output matches the expected format.
Why This Matters
Without verification, Claude writes code based on its best guess and moves on. With a feedback loop, it:
- Discovers its own mistakes immediately
- Iterates toward a working solution
- Handles edge cases it wouldn’t otherwise catch
- Delivers tested, working code, not just plausible code
Combine with Hooks
Use a PostToolUse hook to auto-run linters or formatters after every edit, so Claude doesn’t waste context fixing style issues:
{
"hooks": {
"PostToolUse": [{
"matcher": "Edit|Write",
"command": "npx prettier --write $TOOL_INPUT_FILE_PATH"
}]
}
}