/skill:triage -- Bug Investigation and Root Cause Analysis
Purpose: Systematically investigate a bug from reproduction through root cause identification. Produces a structured triage report with classification, risk assessment, and a recommended path forward. This skill investigates -- it does NOT write fixes. Project-agnostic -- adapts to any codebase by reading CLAUDE.md.
When to Use
- A bug report comes in and you need to understand what is happening
- Something broke and you do not know why
- You need to assess severity and blast radius before deciding how to fix
- You want a structured handoff to /skill:hotfix or /skill:execute-prd
When NOT to Use
- You already know the root cause and just need to fix it -- use /skill:hotfix or /skill:execute-prd
- The issue is a feature request, not a bug
- The issue is purely cosmetic with no functional impact -- just fix it directly
Usage
/skill:triage "users see 500 error on login after password reset"
/skill:triage "budget totals don't match line items" --ado 12345
/skill:triage "task dependency graph has cycles" --linear BF-42
/skill:triage "photos not uploading on iOS" --quick
Arguments
<description> -- what is happening, as reported (required)
--ado <item-id> -- fetch details from Azure DevOps work item via az boards work-item show --id <item-id>
--linear <issue-id> -- fetch details from Linear via the Linear MCP tool (linear issue read --id <issue-id>)
--quick -- skip regression analysis (Step 5), produce a shorter report
Step 1: Project Discovery
Read CLAUDE.md from the repo root to learn:
- Project structure, package boundaries, and conventions
- Error handling patterns (AppError, error codes, etc.)
- Logging approach (where to find logs, structured fields)
- Test framework and how to run tests
- Database/ORM layer (Drizzle, Prisma, etc.)
Step 2: Fetch Work Item (If Provided)
If --ado <item-id> or --linear <issue-id> was provided, use /skill:work-item to retrieve the full details. Extract:
- Title and description
- Reproduction steps (if documented)
- Acceptance criteria
- Related items or links
Step 3: Reproduce the Bug
Attempt to reproduce or confirm the bug through code analysis:
Search for the symptom. Find the code path that produces the reported behavior:
- Error messages: search for the exact error text in the codebase
- HTTP status codes: trace the endpoint handler
- UI behavior: find the component and its data flow
- Data issues: trace the query/mutation path
Trace the execution path. Follow the code from entry point to failure:
- Identify the function/method where the bug manifests
- Walk backward through the call chain
- Note any branching logic, error handlers, or early returns
Identify inputs that trigger the bug. Determine:
- What specific input or state triggers the failure
- Is it deterministic or intermittent?
- Does it depend on timing, data state, or environment?
Step 4: Identify Root Cause
Classify the root cause into one of these categories:
| Category |
Description |
Examples |
| Logic Error |
Code does the wrong thing |
Off-by-one, wrong operator, missing negation, incorrect formula |
| Type Error |
Runtime type mismatch despite TypeScript |
Unsafe cast, as any, missing null check, incorrect Zod schema |
| Integration |
Contract mismatch between components |
API returns different shape than client expects, wrong enum value |
| Race Condition |
Timing-dependent failure |
Concurrent writes, stale cache, async ordering assumption |
| Config/Env |
Environment or configuration issue |
Missing env var, wrong URL, feature flag state |
| Data |
Unexpected data state |
Null in non-nullable column, orphaned reference, corrupted state |
For the root cause, identify:
- The exact location: file, function, line range
- The mechanism: what specifically goes wrong and why
- The trigger: what conditions cause this path to execute
Step 5: Regression Analysis (Skip with --quick)
Determine when this bug was introduced:
# Find recent changes to the affected files
git log --oneline -20 -- <affected-files>
If a specific commit is suspect:
git show <sha> -- <file>
Answer:
- Was this always broken, or did a recent change introduce it?
- If recent: which commit, who authored it, what was the intent?
- Are there related changes in the same PR that might also be affected?
Step 6: Risk Assessment
Assess four dimensions:
Blast Radius
- Isolated: affects one feature or edge case
- Moderate: affects a common workflow or multiple features
- Wide: affects all users or a core system function
Fix Complexity
- Simple: one-line fix or small localized change
- Moderate: changes to 2-5 files, straightforward logic
- Complex: cross-cutting change, multiple packages, requires design decisions
Regression Risk
- Low: fix is isolated, existing tests cover surrounding code
- Medium: fix touches shared code, test coverage is partial
- High: fix touches core logic, minimal test coverage, or has cascading effects
Test Coverage
- Good: affected code has tests, but they miss this case
- Partial: some tests exist but do not cover the affected path
- None: no tests for the affected code path
Step 7: Recommend Next Step
Based on the assessment, recommend one of:
| Recommendation |
When |
| /skill:hotfix |
Blast radius is Wide or Moderate AND fix complexity is Simple or Moderate |
| /skill:execute-prd |
Fix complexity is Complex OR regression risk is High |
| Direct fix |
Blast radius is Isolated AND fix complexity is Simple AND test coverage is Good |
| Needs more investigation |
Root cause is still unclear or there may be multiple contributing factors |
Step 8: Triage Report
Present the structured report:
Triage Report: <short title>
Reported Issue
<description as provided>
Root Cause
Category: <Logic Error | Type Error | Integration | Race Condition | Config/Env | Data>
Location: <file>:<function> (lines <N>-<M>)
Mechanism: <what goes wrong>
Trigger: <what conditions cause it>
Regression
Introduced: <commit sha> <date> | "pre-existing" | "unknown"
Related: <any related changes or PRs>
Risk Assessment
Blast Radius: <Isolated | Moderate | Wide>
Fix Complexity: <Simple | Moderate | Complex>
Regression Risk: <Low | Medium | High>
Test Coverage: <Good | Partial | None>
Recommendation: <next step>
Rationale: <one sentence>
Tracking: <ADO/Linear reference if provided>
Key Rules
- Investigate first, fix later. This skill does NOT write fixes. It produces a diagnosis.
- Be specific. Cite exact files, functions, and line numbers. Vague findings are useless.
- One root cause. If there are multiple contributing factors, identify the primary one and note the others.
- Do not guess. If you cannot determine the root cause with confidence, say so. "Needs more investigation" is a valid recommendation.
- Trace, do not assume. Actually follow the code path. Do not guess based on file names or function signatures alone.
- Respect scope. Do not start fixing the bug. Do not refactor. Do not add tests. Investigate and report.
1---2name: triage-23description: Investigate a bug from reproduction through root cause analysis and produce a structured triage report (classification, risk, recommended next step) — the deliverable is the report, not a fix. Preferred over superpowers:systematic-debugging when the goal is a handoff document for /hotfix, /execute-prd, or a human decision rather than an in-session fix.4---567# /skill:triage -- Bug Investigation and Root Cause Analysis89**Purpose:** Systematically investigate a bug from reproduction through root cause identification. Produces a structured triage report with classification, risk assessment, and a recommended path forward. This skill investigates -- it does NOT write fixes. Project-agnostic -- adapts to any codebase by reading `CLAUDE.md`.1011## When to Use1213- A bug report comes in and you need to understand what is happening14- Something broke and you do not know why15- You need to assess severity and blast radius before deciding how to fix16- You want a structured handoff to /skill:hotfix or /skill:execute-prd1718## When NOT to Use1920- You already know the root cause and just need to fix it -- use /skill:hotfix or /skill:execute-prd21- The issue is a feature request, not a bug22- The issue is purely cosmetic with no functional impact -- just fix it directly2324## Usage2526```27/skill:triage "users see 500 error on login after password reset"28/skill:triage "budget totals don't match line items" --ado 1234529/skill:triage "task dependency graph has cycles" --linear BF-4230/skill:triage "photos not uploading on iOS" --quick31```3233## Arguments3435- `<description>` -- what is happening, as reported (required)36- `--ado <item-id>` -- fetch details from Azure DevOps work item via `az boards work-item show --id <item-id>`37- `--linear <issue-id>` -- fetch details from Linear via the Linear MCP tool (`linear issue read --id <issue-id>`)38- `--quick` -- skip regression analysis (Step 5), produce a shorter report3940## Step 1: Project Discovery4142Read `CLAUDE.md` from the repo root to learn:43- Project structure, package boundaries, and conventions44- Error handling patterns (AppError, error codes, etc.)45- Logging approach (where to find logs, structured fields)46- Test framework and how to run tests47- Database/ORM layer (Drizzle, Prisma, etc.)4849## Step 2: Fetch Work Item (If Provided)5051If `--ado <item-id>` or `--linear <issue-id>` was provided, use /skill:work-item to retrieve the full details. Extract:52- Title and description53- Reproduction steps (if documented)54- Acceptance criteria55- Related items or links5657## Step 3: Reproduce the Bug5859Attempt to reproduce or confirm the bug through code analysis:60611. **Search for the symptom.** Find the code path that produces the reported behavior:62 - Error messages: search for the exact error text in the codebase63 - HTTP status codes: trace the endpoint handler64 - UI behavior: find the component and its data flow65 - Data issues: trace the query/mutation path66672. **Trace the execution path.** Follow the code from entry point to failure:68 - Identify the function/method where the bug manifests69 - Walk backward through the call chain70 - Note any branching logic, error handlers, or early returns71723. **Identify inputs that trigger the bug.** Determine:73 - What specific input or state triggers the failure74 - Is it deterministic or intermittent?75 - Does it depend on timing, data state, or environment?7677## Step 4: Identify Root Cause7879Classify the root cause into one of these categories:8081| Category | Description | Examples |82|----------|-------------|---------|83| **Logic Error** | Code does the wrong thing | Off-by-one, wrong operator, missing negation, incorrect formula |84| **Type Error** | Runtime type mismatch despite TypeScript | Unsafe cast, `as any`, missing null check, incorrect Zod schema |85| **Integration** | Contract mismatch between components | API returns different shape than client expects, wrong enum value |86| **Race Condition** | Timing-dependent failure | Concurrent writes, stale cache, async ordering assumption |87| **Config/Env** | Environment or configuration issue | Missing env var, wrong URL, feature flag state |88| **Data** | Unexpected data state | Null in non-nullable column, orphaned reference, corrupted state |8990For the root cause, identify:91- **The exact location:** file, function, line range92- **The mechanism:** what specifically goes wrong and why93- **The trigger:** what conditions cause this path to execute9495## Step 5: Regression Analysis (Skip with `--quick`)9697Determine when this bug was introduced:9899```bash100# Find recent changes to the affected files101git log --oneline -20 -- <affected-files>102```103104If a specific commit is suspect:105```bash106git show <sha> -- <file>107```108109Answer:110- Was this always broken, or did a recent change introduce it?111- If recent: which commit, who authored it, what was the intent?112- Are there related changes in the same PR that might also be affected?113114## Step 6: Risk Assessment115116Assess four dimensions:117118### Blast Radius119- **Isolated:** affects one feature or edge case120- **Moderate:** affects a common workflow or multiple features121- **Wide:** affects all users or a core system function122123### Fix Complexity124- **Simple:** one-line fix or small localized change125- **Moderate:** changes to 2-5 files, straightforward logic126- **Complex:** cross-cutting change, multiple packages, requires design decisions127128### Regression Risk129- **Low:** fix is isolated, existing tests cover surrounding code130- **Medium:** fix touches shared code, test coverage is partial131- **High:** fix touches core logic, minimal test coverage, or has cascading effects132133### Test Coverage134- **Good:** affected code has tests, but they miss this case135- **Partial:** some tests exist but do not cover the affected path136- **None:** no tests for the affected code path137138## Step 7: Recommend Next Step139140Based on the assessment, recommend one of:141142| Recommendation | When |143|----------------|------|144| **/skill:hotfix** | Blast radius is Wide or Moderate AND fix complexity is Simple or Moderate |145| **/skill:execute-prd** | Fix complexity is Complex OR regression risk is High |146| **Direct fix** | Blast radius is Isolated AND fix complexity is Simple AND test coverage is Good |147| **Needs more investigation** | Root cause is still unclear or there may be multiple contributing factors |148149## Step 8: Triage Report150151Present the structured report:152153```154Triage Report: <short title>155156Reported Issue157 <description as provided>158159Root Cause160 Category: <Logic Error | Type Error | Integration | Race Condition | Config/Env | Data>161 Location: <file>:<function> (lines <N>-<M>)162 Mechanism: <what goes wrong>163 Trigger: <what conditions cause it>164165Regression166 Introduced: <commit sha> <date> | "pre-existing" | "unknown"167 Related: <any related changes or PRs>168169Risk Assessment170 Blast Radius: <Isolated | Moderate | Wide>171 Fix Complexity: <Simple | Moderate | Complex>172 Regression Risk: <Low | Medium | High>173 Test Coverage: <Good | Partial | None>174175Recommendation: <next step>176 Rationale: <one sentence>177178Tracking: <ADO/Linear reference if provided>179```180181## Key Rules1821831. **Investigate first, fix later.** This skill does NOT write fixes. It produces a diagnosis.1842. **Be specific.** Cite exact files, functions, and line numbers. Vague findings are useless.1853. **One root cause.** If there are multiple contributing factors, identify the primary one and note the others.1864. **Do not guess.** If you cannot determine the root cause with confidence, say so. "Needs more investigation" is a valid recommendation.1875. **Trace, do not assume.** Actually follow the code path. Do not guess based on file names or function signatures alone.1886. **Respect scope.** Do not start fixing the bug. Do not refactor. Do not add tests. Investigate and report.