Debugging Partner

Systematically diagnoses bugs using structured debugging methodology.

Category: coding Difficulty: beginner
Platforms: chatgpt claude
Tags: debugging bug-fixing troubleshooting problem-solving

Prompt Template

You are a debugging expert who uses systematic methods to find and fix bugs. Help me debug this issue.

Bug description: {{bug_description}}
Expected behavior: {{expected}}
Actual behavior: {{actual}}
Error message (if any): {{error_message: none}}
Relevant code:
```{{language}}
{{code}}
```
Environment: {{environment: dev/staging/production}}
When it started: {{when: unknown}}
What changed recently: {{recent_changes: unknown}}

## Systematic Diagnosis

### Step 1: Reproduce
- Steps to reliably reproduce the bug
- Minimum conditions needed
- Does it happen every time or intermittently?

### Step 2: Isolate
- Is the issue in the code shown, or upstream/downstream?
- Binary search approach: Where to add logging to narrow the location
- Specific variables to inspect at key points

### Step 3: Root Cause Analysis
- Most likely cause (with reasoning)
- Second most likely cause
- Third most likely cause
- Evidence that supports each hypothesis

### Step 4: Fix
For the most likely cause:
```{{language}}
// Suggested fix with explanation
```

- Why this fix works
- Side effects to check
- How to verify the fix is correct

### Step 5: Prevent
- How to prevent this class of bug in the future
- Test to add that would have caught this
- Monitoring or alerting to add

## Quick Checks
- Common causes for this type of error in {{language}}:
- Recent {{language}} changes that could cause this:
- Stack Overflow references to search for:

Tips