Objective
Your mission
Debug a real bug using the structured 4-step loop: paste with context, diagnose, fix, verify. Output: debugging_loop_log.md.
You need: Any AI coding tool with a project that has (or can have) a bug.
Time: 25 minutes.
Step 1: learn the 4-step loop (5 min)
Step 1 — Paste (with context): Don't just paste the error. Give the AI three pieces of context:
"I was [what you were doing] and expected [what you expected], but instead I got [what actually happened]. Here's the error: [error message]. Here's the relevant code: [paste code]."
Step 2 — Diagnose (ask, don't just accept):
"What's causing this error? Explain the diagnosis before suggesting a fix."
Compare the diagnosis to your prediction. If it doesn't match your symptoms, push back.
Step 3 — Fix (review the proposed fix):
"OK, that diagnosis makes sense. What's the fix?"
Review: does it address the root cause? Does the diff look reasonable? Any new red flags?
Step 4 — Verify (test the fix):
- Does the original error go away?
- Does the feature work correctly?
- Did the fix break anything else?
- Are there new edge cases?
If the fix works: commit and move on. If not: go back to step 1.
Why 'diagnose before fix' matters
When you ask the AI to diagnose before fixing, you get two benefits: (1) you can compare the diagnosis to your prediction, building debugging instinct, and (2) you can catch the AI when its diagnosis is wrong. If the AI diagnoses incorrectly and immediately applies a fix, the fix won't work — and now you have the original error PLUS the AI's incorrect fix making things worse.
Step 2: build or open a project (2 min)
Build something with AI or use an existing project. Create or find a bug — break something intentionally if needed.
Step 3: run the 4-step loop (15 min)
Work through each step of the loop with your bug.
Write in your file:
## Step 1: Paste (with context)
What I was doing: [action]
What I expected: [expected result]
What actually happened: [actual result]
Error message: [full error]
Relevant code: [paste the code around the error]
## Step 2: Diagnose
My prediction (from predict-before-reveal): "I think the error is because..."
Prompt to AI: "What's causing this error? Explain the diagnosis before suggesting a fix."
AI's diagnosis: [summary]
Does the diagnosis match my symptoms? [yes/no]
Does it make sense? [yes/no — reasoning]
## Step 3: Fix
AI's proposed fix: [summary]
Does it address the root cause? [yes/no]
Does the diff look reasonable? [yes/no]
Any new red flags? [yes/no — what?]
## Step 4: Verify
1. Original error gone? [yes/no]
2. Feature works correctly? [yes/no]
3. Nothing else broke? [yes/no]
4. Edge cases tested? [results]
## Outcome
Fixed? [yes/no]
If not fixed: what's the new information for round 2?
Step 4: if not fixed, run round 2 (3 min)
If the fix didn't work, go back to step 1 with the new information. Note what changed.
Write in your file:
## Round 2
[Same 4-step structure with updated context]
Why ask the AI to explain its diagnosis before it applies a fix?
A wrong diagnosis applied straight away leaves you with the original bug plus a bad fix. Diagnosis first lets you check it against your prediction and symptoms.