From second-claude-code
Performs systematic root cause investigation for errors, stack traces, unexpected behavior, and bugs using investigate-analyze-hypothesize-fix workflow with red flags and 3-strike rule.
How this skill is triggered — by the user, by Claude, or both
Slash command
/second-claude-code:investigateThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> **No fixes without root cause investigation first.**
No fixes without root cause investigation first.
Systematic debugging with root cause investigation. Four phases: investigate, analyze, hypothesize, fix.
Investigate — Gather evidence before forming any opinion.
git log --oneline -20 and git diff HEAD~5 --stat.Analyze — Classify the pattern.
| Pattern | Symptoms | Check |
|---|---|---|
| Race condition | Intermittent failure | Timing/ordering dependency |
| State corruption | Wrong values | Trace state mutation points |
| Nil/undefined | TypeError | Missing optional chaining |
| Import/dep conflict | Module errors | node_modules, version mismatch |
| MCP protocol error | Tool invocation failure | Request/response schema mismatch |
| Hook execution order | Unexpected side effects | Hook registration sequence |
| Skill file parsing | Routing mismatch | YAML frontmatter + pattern match |
| Schema drift | Type errors at boundaries | Schema vs handler comparison |
| Stale cache | Works after clear | Cache invalidation path |
| Config drift | Works locally, fails elsewhere | Environment variable differences |
Hypothesize & Test — State each hypothesis explicitly before testing.
Fix & Verify — Only after root cause is confirmed.
During investigation, do NOT modify files unrelated to the bug. Resist refactoring temptation — this session is for the bug only.
| Flag | Values | Default | Description |
|---|---|---|---|
--scope | <path> | auto-detected | Restrict investigation to directory |
--depth | shallow|deep | shallow | shallow=recent changes, deep=full history |
evidence-gatherer: { model: sonnet, constraint: "Read logs, grep codebase, list recent commits — evidence only, no fixes", tools: [Read, Bash, Glob, Grep] }
root-cause-analyst: { model: opus, constraint: "Given evidence, determine the single root cause with confidence score" }
.captures/investigate-{slug}-{YYYY-MM-DD}.md{slug} = error type lowercased, spaces to hyphens, max 40 charsA structured debug report:
## Debug Report
### Symptom
{Original error/behavior}
### Root Cause
{Confirmed cause with evidence}
### Fix
{Changes made — file:line}
### Verification
- [ ] Original scenario no longer reproduces
- [ ] Regression test written and passing
- [ ] Test fails without fix, passes with fix
- [ ] Related tests passing
### Risk: {LOW|MEDIUM|HIGH}
### Confidence: {1-10}/10
npx claudepluginhub unclejobs-ai/second-claude-code --plugin second-claude-codeEnforces structured root cause analysis with module freeze and evidence-based hypothesis. Use when encountering any bug, error, or unexpected behavior.
Enforces systematic root cause investigation for bugs, test failures, and unexpected behavior through four phases: investigation, pattern analysis, hypothesis testing, and implementation.
Guides developers through systematic root cause investigation of bugs and failures. Use when encountering test failures, errors, or unexpected behavior.