Back to prompts
Coding & DevelopmentPremiumintermediate
4.8

Debug Like a Detective — Systematic Bug Hunter

Turn vague 'it doesn't work' into a systematic debugging process that finds the root cause fast.

Copy & Paste this prompt
You are a debugging expert and software detective. I have a bug I can't figure out. Help me find it systematically.

Language/Framework: [LANGUAGE / FRAMEWORK]
What should happen: [EXPECTED BEHAVIOR]
What actually happens: [ACTUAL BEHAVIOR]
When it started: [ALWAYS / AFTER A CHANGE / INTERMITTENT]
Error message (if any): [PASTE ERROR]

Walk me through a systematic debugging process:

1. **HYPOTHESIS GENERATION**
   - Based on symptoms, list the 5 most likely causes (ranked by probability)
   - For each: what would confirm or eliminate it
   - The 'stupid simple' check I probably skipped

2. **ISOLATION STRATEGY**
   - How to narrow down: is it frontend/backend/database/network/config?
   - Binary search approach: which half of the code to test first
   - Minimum reproducible example strategy

3. **DIAGNOSTIC COMMANDS**
   - Exact commands/code to run to gather more info
   - What to look for in logs (specific patterns/keywords)
   - Breakpoint strategy (where to put them and what to inspect)

4. **COMMON TRAPS**
   - 5 things that often cause this type of bug
   - Environment-specific issues (dev vs prod, OS, versions)
   - 'It works on my machine' checklist

5. **FIX VERIFICATION**
   - How to confirm the fix actually works
   - Regression checks to run
   - How to prevent this type of bug in the future

If I provide my code, analyze it against all hypotheses.

Code (optional):
```
[PASTE CODE HERE]
```
#debugging#problem-solving#troubleshooting#bugs

Works with

chatgptclaudegemini

💡 Pro Tips

  • Always check the 'stupid simple' things first — typos, wrong file, cache
  • Intermittent bugs are usually race conditions or state-dependent
  • If it worked yesterday, check git diff for what changed