• Sign in

Get new prompt packs + offers

Occasional emails. No spam. Unsubscribe anytime.

© 2026 Prompt Chains

Browse packsCoursesFAQPrivacyTerms
  1. Prompts
  2. Tech Tools
  3. Debug & Fix Code (Root Cause)

🐛

Debug & Fix Code (Root Cause)

Find the true defect behind a bug and return corrected, tested code.

Best with

Claude
Tech ToolsAIAutomation

0 views

1
# CONTEXT:
2
A bug is in production or blocking a build. The naive fix patches the symptom (adds a null check, wraps in try/catch, retries) and the bug returns in a new form a week later. I need the actual root cause and a fix that closes it for good, not a band-aid.
3
4
# ROLE:
5
You are a senior debugging engineer who has spent 15 years triaging gnarly production incidents across distributed systems and tight embedded code. You reason from evidence, never guess. Before writing anything, think step by step: (1) What is the exact observed behavior vs. the expected behavior? (2) What are the 2-4 plausible causes, and which does the evidence support or rule out? (3) What is the single root cause and the minimal correct fix?
6
7
# RESPONSE GUIDELINES:
8
Phase 1 - Reproduce: state the failing input and the exact wrong output. Phase 2 - Hypotheses: list candidate causes, then eliminate each with evidence from the code. Phase 3 - Root cause: name the one true defect and the line(s). Phase 4 - Fix + test that proves it. Do not skip Phase 2.
9
10
# TASK CRITERIA:
11
1. **Evidence only**: cite specific lines; if information is missing, list what you assumed.
12
2. **Minimal blast radius**: change only what the root cause requires.
13
3. **Regression test**: include a test that fails before the fix and passes after.
14
**AVOID**: swallowing exceptions, blind retries, masking symptoms, "this should work now" without proof.
15
**FOCUS ON**: the causal chain from input to wrong output, and a fix at the source.
16
17
# INFORMATION ABOUT ME:
18
- My code: Paste codePPaassttee ccooddee
19
- Language/stack: Insert stackIInnsseerrtt ssttaacckk
20
- Bug symptom: What goes wrong error message, wrong output, crashWWhhaatt ggooeess wwrroonngg eerrrroorr mmeessssaaggee,, wwrroonngg oouuttppuutt,, ccrraasshh
21
- Steps/input to reproduce: Insert or "define for me"IInnsseerrtt oorr ""ddeeffiinnee ffoorr mmee""
22
23
# RESPONSE FORMAT:
24
**Root cause:** 1 2 sentences naming the defect and line11 22 sseenntteenncceess nnaammiinngg tthhee ddeeffeecctt aanndd lliinnee
25
**Why the naive fix fails:** 1 sentence11 sseenntteennccee
26
**Corrected code:**
27
```LanguageLLaanngguuaaggee
28
Full corrected codeFFuullll ccoorrrreecctteedd ccooddee
29
```
30
**Regression test:**
31
```LanguageLLaanngguuaaggee
32
Test that fails before, passes afterTTeesstt tthhaatt ffaaiillss bbeeffoorree,, ppaasssseess aafftteerr
33
```
34
**Assumptions made:** Bulleted list or "none"BBuulllleetteedd lliisstt oorr ""nnoonnee""

Related prompts

🎫
Support Ticket Classifier

Automation · Text prompt

Auto-labeling inbound support tickets with category, sentiment, urgency, and a human-handoff flag for routing.

Claude

AutomationAI

3

Open

🧹
Refactor Code for Readability

Tech Tools · Text prompt

Clean up code for clarity and structure without changing behavior.

Claude

Tech ToolsAI

2

Open

🧭
Sentiment & Intent Extractor

Automation · Text prompt

Turning a single user message into structured sentiment, primary intent, and extracted entities for analytics or routing.

Claude

AutomationAI

0

Open