@whyshouldaicareone AI disaster a day, and the fix

Make Claude reproduce the bug before it fixes it

"You're absolutely right" four times and the bug stayed. This prompt asks for a failing test first, then the change.

The fix

Do not argue with the answer. Change the order of work: evidence, then cause, then code. Replace the first line with your own bug.

copy and paste
The cart total shows 0. Do not change code yet.
1. Write a failing test that reproduces it. Run it
   and show me the output.
2. Say why it fails, in one sentence, with the line.
3. Only then change the code, re-run the test, and
   show me the passing output.
Fix the root cause. Don't hard-code values for the test.

Check it worked

Look for two test outputs in the reply: a failure before the change and a pass after it. Then take the fix out and run the test again. If it still passes, the test proves nothing. This stash works while the fix is not yet committed.

copy and paste
git stash push -- src/cart.js
npm test        # must fail again
git stash pop

Pro tip: plan mode when the cause is unknown

In plan mode Claude reads files and proposes a plan, and makes no edits until you approve. Start with the flag, or press Shift+Tab until the status bar shows plan mode on. Ctrl+G opens the plan in your editor.

copy and paste
claude --permission-mode plan
# then ask:
# Why is the cart total 0? Show the line. No fix yet.

Pro tip: rewind instead of arguing

Esc stops Claude mid-action and keeps the context. Esc twice on an empty prompt, or /rewind, opens a menu to restore an earlier conversation and code state. Checkpoints track only Claude's file edits, not changes made by shell commands, so keep using git.

copy and paste
/rewind

Common mistake

Correcting the same bug again and again. Each failed try stays in the context. After two failed corrections, run /clear and start over with a better prompt: the failing test, the error text and the file. Always give Claude a check it can run. Without one, "looks done" is the only signal it has.

Official docs

One fix of twenty: the whole Claude Code survival kit.

Follow @whyshouldaicare

A new disaster and its fix every day. Comment the word under a reel to get its guide.