ClaudeCodingbeginner

Claude Code: give it a pass/fail check and let it iterate

The Claude Code team's #1 tip: hand the agent a test, build or linter it can run, so it fixes its own mistakes before you see them.

Anthropic’s Claude Code team calls verification the single most impactful practice: if you adopt only one habit, make it this one.

Why it works

When the agent can run something that returns a clear signal (a test suite, a build exit code, a linter, a script that diffs output against a fixture), it closes the loop on its own: write code, run the check, read the result, fix, repeat.

How to do it

  • Tell it the exact command up front: “Run npm test -- auth after each change and keep going until it passes.”
  • No tests yet? Ask it to write a failing test that reproduces the bug first, then fix the code.
  • For UI work, give it a way to see the result (a screenshot step or an end-to-end test).

Pitfall: “make it work” with no check means you become the test suite.

Sources

Related tips