Systematic Debugging Analysis
Description
Structured problem-solving framework for identifying root causes, generating solutions, and preventing future issues.
The Prompt
Task
Analyze the programming issue described below and provide a systematic debugging solution.
Issue Report
Problem Statement
What's Happening: [Describe the unexpected behavior]
Expected Behavior: [What should happen instead]
Impact: [Critical/High/Medium/Low - How does this affect functionality?]
Environment
- Language: [e.g., JavaScript, Python, Go]
- Version: [e.g., Node 20.x, Python 3.11]
- Framework/Library: [e.g., React 18, Django 4.2]
- Platform: [e.g., Browser (Chrome 120), Ubuntu 22.04, iOS 17]
- Package Manager: [e.g., npm 10.x, pip 23.x]
- Build Tool: [e.g., Vite, Webpack, none]
Code Context
[PASTE THE RELEVANT CODE HERE]
Error Output
[PASTE FULL ERROR MESSAGE OR STACK TRACE]
What I've Tried
- [Action 1 and result]
- [Action 2 and result]
Additional Context
- When did this start? [After specific change, always present, intermittent]
- Can you reproduce it consistently? [Yes/No/Sometimes]
- Any recent changes? [Dependency updates, config changes, etc.]
Analysis Framework
Provide your response in this structure:
1. Initial Assessment
Error Type Classification:
- Syntax Error
- Runtime Error
- Logic Error
- Configuration Issue
- Dependency Conflict
- Environment Issue
- Race Condition
- Memory/Resource Issue
Likely Cause: [Your hypothesis based on the error]
2. Root Cause Analysis
Why This Error Occurs
[Explain the underlying mechanism causing the error]
Contributing Factors
- [Factor 1]
- [Factor 2]
- [Factor 3]
Similar Patterns
"This is similar to [common pattern/known issue] which happens when..."
3. Solution
Step-by-Step Fix
Step 1: [Action]
// Current (problematic) code
[show exact code causing issue]
// Fixed code
[show corrected version]
Why this works: [Explanation]
Step 2: [Action]
[code if applicable]
Step 3: [Verification] [How to test the fix]
Alternative Solutions
If the primary solution doesn't work:
Alternative 1: [Approach] Alternative 2: [Approach]
4. Prevention Strategy
How to Avoid This in Future
-
[Prevention Method 1]
- Implementation: [How to do it]
- Example:
[code snippet]
-
[Prevention Method 2]
- Linting rules, type checking, tests, etc.
Warning Signs to Watch For
- [Sign 1 that this might happen again]
- [Sign 2]
5. Debugging Tools & Techniques
For This Specific Issue:
- [Tool 1]: [How to use it for this problem]
- [Tool 2]: [How it helps]
General Debugging Setup:
- [Recommended debugger setup]
- [Logging strategy]
- [Profiling tools if performance-related]
6. Learning Resources
- [Link to relevant documentation]
- [Similar issues for reference]
- [Conceptual explanation if needed]
Output Constraints
- Be specific with code examples
- Show EXACT changes needed (not "fix the variable" but "change line 23 from X to Y")
- Explain the WHY, not just the WHAT
- If multiple causes are possible, rank by likelihood
- Include console commands/debugging steps where applicable