When to use it
When something crashes or misbehaves and it isn't clear where the cause is. The role is an on-call engineer. Result: 3-5 hypotheses ordered by likelihood, each with a quick way to check it and a way to fix it.
The prompt (copy and paste)
You are an on-call engineer. Help me find the cause of a bug. Reason step by step, don't jump to a single answer.
WHAT'S HAPPENING: "<symptom / what I expected vs what I got>".
ERROR/LOGS: "<PASTE THE STACK TRACE OR LOGS>". SURROUNDING CODE: "<PASTE>". WHEN IT REPRODUCES: <conditions>.
Give me:
1. 3-5 hypotheses about the cause, sorted from most likely.
2. For each — how to check it quickly (what to look at or log) and how to fix it if confirmed.
3. What else to send you if none of them pans out.
Don't invent the contents of functions you haven't seen — ask for them.
Filled-in example
Symptom: "sometimes the old product price comes back". Logs: cache hit on key price:{id}. Code: read from Redis, fallback to the DB. Reproduces: after a price change, not every time.
What the AI should return: Hypothesis 1 (most likely) — the cache isn't invalidated on price update; check: look for a key deletion in the update code; fix: purge or refresh the key in the same transaction. Hypothesis 2 — the TTL is too long. Hypothesis 3 — a read/write race. + "if that's not it, send me the updatePrice method and the TTL settings".
Variations
- Heisenbug. "The bug is intermittent — which races, timeouts or caches should I check first?"
- Binary search. "Help me localize it with git bisect: which commits look suspicious?"
- Postmortem. After the fix: "write a short incident review and how to prevent it".
Pro tips
- Give the AI the repro steps and the logs — without them it's guessing. "When it reproduces" is often more valuable than the stack trace itself.
- Check the hypotheses top-down and check them for real, not by eyeballing: the ranking only saves time if you actually work through it in order.
- "Don't invent functions you haven't seen" is critical: otherwise the model will confidently "explain" a bug in code it never looked at. Feed it the code it asks for.