Tech Update / Adventures with Claude Code #29

Debugging – cause first, fix second

"Here's the error message, make it go away." Claude finds a change in seconds that makes the error disappear. Whether it fixes the cause is another question. A silent try/catch makes any error message vanish.

With a small routine, Claude becomes a good detective instead of a band-aid.

🧾 1. Hand over everything you have

Complete error message including stack trace, steps to reproduce, version, what changed last. Paste logs straight into the session or let Claude run the command itself and read the output.

🔬 2. Hypotheses before code changes

One sentence in the brief makes the difference:

Find the cause, don't change anything yet. Give me two or three
possible explanations and how we can check them.

That way the thinking ends up in the answer and not in a hasty patch.

🔴 3. Reproduce first

Ask for a test that reproduces the bug and is red (part 18). The fix then has a clear target, and the bug doesn't quietly come back.

🕵️ 4. Follow the suspicion

Claude can search logs, use git log and git bisect to find the change that introduced the bug, or add debug output and remove it again.

A word of caution:

Distrust the first plausible fix. When Claude "catches", "ignores" or "checks to be safe", ask: why did the error occur, and why is it no longer triggered?

My rule of thumb:

  • Cause first, then fix.
  • Capture the bug as a red test.
  • Whenever you see "caught", ask: where does the error come from?

← Back to overview