Back to browse
The One Prompt Pattern That Cuts My Debug Time in Half
VIBE-CODING EASY 2 min
This is the shortest tutorial I'll ever write, because it's one idea.
When you're stuck on a bug and you ask an AI for help, your prompt has three parts, in this order:
- What I expected
- What actually happened
- What I've already tried
The pattern in a real example
Say I'm debugging a login form. My instinct is to paste the error and type "why". That gets me a generic answer. Instead:EXPECTED: After clicking Login with valid creds, I get redirected to /dashboard.
ACTUAL: The page flashes, stays on /login, and the network tab shows a 302 to
/dashboard followed immediately by a 302 back to /login.
TRIED: I've confirmed the session cookie is being set (visible in devtools).
I've confirmed the session row exists in the database. The redirect loop seems
to happen because /dashboard thinks the user isn't authed, but I can't figure
out why.
This takes 30 seconds more to write than "login is broken, help." But now the AI has enough to actually diagnose. Usually the answer is something like "your auth middleware probably reads the cookie before the Set-Cookie header has propagated, check how you're calling session.get()."
Without the context, it guesses.
Why each piece matters
Expected: forces YOU to state what you think should happen. Half the time you realize mid-sentence that what you expected was actually wrong. You solve the bug just by typing this part. Actual: the error plus what you observed. Not just the stack trace. The behavior. "This button is supposed to submit, but nothing happens when I click it" is more useful than the JS console output alone. Tried: prevents the AI from suggesting things you already ruled out. Also shows your reasoning, which often reveals where your mental model might be off.The quiet version
When it's a small bug, you can write this in one paragraph:The date picker shows the wrong month when I open it after midnight local time. Expected it to show today's date. Instead it shows tomorrow's date. I think it's because we're comparing in UTC but rendering in local time.That's the same pattern, just less formal. Still has all three pieces.