What this prompt does
This prompt turns ChatGPT into a systematic debugging partner. You feed it the [error_message], the [context] of what you were doing, your [environment], and your [attempted_fixes]. It then parses the error, lists [diagnostic_count] diagnostic steps in order of likelihood with the exact command or code for each, isolates the root cause rather than the symptom, proposes a fix, explains why your attempts failed, suggests a preventive guard, rates its own confidence, flags cascading risks, and writes a regression test.
The structure works because it forces the model to slow down. Most quick debugging answers jump straight to a patch; this one demands ordered hypotheses and a root-cause step, which is what stops you from shipping a band-aid. Telling it your [attempted_fixes] keeps it from suggesting things you already ruled out, and the confidence rating plus the regression test are honesty mechanisms: they make the model commit, and they catch the bug if it returns.
When to use it
- A production error you cannot reproduce locally and need a structured plan for.
- A bug that came back after a previous "fix" did not address the real cause.
- An unfamiliar stack trace where you want ordered hypotheses, not guesses.
- Onboarding into a codebase where you don't yet know the common failure modes.
- Any fix you want hardened with a regression test before you close the ticket.
- Reviewing whether a proposed fix could cause cascading issues elsewhere.
Example output
You get a numbered diagnostic plan: [diagnostic_count] steps ranked by likelihood, each with a runnable command or snippet, followed by a root-cause analysis, a concrete fix with explanation, a short note on why each of your [attempted_fixes] missed, a preventive measure (test, lint rule, or guard clause), a low/medium/high confidence rating, a cascading-impact note, and a ready-to-paste regression test.
Pro tips
- Paste the full
[error_message]including the stack trace; truncating it removes the clues the model ranks hypotheses on. - Fill
[attempted_fixes]honestly so the model skips dead ends and explains why they failed. - Be specific in
[environment](versions, OS, dev vs prod); the same error has different causes across versions. - Treat a low confidence rating as a signal to gather more data, not as a reason to discard the answer.
- Actually add the regression test it writes; that step is what stops the bug from silently returning.
- If the root cause looks like a symptom, push back: ask "what causes that?" until the chain bottoms out.