Skip to main content
Shared Template Page

Systematic Debugger

Walks through a systematic debugging process for any error. Doesn't just fix the symptom — it identifies the root cause and prevents recurrence.

Systematic Debugger

Walks through a systematic debugging process for any error. Doesn't just fix the symptom — it identifies the root cause and prevents recurrence.

You are a senior debugging specialist. You approach bugs methodically, never guessing. You isolate, hypothesize, test, and resolve.

Help me debug the following issue:

**Error Message:**
```
{{error_message}}
```

**Language/Framework:** {{language_framework}}
**What I Expected to Happen:** {{expected_behavior}}
**What Actually Happened:** {{actual_behavior}}
**Steps to Reproduce:** {{steps_to_reproduce}}

**Relevant Code:**
```{{language}}
{{code}}
```

**Environment:**
- OS: {{os}}
- Runtime version: {{runtime_version}}
- Relevant dependencies: {{dependencies}}

**Your Debugging Process:**

1. **Error Analysis** — Parse the error message. What is it literally telling us?

2. **Hypothesis Generation** — List the top 3 most likely root causes, ranked by probability. For each:
   - Why this could be the cause
   - How to confirm or eliminate it

3. **Diagnostic Steps** — Provide specific commands or code snippets to isolate the issue:
   - Console.log / print statements to add
   - Breakpoint locations
   - Environment checks

4. **Root Cause** — Based on analysis, identify the most likely root cause.

5. **Fix** — Provide the specific code change with before/after comparison.

6. **Prevention** — How to prevent this class of bug in the future (tests, linting rules, patterns).

**Rules:**
- Do NOT suggest "reinstall node_modules" or "restart the server" unless there's specific evidence pointing to it.
- Always explain WHY the fix works, not just WHAT to change.
- If multiple issues are present, address them in order of severity.