Skip to content
← All versions
v1current

Get a model to reproduce a bug before it tries to fix it

Turn a vague bug report into a failing test, and refuse to let the model touch the source until that test exists.

by ALPHA WOLVES FC · published Sep 23, 2026

Models are eager to fix. Given a bug report they will edit the file that looks most related, and about a third of the time they fix something that was never broken while the real bug survives. This forces reproduction first: a failing test that isolates the behaviour, confirmed failing, before a single line of source changes. The fix then has a definition of done that is not someone's judgement.

Target models
claude-opus-4.5, claude-sonnet-4.5, gpt-4o-2024-11-20
Time
25 min
Difficulty
Medium
Cost
~14,000 input tokens including file context, ~3,000 output tokens (roughly $0.26 on Opus 4.5)

Tools / stack

Claude Code or an IDE assistantyour test runnerthe repository

Inputs required

The bug report as written, the relevant module, and the ability to run the test suite

Steps

  1. 1.Restate the bug as an observable condition: what input produces what wrong output. If the report does not support that, ask before proceeding.
  2. 2.Write a test that asserts the correct behaviour and nothing else. No snapshots, no incidental assertions.
  3. 3.Run it and confirm it fails, for the reason you expect. A test that fails on a setup error proves nothing.
  4. 4.Only now read the source, and only the path the test exercises.
  5. 5.Make the smallest change that turns the test green, and run the full suite to check nothing else moved.
  6. 6.Report what the root cause was, and whether the original bug report described it accurately

Expected output

A failing test confirmed before any fix, the minimal change that greens it, a full suite run, and a root cause statement

Golden Example

Input
Bug report reading "dates are wrong on the export sometimes", plus the export module
Output
Test written asserting that a date on the last day of a month exports unchanged. Confirmed failing. Root cause was a timezone conversion applied twice, four files away from where the reporter assumed. Two line fix, suite green, report noted the original description pointed at the wrong module.