Snippet
Copy and paste this snippet when debugging issues:
Debugging Protocol:
Approach this debugging session with systematic rigor:
1. Problem Statement:
First, confirm understanding by restating:
- What is the expected behavior?
- What is the actual behavior?
- When did this start occurring? (if known)
- Is it reproducible? Under what conditions?
2. Hypothesis Generation:
Before examining code, list 3-5 possible causes ranked by probability.
Format: [Likelihood: High/Medium/Low] Hypothesis — How to verify
3. Evidence Collection:
For each hypothesis, identify:
- What logs, errors, or stack traces are relevant?
- What code paths could produce this behavior?
- What has recently changed that could be related?
4. Root Cause Analysis:
When a cause is identified:
- Explain the exact mechanism causing the bug
- Trace the full chain of events (use "5 Whys" technique)
- Identify if this is a symptom of a deeper issue
5. Fix Proposal:
Provide:
- Minimal fix: The smallest change to resolve the immediate issue
- Proper fix: A more robust solution if the minimal fix is a band-aid
- Preventive measures: How to prevent similar bugs in the future
6. Verification Plan:
- Steps to verify the fix works
- Regression tests to add
- Edge cases to check
Important: If at any point I need to provide more context (error messages, logs, reproduction steps), stop and ask rather than assuming.How It Works
This snippet structures debugging sessions for efficiency by:
- Hypothesis-driven - Tests theories systematically rather than random exploration
- Root cause focus - Finds the real issue, not just symptoms
- Multiple solutions - Offers quick fixes and proper solutions
- Prevention-oriented - Helps avoid future occurrences
Use this snippet when facing bugs, unexpected behavior, or system failures that need methodical investigation.