Find and Fix the Root Cause of a Bug
Move from an error report to a reproducible failure, a focused fix, and a regression check.
- Reproduction first
- Evidence before guesses
- Regression coverage
When to use it
Something breaks, behaves inconsistently, or only works on your machine.
Bring this context
Reproduction steps, expected and actual behavior, relevant logs, and environment details.
fix-the-root-cause.md
copy · customize · try itHelp me fix this properly.
Expected behavior: [what should happen]
Actual behavior: [what happens instead]
Steps to reproduce: [numbered steps]
Environment: [browser, runtime, versions, or deployment]
Evidence: [error, stack trace, relevant logs]
Recent change that might matter: [change or unknown]
Trace the failing path through the code. Separate observed facts from hypotheses. Try to reproduce the failure with the smallest useful case. If you can't reproduce it, say what evidence is missing and narrow the uncertainty before changing behavior.
Fix the cause with the smallest maintainable change. Keep existing access checks and input validation intact. Don't hide the failure by swallowing errors, disabling checks, or returning a fake success.
Add a regression check that fails for the original bug and passes with the fix when practical. Check a nearby success case and a meaningful failure case. Run the relevant existing checks too.
Return: the cause in plain English, the change, the reproduction or test evidence, and any remaining uncertainty. If a tool or environment prevents verification, give me the exact next check to run.Make this prompt yours
- 1. Download or copyCopy the prompt into your AI tool, or download a copy to keep.
- 2. Customize itReplace bracketed details with your context. Include a real example when you can.
- 3. Test it on real workTry a real task, inspect the output, and refine the prompt where the result misses the mark.
Research behind this prompt
An original DevLaunch adaptation, informed by these sources. Reviewed September 23, 2026; source publication dates vary. Test the result against your own work.
- Anthropic · Claude Code best practices ↗
Inspect the project first and give the agent a way to verify its work.