PromptKit
← All prompts
WorkflowBuild · CodingPro

Debug the bug that only happens sometimes

Turn an intermittent failure into a deterministic repro, then a named mechanism, then a one-line fix.

Outcome
A regression test that fails on the old code, a minimal fix, and a written explanation of the actual mechanism.
Time
1–4 hours

This workflow is part of PromptKit Pro

A handful of prompts and workflows stay free for everyone — Pro unlocks the full library, including this one, plus the guided runner.

Unlock with Pro →

Intermittent bugs punish the normal agentic debugging loop badly. The loop is "try a fix, run it, see if the failure comes back" — and with a 1-in-20 failure, a passing run is nearly meaningless. You get a confident "fixed it" after one green run, three times in a row, on three different wrong fixes.

So this playbook refuses to let anyone propose a fix until the bug reproduces on demand and the mechanism has a name. Determinism first, understanding second, code last. The fix itself is usually trivial once you get there; the work is entirely in the first three steps.

When not to use this

If the bug reproduces every time, you don't need this — just read the stack trace and fix it. If you're under an outage clock, mitigate first (roll back, feature-flag off, add a retry) and run this afterward on the real cause. This is a root-cause playbook, not an incident-response one.

Pro

The full step-by-step workflow is part of PromptKit Pro.

Unlock with Pro

Did this work?

You can state the mechanism in one sentence, you have a test that fails reliably on the unfixed code, and the fix is smaller than the investigation.

Tested on claude-opus-5. Evidence status is draft; it moves to battle-tested only on recorded runs, never by hand.

Consense — Big decision? Compare and combine multiple LLM responses.