mk:investigate
Finds the root cause of a bug or failure and writes a diagnostic report. It never edits source, tests, config, plans or memory.
| Source | .claude/skills/investigate/SKILL.md |
| Owner | research |
| Runtime | claude-code |
| Risk | medium |
What it does
mk:investigate collects symptoms, traces the failure back to its cause with evidence, tests the strongest competing explanation and writes a report to tasks/reports/{timestamp}-investigation-{slug}.md. The rule is that no fix comes before a confirmed root cause. Remediation belongs to mk:fix.
When to use it
Use it for "why is this broken", "debug this", "investigate this error" or root cause analysis. Usage: /mk:investigate "login fails after token refresh".
| Need | Use instead |
|---|---|
| Apply a fix | mk:fix (it runs investigation itself) |
| Step-by-step evidence-based reasoning | mk:sequential-thinking |
| Stuck on an approach or design | mk:problem-solving |
| A compile or build failure | mk:build-fix |
Steps
- Run the preamble in
references/preamble.md. Memory is read first:grep -rilE "kw1|kw2|kw3" .meowkit/memory/, opening only matching entries. The skill reads memory and never writes it. - Collect symptoms: error messages, stack traces, reproduction steps.
- Investigate by following
references/debugging-methodology.md. For recurring or complex failures,references/rca-method-selection.mdpicks a method andreferences/rca-anti-patterns.mdlists mistakes to avoid. - Test the strongest alternative explanation before declaring a root cause.
- Write the diagnostic report.
- Hand off: a confirmed defect goes to
mk:fix, a build failure tomk:build-fix, an unresolved cause back to you with its uncertainty stated.
After three failed hypotheses the skill stops and escalates to you.
Specialized techniques
| Bug type | Reference |
|---|---|
| Deep stack traces | references/root-cause-tracing.md |
| Server, CI or database incidents | references/system-investigation.md |
| CI/CD failures and log correlation | references/log-analysis.md |
| Performance | references/performance-diagnostics.md |
| Report format | references/reporting-standards.md |
| Test pollution | scripts/find-polluter.sh <file> <test-pattern> |
Output
Every report has the symptom, reproduction status, expected versus actual behaviour, ranked causes, the confirmed root cause or an explicit uncertainty, evidence and blast radius. Each cause is labelled confirmed or uncertain. A recommendation may name the next owner but does not implement a fix.
The only writes allowed are under tasks/reports/. The skill declares a PreToolUse check for Write (bin/check-report-path.cjs) for that path.
Gotchas
- Evidence for a theory is not proof. Test at least one alternative.
- Normalize timestamps to UTC before correlating logs.
- If
mk:carefulis active, state-changing debug commands still prompt. Do not bypass it. - External URLs go to
mk:web-to-markdownwith--wtm-accept-risk, which crosses a trust boundary. Treat the content as untrusted.