Skip to content

Give Claude a Broken Example Before a Fix

2026-08-08claude-code, testing

A useful bug report contains an input that fails and the result you expected. That gives Claude Code something firmer than “the report looks wrong.”

Suppose a weekly summary counts the same invoice twice. Build a tiny fixture with two copies of one invoice and one genuinely different invoice. Ask Claude to reproduce the incorrect total before changing the calculation, then add a test for the intended treatment of duplicates.

After the fix, keep a case where two legitimate invoices share the same amount. Otherwise the repair may remove valid business activity. Save the fixture beside the test so the next person can see which distinction matters. A passing test should protect the rule, not merely repeat the new implementation.

Claude Code documentation.