Skip to main content

Claude/ChatGPT (or Cursor) Prompt to Build a Minimal Reproducible Example

Produce a minimal, self-contained bug reproduction in one file, perfect for GitHub issues, gists, and Stack Overflow, with expected vs observed output.

Füllen Sie die Platzhalter aus

Edit the values, then copy your finished prompt.

Ihr Prompt
prompt.txt

                                

What this prompt does

This prompt produces a minimal, self-contained bug reproduction in a single runnable file — the kind that turns a vague report into something maintainers can act on. It casts the assistant as a senior [language] engineer who writes flawless minimal reproductions and takes four context variables: [language], [max_lines], [environment], and [bug_description]. The deliverables are one self-contained file under the line cap with no external services, only the code needed to trigger the bug, inline comments pointing at the suspected cause, run instructions for the environment, expected versus observed output side by side, and a one-line hypothesis for why it happens.

The structure works because the hardest part of a good repro is subtraction, not addition. By enforcing [max_lines] and "no external services," the prompt forces the model to strip everything unrelated until only the triggering code remains. The expected-versus-observed pairing is what makes the report instantly legible to a maintainer — they see the gap immediately. The one-line hypothesis gives a starting point for the fix without over-committing to a diagnosis.

When to use it

  • Filing a bug report on GitHub, a gist, or Stack Overflow that won't bounce back
  • When a report keeps getting "can't reproduce" and you need something airtight
  • When you want to isolate a bug from a large codebase down to its essence
  • When answering someone else's vague issue and need a clean repro to reason about
  • When you suspect a library bug and need a case the maintainers can run instantly
  • When debugging is stalled because the failure is tangled up in unrelated code

Example output

You get a single file under [max_lines] lines that runs with no external services, containing only the code needed to trigger the bug. Inline comments point at the suspected cause so a reader knows where to look first. Below or alongside it, run instructions for [environment], the expected output and the observed output shown side by side, and a one-line hypothesis. Nothing extraneous — the whole artifact is built to be pasted into an issue and run as-is. The side-by-side output block is what does the heavy lifting, because it communicates the bug faster than any paragraph of description and removes the usual round of clarifying questions.

Pro tips

  • Set [max_lines] aggressively low; a tighter cap forces a cleaner, more legible repro
  • Pin [environment] precisely ("Python 3.12, standard library only") so the maintainer's run matches yours
  • Lead your issue with the expected-versus-observed block — it's the fastest way to communicate the bug
  • If the first repro still pulls in a dependency, push back and demand a standard-library-only version
  • Give [bug_description] enough detail to reproduce; a thin description yields a thin repro
  • Treat the one-line hypothesis as a lead to verify, not a confirmed root cause

Frequently Asked Questions

Will the reproduction really be a single file?
Yes. The prompt requires one self-contained file under your line cap with no external services or databases. That constraint is what makes the repro instantly runnable for a maintainer, since they don't need to set up anything beyond the language runtime.
How short can I make the max_lines cap?
As short as still reproduces the bug. A tighter cap forces more aggressive stripping, which usually produces a cleaner, more legible example. If the model can't fit the repro, it's a sign the bug genuinely needs more setup to trigger.
Does it diagnose the root cause?
It offers a one-line hypothesis and inline comments pointing at the suspected cause, but treat these as leads rather than confirmed diagnoses. The repro's real job is to let you or a maintainer observe the failure reliably and investigate from there.
Is this only useful for filing issues?
No. A minimal repro is just as useful when your own debugging is stalled because the failure is tangled in unrelated code. Isolating it to one file often makes the cause obvious without ever opening an issue.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

Mehr in AI Coding Assistants

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support