Give a Minimal Reproduction, Not the Whole File
What it is
Why it works
Pasting a whole file forces the model to guess which part matters, and it often fixes something unrelated. Minimising the repro does half the debugging yourself: it frequently reveals the cause outright, and it hands the model a tight problem it can reason about instead of a haystack.
When to use it
Bugs you can't immediately explain, especially in large files where the failure could be anywhere and the surrounding code is a distraction.
When not to use it
Errors with a precise stack trace pointing at one line — there, just paste that line and the trace. And config or environment issues where the code isn't the problem.
Prompt
Minimal repro of the bug:
<smallest snippet that fails>
Input: <exact input>
Expected: <what should happen>
Actual: <what happens>
What's the cause? Keep the diagnosis to this snippet.Example
Trimming a 400-line service down to the 15 lines that misbehave surfaces that the bug is a mutated shared array — obvious once isolated, invisible in the full file.
Common mistakes
- Pasting the entire file and making the model hunt for the relevant code.
- Omitting expected-vs-actual, so the model can't tell what 'wrong' means.
- Not minimising, and thereby missing that the reduction would've revealed the cause.