From second-claude-code
Performs systematic root cause analysis for errors, stack traces, and unexpected behavior using investigate-analyze-hypothesize-fix workflow with pattern classification like race conditions and state corruption.
npx claudepluginhub unclejobs-ai/second-claude-code --plugin second-claude-codeThis skill uses the workspace's default tool permissions.
> **No fixes without root cause investigation first.**
Performs root cause analysis for bugs by tracing errors through code, analyzing stack traces, forming and testing hypotheses, then hands off to fix. Auto-triggers on stack traces.
Guides root cause debugging for bugs, test failures, and unexpected behavior. Enforces reproduce-investigate-hypothesize-fix process with evidence before fixes. No guessing.
Mandates invoking relevant skills via tools before any response in coding sessions. Covers access, priorities, and adaptations for Claude Code, Copilot CLI, Gemini CLI.
Share bugs, ideas, or general feedback.
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