From prp-core
Performs deep root cause analysis on bugs, errors, or stack traces using a structured 5 Whys methodology. Activated automatically when debugging or via /prp-debug.
How this skill is triggered — by the user, by Claude, or both
Slash command
/prp-core:prp-debug <issue|error|stacktrace> [--quick]<issue|error|stacktrace> [--quick]The summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Input**: $ARGUMENTS
Input: $ARGUMENTS
Find the actual root cause - the specific code, config, or logic that, if changed, would prevent this issue. Not symptoms. Not intermediate failures. The origin.
The Test: "If I changed THIS, would the issue be prevented?" If the answer is "maybe" or "partially", you haven't found the root cause yet. Keep digging.
| Type | Description | Action |
|---|---|---|
| Raw symptom | Vague description, error message, stack trace | INVESTIGATE - form hypotheses, test them |
| Pre-diagnosed | Already identifies location/problem | VALIDATE - confirm diagnosis, check for related issues |
--quick flag present → Surface scan (2-3 Whys, ~5 min)Restate the symptom in one sentence. What is actually failing?
PHASE_1_CHECKPOINT:
Based on the symptom, generate 2-4 hypotheses. For each:
| Hypothesis | What must be true | Evidence needed | Likelihood |
|---|---|---|---|
| {H1} | {conditions} | {proof needed} | HIGH/MED/LOW |
| {H2} | {conditions} | {proof needed} | HIGH/MED/LOW |
Start with the most probable hypothesis.
PHASE_2_CHECKPOINT:
Execute the 5 Whys protocol for your leading hypothesis:
WHY 1: Why does [symptom] occur?
→ Because [intermediate cause A]
→ Evidence: [code reference, log, or test that proves this]
WHY 2: Why does [intermediate cause A] happen?
→ Because [intermediate cause B]
→ Evidence: [proof]
WHY 3: Why does [intermediate cause B] happen?
→ Because [intermediate cause C]
→ Evidence: [proof]
WHY 4: Why does [intermediate cause C] happen?
→ Because [intermediate cause D]
→ Evidence: [proof]
WHY 5: Why does [intermediate cause D] happen?
→ Because [ROOT CAUSE]
→ Evidence: [exact file:line reference]
| Valid Evidence | Invalid Evidence |
|---|---|
file.ts:123 with actual code snippet | "likely includes...", "probably because..." |
| Command output you actually ran | Logical deduction without code proof |
| Test you executed that proves behavior | Explaining how technology works in general |
Rules:
For tracing complex code paths, use prp-core:codebase-analyst to understand how the suspected code works before diving into the 5 Whys:
Use Task tool with subagent_type="prp-core:codebase-analyst":
Analyze the implementation around: [suspected area / error location]
TRACE:
1. How data flows through the affected code path
2. Entry points that lead to the failure
3. State changes and side effects along the way
4. Contracts between components in the chain
Document what exists with precise file:line references. No suggestions.
For code issues:
For runtime issues:
For "it worked before" issues:
git log --oneline -20
git diff HEAD~10 [suspicious files]
PHASE_3_CHECKPOINT:
| Test | Question | Pass? |
|---|---|---|
| Causation | Does root cause logically lead to symptom through evidence chain? | Y/N |
| Necessity | If root cause didn't exist, would symptom still occur? | N required |
| Sufficiency | Is root cause alone enough, or are there co-factors? | Document if co-factors |
If any test fails → root cause is incomplete. Go deeper or broader.
git log --oneline -10 -- [affected files]
git blame [affected file] | grep -A2 -B2 [line number]
Document:
For deep mode, document why other hypotheses were rejected:
| Hypothesis | Why Ruled Out |
|---|---|
| {H2} | {evidence that disproved it} |
| {H3} | {evidence that disproved it} |
PHASE_4_CHECKPOINT:
# --- PRP store resolver (canonical; keep byte-identical across skills) ---
_gd="$(git rev-parse --path-format=absolute --git-common-dir 2>/dev/null)"
case "$_gd" in */.git) _root="${_gd%/.git}" ;; "") _root="$PWD" ;; *) _root="$_gd" ;; esac
_root="$(cd "$_root" && pwd -P)"
_name="$(basename "$_root" | tr '[:upper:]' '[:lower:]' | tr -cs 'a-z0-9' '-' | sed 's/^-*//;s/-*$//')"
PRP_DIR="${PRP_HOME:-$HOME/.prp}/${_name:-project}-$(printf %s "$_root" | git hash-object --stdin | cut -c1-8)"
mkdir -p "$PRP_DIR"; [ -f "$PRP_DIR/project.json" ] || printf '{"path": "%s", "name": "%s"}\n' "$_root" "${_name:-project}" > "$PRP_DIR/project.json"
mkdir -p "$PRP_DIR/debug"
Path: $PRP_DIR/debug/rca-{issue-slug}.md
# Root Cause Analysis
**Issue**: {One-line symptom description}
**Root Cause**: {One-line actual cause}
**Severity**: {Critical/High/Medium/Low}
**Confidence**: {High/Medium/Low}
---
## Evidence Chain
WHY: {Symptom occurs}
↓ BECAUSE: {First level cause}
Evidence: `file.ts:123` - {code snippet}
WHY: {First level cause}
↓ BECAUSE: {Second level cause}
Evidence: `file.ts:456` - {code snippet}
{...continue...}
↓ ROOT CAUSE: {The fixable thing}
Evidence: `source.ts:789` - {problematic code}
---
## Git History
- **Introduced**: {commit hash} - {message} - {date}
- **Author**: {who}
- **Recent changes**: {yes/no, when}
- **Type**: {regression / original bug / long-standing}
---
## Fix Specification
### What Needs to Change
{Which files, what logic, what the correct behavior should be}
### Implementation Guidance
```{language}
// Current (problematic):
{simplified example}
// Required (fixed):
{simplified example}
path/to/file.ts:LINE - {why}
**PHASE_5_CHECKPOINT:**
- [ ] Report created
- [ ] All sections filled
- [ ] Fix specification is actionable
---
## Phase 6: OUTPUT - Report to User
```markdown
## Root Cause Analysis Complete
**Issue**: {symptom}
**Root Cause**: {cause}
**Confidence**: {High/Medium/Low}
**Report**: `{expanded absolute path to $PRP_DIR/debug/rca-{issue-slug}.md}`
### Summary
{2-3 sentence explanation of what was found}
### The Fix
{1-2 sentence description of what needs to change}
### Next Steps
- Review the report for full evidence chain
- Implement the fix following the specification
- Run verification steps to confirm resolution
Symptoms lie. The error message tells you what failed, not why.
First explanation is often wrong. Resist the urge to stop early.
No evidence = no claim. "Likely", "probably", "may" are not allowed.
Test, don't just read. Execution proves behavior; reading proves intent.
Git history is mandatory. In deep mode, you must include when/who/why.
The fix should be obvious. If your root cause is correct, the fix writes itself.
npx claudepluginhub wirasm/prp --plugin prp-coreTraces root causes of errors, stack traces, test failures, and build issues by gathering evidence, following call chains backward, and explaining the full causation narrative in structured format.
Conducts root cause analysis using 5-Why methodology for errors, bugs, build/test failures, performance issues, and integration problems.
Root cause analysis using the Five Whys technique for bugs that persist, failures that recur, or processes that keep breaking.