Investigate

From ahonn/dotfiles · View interactive version

Investigate is an AI agent skill from the GitHub repository ahonn/dotfiles. Diagnose reproducible or intermittent failures by tracing evidence to a root cause and verifying a targeted fix.

How to use this skill

Skill file

Systematic Debugging

Use evidence to explain the failure before changing behavior. Scale investigation to uncertainty and impact; a clear stack trace may need only a short trace, while intermittent failures may need instrumentation.

Follow the global AGENTS.md for authorization and test mode. Continue work already authorized by the session. Do not impose additional approval gates, a fixed retry limit, or mandatory test-first development.

Collect evidence and reproduce

Narrow the cause

Trace the failing value or operation across boundaries. Compare working and failing cases, and vary one relevant factor at a time when practical.

| Pattern | Evidence to seek |

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

| Race condition | Timing-dependent shared state, missing sequencing, stale async results |

| Null propagation | The earliest point an expected value becomes absent |

| State corruption | Mutation, cache invalidation, stale closures, ownership violations |

| Integration failure | Contract mismatch, version skew, differing configuration |

| Stale cache | Cached content or build artifacts that differ from the current source |

| Test pollution | Shared state, missing cleanup, order-dependent behavior |

A test passing in isolation does not prove test pollution. Compare suite execution, concurrency, environment, and timing. If order dependence is established, narrow the predecessor set to find the shared-state leak; do not fix it by reordering tests.

Test hypotheses

For each material hypothesis, identify the evidence, predict an observable result, run a focused experiment, and update the explanation from the result. Avoid changing several unrelated things and attributing success to one of them.

When experiments stop producing new information, revisit assumptions and widen the trace. A recurring symptom after a patch is evidence that the explanation or fix is incomplete: check whether the patch executed, reassess the causal chain, and preserve evidence that still holds. Do not discard valid evidence or stop at an arbitrary attempt count.

Use an independent opinion when a complex or high-risk diagnosis would benefit from it, or when explicitly requested. Verify that opinion against the code and observations. Ask the user only for missing evidence, access, or a decision that blocks further useful authorized work.

Implement and verify

Fix the demonstrated cause with a focused change. Preserve necessary error handling; distinguish a valid boundary guard from a guard that merely hides a broken invariant. Avoid unrelated refactors, and remove temporary instrumentation when it is no longer useful.

Apply the test mode chosen under global AGENTS.md. Add a regression test when that mode calls for one; test-first is optional unless explicitly selected. Run the relevant existing checks and required project checks. Broaden validation only when the change or results justify it.

Report the root cause, supporting evidence, change, checks actually performed, and material unverified behavior. If the cause remains uncertain, distinguish a mitigation or hypothesis from a confirmed fix.

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.