The most dangerous sentence in AI-assisted coding is "this should fix it."
The agent patches something, the code compiles, everyone moves on — and the bug comes back two weeks later wearing a different hat. The fix was never proven. It was just plausible.
Here is the prompt I now paste before any bug fix in Claude Code. It forces test-first discipline on the agent:
Turn this bug report into a failing test first: [BUG_REPORT]. The test must fail for the reported reason — show me the failure output. Then fix the code minimally until it passes, and run the surrounding suite ([TEST_COMMAND]). Report: test name, the failure before, the pass after, and the one-line root cause.
"Failing test first" — the agent has to reproduce the bug in code before it is allowed to touch the fix. No reproduction, no patch.
"Must fail for the reported reason" — tests can fail for the wrong reason (bad setup, wrong import). This line makes the agent check that the red test is actually your bug.
"Show me the failure output" — proof, not a summary. You see the red with your own eyes.
"Fix minimally until it passes" — minimal is doing real work in that sentence. It stops the agent from "improving" three unrelated files on the way.
"Report: failure before, pass after, one-line root cause" — the fix arrives with its own evidence attached, and the root cause has to fit in one line. If it can't, the agent doesn't understand it yet.
Bug report: "discount shows twice in the cart."
The new test fails with total $60 actual vs. $80 expected — the coupon is applied twice. A minimal fix in the recalculation path turns it green, and the surrounding suite passes. The fix arrives with proof: red, then green. And the regression test stays in the suite, so this bug can never silently return.
That last part is the real compounding effect: every bug fixed this way leaves a test behind. Your suite grows out of real failures, not imagined ones.
Reproduce first. Demand the failure output. Fix minimally. Require the proof. It works for debugging, for reviews, for refactors — anywhere an agent might otherwise hand you confidence instead of evidence.
This prompt is one of 12 in my Debugging & Review Mini-Pack (root-cause analysis, git bisect walkthroughs, flaky-test autopsies, security-first review, and more), each with fill-in variables and a worked example:
Content first, pitch second — but if the prompt above saves you one 3 A.M. debugging session, the packs will pay for themselves.