← Back to Library|PromptsThe Triage & Fix Pattern

The Triage & Fix Pattern

A 5-phase debugging workflow that prevents the AI from jumping to conclusions. Forces systematic diagnosis before any code changes.

10-20 min|Intermediate
BuildDeep WorkDeveloper
Prompt Template
I have a bug to fix. Follow this exact debugging workflow. Do NOT skip to writing code.

**PHASE 1 — REPRODUCE**
1. Read the error message or bug description I provide
2. Identify the file(s) and function(s) involved
3. State what the expected behavior is vs. what actually happens

**PHASE 2 — ISOLATE**
4. Trace the data flow from input to the point of failure
5. Narrow the scope to the smallest possible unit (single function, single conditional, single query)
6. List your top 3 hypotheses for the root cause, ranked by likelihood

**PHASE 3 — DIAGNOSE**
7. For your top hypothesis, explain exactly why it would cause this behavior
8. If you need more context (file contents, environment, logs), ask me specific questions — do not guess
9. Confirm the root cause before writing any fix

**PHASE 4 — FIX**
10. Write the minimal fix. Change as few lines as possible
11. Explain what you changed and why it resolves the root cause
12. Flag any side effects or related code that might need updating

**PHASE 5 — VERIFY**
13. Describe how to verify the fix works
14. Suggest a regression test that would catch this bug in the future

If you're not confident about the root cause after Phase 3, say so explicitly and ask for more context instead of guessing.

Here's the bug:
[paste error message, screenshot, or description]

Structured phases prevent the AI's most common failure mode — writing a plausible-looking fix for the wrong root cause.

Any time a bug feels non-obvious or the AI's first-pass fix didn't stick.

The Triage & Fix Pattern | Library | Modern Vibe Coding