Use when user says "why does this happen", "find the root cause", "diagnose", "keeps happening", "what's causing", "5 whys", "get to the bottom of", or needs to find underlying causes for bugs, performance issues, process failures, or system outages.
You systematically diagnose problems to find the underlying cause, not just symptoms.
Start by stating the problem precisely:
**Problem:** API response times increased from 200ms to 3s
**Expected:** Responses under 500ms
**When:** Started Monday after deployment
**Impact:** 40% of users abandoning checkout
| Method | Best For | |--------|----------| | 5 Whys | Linear cause chains, single root cause | | Fishbone | Multiple contributing factors | | Fault Tree | System failures with AND/OR logic | | Timeline | Incidents with sequence of events |
Before each "why", gather evidence:
For code/systems:
# Logs, metrics, traces
# Use Task tool for parallel investigation if multiple areas
For processes:
Ask "why" iteratively, but verify each answer:
## 5 Whys Analysis
**Problem:** Users report slow page loads
1. **Why slow?** -> API takes 3 seconds
*Evidence: Network tab shows /api/users taking 3.2s*
2. **Why does API take 3s?** -> Database query is slow
*Evidence: Query logs show SELECT taking 2.8s*
3. **Why is query slow?** -> Full table scan on users table
*Evidence: EXPLAIN shows no index used*
4. **Why no index?** -> Index was dropped in migration
*Evidence: Migration 042 drops idx_users_email*
5. **Why was it dropped?** -> Copied from stack overflow without understanding
*Evidence: Commit message references SO link*
**Root Cause:** Migration review process doesn't catch index changes
Every root cause analysis should identify fixes at multiple levels:
## Fixes
**Immediate (address symptom):**
- Add index back to users table
**Preventive (address root cause):**
- Add migration review checklist
- Add performance regression tests
**Systemic (address deeper issue):**
- Training on database optimization
- Automated index usage analysis in CI
Before concluding, verify:
When problem has multiple contributing causes:
┌─ Process: No code review
├─ Process: No testing requirement
People ─────┼─ Skills: Junior dev unfamiliar with DB
└─ Capacity: Team overloaded
Slow ───────────────┼─ Technology: No query monitoring
Page ├─ Technology: No performance budget
Loads Technology ─┼─ Technology: Outdated ORM version
└─
┌─ Environment: Prod DB larger than staging
Environment ┼─ Environment: No realistic test data
└─ Environment: Different DB version
For complex problems, investigate areas in parallel:
Spawn parallel tasks:
- Task 1: Analyze recent code changes
- Task 2: Check infrastructure metrics
- Task 3: Review error logs
- Task 4: Check external dependencies
Synthesize findings to identify root cause.
## Root Cause Analysis: [Problem]
### Problem Statement
[Clear description with impact]
### Analysis Method
[5 Whys / Fishbone / Timeline]
### Investigation
[Step-by-step with evidence]
### Root Cause
[The underlying cause, not the symptom]
### Recommended Fixes
| Level | Action | Effort |
|-------|--------|--------|
| Immediate | [Quick fix] | Low |
| Preventive | [Stop recurrence] | Medium |
| Systemic | [Address deeper issue] | High |
### Verification
[How to confirm the root cause is correct]
DON'T:
DO:
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer