error-analysis
Analyze errors, stack traces, and logs to identify root causes and propose targeted fixes. Trigger on debugging, incident-response, or "why is this failing" requests.
What this skill does
# Error Analysis Skill
Systematically analyze errors and logs to find root causes.
## When to Use
- Debugging production errors
- Analyzing stack traces
- Investigating log patterns
- Performing root cause analysis
- Categorizing error types
## Reference Documents
- [Log Patterns](./references/log-patterns.md) - Common error patterns by type
- [Root Cause Analysis](./references/root-cause-analysis.md) - RCA techniques
- [Error Categorization](./references/error-categorization.md) - Classifying errors
- [Fix Patterns](./references/fix-patterns.md) - Common fixes by error type
## Analysis Workflow
### 1. Gather Information
```markdown
## Error Report
### Error Message
```
TypeError: Cannot read property 'id' of undefined
at UserService.getUser (src/services/user.ts:45:23)
at async Router.handle (src/api/routes.ts:67:12)
```
### Context
- **Environment:** Production
- **Time:** 2024-01-15 14:30 UTC
- **Frequency:** 15 occurrences in last hour
- **Affected Users:** ~5% of requests
- **Recent Changes:** Deploy at 14:00 UTC
```
### 2. Categorize Error
```markdown
## Error Classification
**Type:** Runtime Error
**Category:** Null/Undefined Reference
**Severity:** High (user-facing)
### Common Causes
1. Missing data validation
2. Race condition
3. API contract change
4. Data migration issue
```
### 3. Root Cause Analysis
```markdown
## Root Cause Investigation
### Timeline
- 14:00 - Deploy to production
- 14:25 - First error reported
- 14:30 - Error rate increased
### Hypothesis 1: Deploy introduced bug
- Check: git diff between versions
- Result: New code path added
### Hypothesis 2: Data issue
- Check: Query for affected users
- Result: All have specific condition
### Root Cause
Deploy introduced code that assumes `user.profile` exists,
but 5% of users don't have profiles (legacy accounts).
```
### 4. Implement Fix
```markdown
## Fix Implementation
### Short-term (Hotfix)
```typescript
// Add null check
const userId = user?.profile?.id ?? user.id;
```
### Long-term
1. Add data validation at API boundary
2. Migrate legacy accounts
3. Add regression test
```
## Error Categories
### By Origin
| Category | Description | Example |
|----------|-------------|---------|
| Client | User/browser errors | Invalid input |
| Server | Application errors | Null reference |
| Infrastructure | System errors | Connection timeout |
| External | Third-party errors | API rate limit |
### By Severity
| Level | Impact | Response |
|-------|--------|----------|
| Critical | System down | Immediate |
| High | Major feature broken | Hours |
| Medium | Degraded experience | This sprint |
| Low | Minor inconvenience | Backlog |
## Stack Trace Analysis
### Reading Stack Traces
```markdown
## Stack Trace Components
```
Error: Connection refused ← Error type and message
at Database.connect ← Where error was thrown
(src/db/connection.ts:23) ← File and line
at async initialize ← Call chain
(src/server.ts:45)
at async main ← Entry point
(src/index.ts:12)
```
### Key Questions
1. Where was the error thrown? (top of stack)
2. What called that code? (stack trace)
3. What was the input/state? (logs)
4. What changed recently? (git history)
```
### Common Patterns
```markdown
## Null Reference
```
TypeError: Cannot read property 'x' of undefined
```
**Check:** Variable existence, API response shape
## Connection Error
```
Error: ECONNREFUSED 127.0.0.1:5432
```
**Check:** Service running, network config, credentials
## Timeout
```
Error: Operation timed out after 30000ms
```
**Check:** Service health, query performance, network
## Memory
```
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed
```
**Check:** Memory leaks, large data processing
```
## Log Analysis
### Correlation
```markdown
## Correlating Logs
### Using Request ID
```bash
grep "req-12345" application.log
```
### Timeline Reconstruction
```
14:30:00.123 [req-12345] User login started
14:30:00.456 [req-12345] Fetching user profile
14:30:00.789 [req-12345] ERROR: Profile not found
14:30:00.790 [req-12345] TypeError: Cannot read 'id'
```
### Pattern Identification
```bash
# Count error types
grep "ERROR" app.log | cut -d: -f2 | sort | uniq -c | sort -rn
# Find error spikes
grep "ERROR" app.log | cut -d' ' -f1 | uniq -c
```
```
## Resolution Tracking
### Fix Verification
```markdown
## Fix Verification Checklist
- [ ] Error no longer reproducible locally
- [ ] Unit test added for fix
- [ ] Integration test added
- [ ] Deployed to staging
- [ ] Verified in staging
- [ ] Deployed to production
- [ ] Monitoring error rate
- [ ] Error rate returned to baseline
```
### Post-mortem Template
```markdown
# Incident Post-mortem: [Title]
## Summary
Brief description of what happened.
## Timeline
- HH:MM - Event
- HH:MM - Detection
- HH:MM - Resolution
## Impact
- Users affected: X
- Duration: Y hours
- Revenue impact: $Z
## Root Cause
Detailed explanation.
## Resolution
What was done to fix it.
## Lessons Learned
1. What went well
2. What went poorly
3. Where we got lucky
## Action Items
- [ ] Prevent: [Action]
- [ ] Detect: [Action]
- [ ] Respond: [Action]
```
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.