Debug

From OutlineDriven/odin-codex-plugin · View interactive version

Debug is an AI agent skill from the GitHub repository OutlineDriven/odin-codex-plugin. Hypothesis-driven defect isolation — stack-trace forensics, breakpoint strategy, state inspection, and root-cause confirmation via minimal repro. Use when a defect surfaces (test failure, crash, exception, wrong output, intermittent flake) and the cause is not immediately obvious from the change set

How to use this skill

Skill file

A bug is a falsified assumption. Find the assumption, falsify it deliberately, observe the divergence, narrow until one line owns the lie. No speculation, no shotgun edits, no "fix and rerun" guessing.

When to Apply / NOT

Apply: test fails and cause unclear; production stack trace; intermittent / flaky behavior; wrong output without crash; regression after known commit window; heisenbug.

NOT apply: performance regression with correct outputs; security defect; symptom obvious from one-line read; architectural confusion.

Anti-patterns

Hypothesis Loop (language-neutral)

  1. Observe — Reproduce the failure deterministically.
  2. Trace — Read the failure artifact (stack, log, core dump).
  3. Hypothesize — One falsifiable claim. Rank hypotheses by likelihood.
  4. Instrument — Insert minimum probe (breakpoint, structured log, assertion).
  5. Run — Execute the minimal repro.
  6. Confirm or refute — If refuted, demote and pick next hypothesis.
  7. Narrow — Binary-search the suspect range. Use git bisect for regressions.
  8. Confirm root cause — Inverse test: removing/altering the cause must restore correctness.
  9. Hand off — Forward to TDD: minimal repro becomes permanent failing test.

Stack-Trace Reading

Parallel Tooling

| Family | Live debugger | Postmortem / record | Remote attach |

|---|---|---|---|

| Systems (C/C++/Rust) | gdb, lldb, rust-gdb, rust-lldb | coredumpctl + gdb core, rr record/replay | gdb -p <pid> / lldb -p <pid> |

| Python | pdb, ipdb, pdbpp, breakpoint() | faulthandler, py-spy dump, traceback module | debugpy --listen |

| Go | dlv debug, dlv test, dlv attach <pid> | runtime/pprof, GOTRACEBACK=crash | dlv connect <addr> |

| Java/Kotlin | IntelliJ debugger, jdb | hs_err logs, JFR, heap dump (jmap) | JDWP -agentlib:jdwp=... |

| JavaScript/TypeScript | node --inspect, Chrome DevTools | --report-uncaught-exception reports | --inspect=0.0.0.0:9229 |

| OCaml | ocamldebug, Printexc.record_backtrace true | core file + ocaml-gdb, memtrace | ocamldebug -s <socket> |

Use procs (not ps) for PID. Use bat -P -p -n (not cat) for trace files. Use git grep -n -C 3 'pattern' (not grep) for callsites.

Constitutional Rules

  1. Reproduce before fixing.
  2. One hypothesis at a time.
  3. Evidence over inference.
  4. Capture the bug as a test (hand to TDD).
  5. Confirm with inverse.
  6. Bisect for regressions.
  7. No silent edits.

Reasoning approach

Before hypothesizing a fix, reason through the failure — SHORT-form KEYWORDS for trace notes, observe the symptoms, trace the execution path, break down where actual behavior diverges from expected, critically review each candidate cause, validate each hypothesis against the evidence. The root cause is the smallest explanation that accounts for all observed symptoms. For numeric calculation (timing math, bound arithmetic, off-by-N analysis), invoke fend per the baseline rule; never self-calculate. Causal reasoning and trace interpretation are in-head — they are not arithmetic.

Pre-flight Check

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.