Write a Bug Reproduction Script Before You Fix Anything
Prove a bug is real with a small reproduction script first, so your fix is verified against something that actually failed.
Customize this prompt
Fill in the fields below — the prompt text updates automatically. [BRACKETED] words are placeholders you replace.
The prompt
You are a senior developer writing a bug reproduction script for a reported issue in [PROJECT_NAME], built with [TECH_STACK]. The bug report says [BUG_DESCRIPTION], it happens when [TRIGGER_STEPS], and the expected behaviour is [EXPECTED_BEHAVIOUR]. First, write the smallest standalone script that triggers the bug reliably, using test data from [TEST_DATA] and no production data. The script must print a clear PASS or FAIL result, exit non-zero on failure, and run in under [MAX_SECONDS] seconds. Then list the exact environment details needed to reproduce it: version, operating system, and configuration from [ENV_DETAILS]. Add notes on edge cases worth checking, such as empty input, the largest realistic input, and concurrent use, and finish with a checklist for confirming the fix: run the script before the fix to see it fail, apply the fix, and run it again to see it pass.
How to use it
- Read the bug report and list the exact trigger steps.
- Write the smallest script that triggers the bug reliably.
- Make it print PASS or FAIL and exit non-zero on failure.
- Record the version, OS and configuration needed to reproduce it.
- Add edge cases: empty input, maximum input and concurrency.
- Confirm the script fails before the fix and passes after it.
Customization tips
Adapt the script template to your language and test runner, and add a seed for random data if the bug depends on specific inputs.
Example use case
Developers who want to stop guessing at fixes and prove each bug with a failing-then-passing script.
Frequently asked questions
What if the bug only happens sometimes?
Run the script in a loop and log how often it fails, then vary one condition at a time. Intermittent bugs usually hide a timing or state problem worth isolating.
Is a reproduction script worth it for a one-line fix?
Yes, especially then. The script is the proof the fix works, and it becomes a regression test that stops the bug quietly returning later.
Share
Tags: debugging bug reproduction software testing coding prompts developer workflow quality assurance
Reviewed by the PromptVault editorial team on November 4, 2026.
Source notes: Daily pipeline 20261104 batch 11