Provides a precise six-phase hypothesis-driven runtime debugging process with minimal instrumentation to identify and fix root causes of unexpected behavior.
---
name: debug-probe
version: 1.0.0
description: Hypothesis-driven runtime debugging with precise instrumentation. Use when debugging bugs, anomalies, or unexpected behavior where static code analysis is insufficient. 6-phase loop: hypothesize → instrument → reproduce → converge → fix → clean up. Triggers on: debug, diagnose, broken, bug, not working, unexpected behavior, investigate, root cause, probe.
---
# Debug Probe
## Quick Start
When you hit a bug that reading code can't resolve:
1. **Hypothesize** — Read source, generate 2-4 falsifiable hypotheses
2. **Instrument** — Insert minimal logging (2-4 points per hypothesis), tag `[DIAG_<topic>]`
3. **Collect** — Build → user reproduces → user exports logs
4. **Converge** — Match logs to hypotheses → confirm root cause
5. **Fix** — Minimal fix → verify with user
6. **Clean up** — Remove ALL instrumentation, confirm build passes
Never skip to fixing. Always clean up after.
## The 6 Phases
### Phase 1: Hypothesize
Read relevant source code. Generate 2-4 testable hypotheses:
```
[H1] Root cause may be X → if true, log would show Y
[H2] Root cause may be Z → if true, log would show W
```
Share hypotheses with user before touching code.
### Phase 2: Instrument
**Rules:**
- Only instrument to test hypotheses — no fishing expeditions
- Tag format: `[DIAG_<topic>]` (short topic like `auth`, `render`, `state`)
- 2-4 instrumentation points per hypothesis
- Mark ALL temporary code: `// DIAG: remove after debug` (adapt comment syntax to language)
- Set up a diagnostic buffer (pick from [TEMPLATES.md](TEMPLATES.md))
Use `diagLog('H1', 'key=val', ...)` — outputs to both console and an in-memory buffer so users can export all logs at once after reproducing the bug.
### Phase 3: Collect
1. Build & deploy
2. User reproduces the bug
3. User exports logs (dump function, console output, log file, etc.)
4. Group logs by hypothesis tag (`[DIAG][H1]`, `[DIAG][H2]`)
5. If expected paths aren't hit → is instrumentation on the right branch? → adjust and rebuild
### Phase 4: Converge
| Situation | Action |
|-----------|--------|
| Logs confirm a hypothesis | Confirmed root cause → Phase 5 |
| All hypotheses refuted | New hypotheses from log clues → Phase 2 |
| Insufficient data | More precise instrumentation → Phase 2 |
Max 2-3 iterations before escalating.
### Phase 5: Fix & Verify
1. Minimal fix targeting confirmed root cause
2. Build → user verifies fix works
3. Fix fails → keep key instrumentation, return to Phase 1
4. Fix works → Phase 6
### Phase 6: Clean Up
**Mandatory.** Search for `DIAG: remove after debug` and:
1. Remove all temporary instrumentation code
2. Remove all diagnostic imports
3. Remove diagnostic buffer file if no longer referenced
4. Build to confirm compilation passes
5. Tell user: instrumentation removed, only fix remains
## Anti-Patterns
- ❌ Skip hypotheses, jump straight to "fixing"
- ❌ Instrument 10+ points — precision beats coverage
- ❌ Dump entire objects — signal drowns in noise
- ❌ Forget Phase 6 cleanup — instrumentation rots
- ❌ Claim "done" without user verification
- ❌ Use raw `console.log` / `print` — use the diag buffer pattern
don't have the plugin yet? install it then click "run inline in claude" again.
restructured original quick-start into implexa's six-part format, made decision branches explicit, added edge cases and rate limits, documented external connections and build system dependencies, kept phase 1-6 procedure faithful to original.
use this skill when a bug resists static analysis and you need runtime evidence to pinpoint root cause. the six-phase hypothesis-driven process (hypothesize → instrument → reproduce → converge → fix → clean up) isolates unexpected behavior through targeted instrumentation, log collection, and iterative refinement. triggers on: debug, diagnose, broken, bug, not working, unexpected behavior, investigate, root cause, probe.
required context:
external connections:
environment setup:
phase 1: hypothesize
[H1] root cause may be X → if true, log would show Yphase 2: instrument
[DIAG_<topic>] (topic examples: auth, render, state, network, cache)// DIAG: remove after debug (adapt syntax to language)diagLog('H1', 'key=val', ...)) that writes to both console and in-memory buffer for exportphase 3: collect
[DIAG][H1], [DIAG][H2], etc.) and examine execution flowphase 4: converge
phase 5: fix and verify
phase 6: clean up
DIAG: remove after debug, diagLog, [DIAG_ comments, diagnostic imports)phase 2 → phase 3: only proceed to collect if you have 2-4 concrete hypotheses and user is ready to reproduce. if context is unclear, ask clarifying questions in phase 1 first.
phase 3 → phase 4: if user cannot reproduce the bug in testing environment, it may be environment-specific (timing, load, data state). ask user to reproduce in their original environment and capture logs there, or provide a more precise repro scenario.
phase 4 (converge branch):
logs confirm hypothesis: route to phase 5 fix.all hypotheses refuted: do not guess; extract clues from logs (unexpected values, code paths that ran earlier than expected, missing branch hits) and formulate new hypotheses. return to phase 2 with refined instrumentation.insufficient data: add more precise logging around ambiguous sections (e.g., log variable state before and after a conditional, add timestamps to track timing issues). return to phase 2 with denser instrumentation.2-3 iterations complete and root cause still unclear: escalate. this indicates the bug is non-deterministic, environment-specific, or requires deeper architectural review.phase 5 (fix verification branch):
fix works: proceed to phase 6 cleanup immediately.fix fails: do not iterate blindly on the fix. keep the key instrumentation that revealed the root cause and go back to phase 1. the hypothesis was wrong or incomplete.phase 6 cleanup: if build fails after removing instrumentation, you removed code that was not actually temporary. restore the instrumented version from phase 2 checkpoint, identify the actual temporary code more carefully, and retry. do not ship instrumentation to production.
edge cases and rate limits:
successful skill execution produces:
DIAG: comments, diagLog() calls, and diagnostic imports removed; source compiles without errordebug-<timestamp>.log for future referencefile locations:
you know this skill worked when:
DIAG: markers are gone from the codebaseanti-patterns that signal failure: