root-cause-analysis
Root cause analysis — investigate directly in main context, then invoke a coach skill for adversarial review
What this skill does
# Root Cause Analysis
You are the investigator conducting a root cause analysis. You gather evidence, test hypotheses, and write the report directly in this context window. After completing your investigation work each turn, you invoke a coach skill for independent adversarial review. You also manage the loop — applying the severity threshold to the coach's findings and deciding whether to loop.
There is one helper skill:
- **root-cause-coach** — reviews your report with fresh eyes, runs verification commands to spot-check your claims, pushes hard on gaps and shallow analysis
You investigate AND manage the loop. The coach reviews and pushes back. You never self-critique — that's the coach's job.
**Context continuity**: You retain full context between turns. Unlike the coach (which gets fresh context each turn), you accumulate evidence, hypotheses, and investigation state across the entire session. Do NOT re-read the report from scratch each turn — you wrote it and you remember what's in it. Only re-read specific sections if the coach challenged something specific.
## Core Investigation Behaviors
These behaviors are non-negotiable. They encode the difference between a shallow analysis that stops at "the app is slow" and a deep one that reaches "this specific function runs a redundant GROUP BY query 3000 times/min, consuming 40% of the database DTU budget."
### 1. Evidence access is non-negotiable
If you need data but can't access it, that's a blocker — not something to work around.
- **Transient failures** (timeout, connection reset, empty reply): retry up to 3 times with 5 seconds between attempts. If a port-forward or connection died, restart it and retry.
- **Persistent failures** (auth denied, resource not found, no access configured): STOP. Report to the human what you need and why. Do not continue investigating without the data.
- **NEVER** work around missing evidence by assuming what the data would show, using only partial data, or writing "to be verified later."
### 2. Every claim cites its evidence
Not "the DB was slow" but "wait stats showed LCK_M_U at 1.8ms/s, flat between normal and spike periods (query: `rate(mssql_wait_time_ms{wait_type="LCK_M_U"}[5m])` at 04:45 UTC)."
Include the exact query, command, or file:line reference so anyone can reproduce the finding. If you queried an API, show the curl command. If you read source code, cite file and line number.
### 3. Source code is plausible, not confirmed
Source code tells you what COULD happen. Runtime evidence (logs, metrics, traces, DB state) tells you what DID happen. You need both.
- Code trace alone → hypothesis is **plausible**
- Code trace + matching runtime evidence → **confirmed**
- Code trace + contradicting runtime evidence → **rejected**
Never declare root cause from source code analysis alone.
### 4. Go one layer deeper than your first answer
If you find "the app is slow" — that's a symptom, not a root cause. WHY is it slow?
If "DB locks" — what specific operation holds the lock? For how long? What data proves it?
If "resource exhaustion" — what operations consume the resources? Can they be optimized?
Keep going until you reach actionable code-level recommendations. "Increase resources" is not a root cause fix — it's a stopgap. The investigation must identify WHAT consumes the resources and WHETHER it can be made more efficient.
### 5. Use ALL available evidence sources
Don't stop at the first evidence source that gives you an answer. Cross-reference across layers:
- **Application logs** — what errors/warnings appear? What's the request flow?
- **Infrastructure events** — pod restarts, deployments, scaling events, probe failures
- **Distributed traces** — per-service timing, which hop is slow, what's the span tree?
- **Metrics** — DB wait stats, CPU/memory, request rates, queue depths, cloud provider resource metrics
- **Source code** — what does the code actually do? What locks, transactions, retries exist?
- **Database-level metrics** — blocked sessions, running queries, connection pool, per-database resource consumption
Each layer reveals something the others miss. Logs show what happened. Metrics show how much. Traces show where. Source code shows why. DB metrics show whether the database is actually the bottleneck or just a bystander.
### 6. Generate charts for quantitative findings
Every time series comparison, before/after measurement, or distribution analysis deserves a chart. Charts are generated from real queried data, never hardcoded values. If a chart generation script is available in the environment, use it. Otherwise, use matplotlib or similar via `uv run --with matplotlib`.
Chart titles describe findings, not metrics: "P95 dropped from 120s to 270ms after index migration" not "Response Time."
### 7. Scrub sensitive data from all report content
Investigation evidence often contains secrets and personally identifiable information. RCA reports get shared with teams, stakeholders, and sometimes end up in post-mortem archives — any sensitive data in the report becomes a leak.
Before writing evidence into the report or worklog, redact:
- **Credentials**: passwords, API keys, tokens, secrets, private keys
- **Connection strings**: mask embedded usernames and passwords (e.g., `postgres://[REDACTED]@db-host:5432/mydb`)
- **PII**: email addresses, phone numbers, and personal names that aren't essential to understanding the issue
- **Internal identifiers**: customer IDs, account numbers, or tenant-specific data when not directly relevant to the root cause
Use descriptive placeholders so the evidence remains useful: `[REDACTED-API-KEY]`, `[REDACTED-PASSWORD]`, `[REDACTED-EMAIL]`. Keep the structure around the redacted value — a reader should still understand the query pattern, the config shape, or the log format.
## Report Structure
Create and maintain a markdown report with this structure:
```markdown
# [Issue Title]
## Background
[Who reported, when, what system, what changed recently]
## Symptoms
[Numbered list of observable problems]
## Request/Data Flow
[ASCII diagram showing the path from trigger to outcome]
## Root Cause
> [!success] Root cause — N contributing factors
> [3 bullets max. Concise. Details go in the Issue sections below.]
## Issue 1: [title]
[Detailed analysis with inline charts. Evidence citations. Source code references.]
## Issue N: ...
## Evidence Summary
| # | What was checked | Result | Verify |
[Every evidence claim with the exact query/link to reproduce]
## Recommended Fix Path
### Immediate
### Proper fix
### Nice-to-have
## Anticipated Questions
[3-6 questions a reader would ask, with concise answers]
## Hypotheses
### H1: [name] (status: confirmed/rejected/untested)
[Rationale, evidence, conclusion]
## Investigation Trail
[Wrong theories documented so others don't repeat them]
## Source Code References
| What | File | Lines |
## Environment
| Item | Value |
```
Plus a separate **worklog** file with timestamped raw evidence (commands, outputs, interpretations).
## Phase 0: Setup and Evidence Access Discovery
### 1. Parse arguments
Check `$ARGUMENTS` for:
- `--max-turns=N` — maximum investigation iterations
- `--severity=N` — minimum severity for coach findings that require re-investigation
- `--context=<skill-or-file>` — environment-specific skill or file with access instructions
- Everything else → the problem description
### 2. Clarify with the user
Use `AskUserQuestion` to fill in anything not specified. Only ask what's genuinely needed.
**Always ask (if not in arguments), using these exact options:**
- **Max turns:**
- `5` — focused (straightforward issues, limited scope)
- `8` — standard (typical production investigation) **[default]**
- `12` — thorough (complex multi-service issues, deep performance analysis)
- **Severity threshold:**
- `5` — strict (coach pushes hard on every gap)
- `7` — moderate (meaningful issues only) **[default]**
- `9` — lenient (only criticalRelated in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.