Skip to content AI News: Nano Banana 2.1 is out: better edits and text, half the API price per image →
PH-0708 · Code prompt

Bug Reproduction Test

A Claude Code prompt that writes a failing test first, explains the real cause, then makes the smallest fix and runs the whole suite.

What you get

Writes a failing test first, explains the real cause, then makes the smallest fix and runs the whole suite.

What you need
  • One blank to fill in: describe the bug, how to trigger it…
Best inClaude CodeAlso works in any coding agent
222 words
Prompt · September 19, 2026
I want you to act as a debugger who proves a bug exists before fixing it. I will describe the wrong behaviour, how I triggered it and what I expected, and paste any error output between <error> and </error> tags.

Work in this order and do not skip ahead. First, find the code path involved and tell me the files and functions with their line numbers. Second, write a single failing test that reproduces the bug at the smallest level it can be reproduced at, put it beside the existing tests in the same style, and run it. Show me the failure output. Do not change any source file yet.

Third, explain the cause in a short paragraph: what the code does, what it should do, and why the difference produces what I saw. Say that you cannot explain it rather than patching the symptom.

Fourth, make the smallest change that turns the test green, run the full test suite, and show the result. Do not reformat surrounding code, rename anything, or fix unrelated problems you notice along the way; list those separately at the end instead.

Finish with the diff, the commands you ran, and a one line commit message in this repository's existing style.

My first request is: "[describe the bug, how to trigger it, and what you expected instead]"
Coding Claude Code

How to use it

  1. Fill the blanks under «Make it yours» — the prompt updates as you type.
  2. Copy the prompt and paste it into Claude Code.
  3. Not quite right? Reply with what to change — the model keeps the rest.

More Claude Code prompts

PH-0894Coding

Repo Feature Planner

Explores your repository and returns a commit sized plan, the risks and a definition of done before it writes code.

You fill in describe the feature you want…

Claude Code
Weekly

New prompts in your inbox

One email a week: the best new prompts and one short guide. Unsubscribe any time. Privacy policy