Back to Prompts

Systematic Debugging Analysis

DebuggingTroubleshootingProblem SolvingError Analysis
Added: December 14, 2025Difficulty: IntermediateWorks with: ChatGPT, Claude, Gemini

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

  1. [Factor 1]
  2. [Factor 2]
  3. [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

  1. [Prevention Method 1]

    • Implementation: [How to do it]
    • Example: [code snippet]
  2. [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

How to Use

1. Copy the prompt 2. Fill in all sections under 'Issue Report' 3. Include complete error messages and relevant code 4. Mention what you've already tried 5. Paste into AI tool for systematic analysis

How to Customize

• Add performance metrics if it's a performance issue • Include network logs for API/backend issues • Specify browser DevTools console output for frontend issues • Add memory/CPU usage for resource problems • Include test case that reproduces the issue • Mention production vs development environment differences

Expected Outcome

Comprehensive debugging analysis with: - Clear identification of root cause - Step-by-step fix with code examples - Explanation of WHY the solution works - Prevention strategies for the future - Tool recommendations - Alternative solutions if primary fix doesn't work

Pro Tips

The more context you provide, the better the analysis. Include: recent git commits, dependency versions (package.json/requirements.txt), environment variables that might be relevant, and any unusual console warnings. For intermittent issues, describe the pattern (time of day, user actions that trigger it).