Describe your bug and get systematic debugging guidance with root cause analysis, hypotheses, and fix strategies.
Copy & paste the prompt below into your preferred LLM. Unless a specific AI model is mentioned, you can use whichever you prefer.
You are a senior developer and debugging mentor. Help me systematically debug this issue. My bug: - What should happen: [EXPECTED BEHAVIOR] - What actually happens: [ACTUAL BEHAVIOR] - Error message (if any): [PASTE ERROR] - When it started: [WHEN DID THIS FIRST OCCUR?] - What changed recently: [CODE CHANGES, DEPLOYMENTS, CONFIG UPDATES, DEPENDENCIES] - Steps to reproduce: [HOW TO TRIGGER THE BUG] - Environment: [OS, LANGUAGE VERSION, FRAMEWORK, BROWSER, etc.] - What I've tried: [DEBUGGING STEPS ALREADY TAKEN] - Relevant code: [PASTE THE SUSPICIOUS CODE SECTION] Guide me through systematic debugging: 1. **Bug Classification:** What category is this? (Logic error, race condition, state management, config issue, dependency conflict, environment-specific, data-related) 2. **Hypothesis Generation:** Generate 5 possible root causes ranked by likelihood, with reasoning for each 3. **Diagnostic Steps:** For each hypothesis, the exact steps to confirm or eliminate it (specific console.logs, breakpoints, queries, or commands to run) 4. **Isolation Strategy:** How to narrow down the problem area (binary search through code, minimal reproduction, removing components) 5. **The Fix:** Once identified, the recommended fix with code. Address the root cause, not just the symptom 6. **Verification:** How to confirm the fix works and hasn't broken anything else 7. **Prevention:** How to prevent this class of bug in the future (better tests, type safety, validation, monitoring) 8. **Learning Note:** What this bug teaches about the system's architecture or your debugging process Debugging is detective work. Follow the evidence, not your assumptions.
"Debugging Rubber Duck" applies research-backed prompting principles: creative divergence and reasoning elicitation. These are the same techniques used by professional prompt engineers to get predictable, high-quality results. What you get back is production-quality code that handles edge cases and follows your stack conventions - production-ready rather than a rough draft that needs heavy reworking.
These coding tips will help you get stronger results when using "Debugging Rubber Duck" and similar prompts in this category.
"Debugging Rubber Duck" is particularly useful in these situations. If any of these scenarios sound familiar, this prompt will save you significant time.
When you use "Debugging Rubber Duck" with ChatGPT, Claude, or Gemini, here is what to expect in the AI output.
Adapt "Debugging Rubber Duck" to your specific situation by modifying these key areas. The more context you add, the better the results.