Debugging & Troubleshooting (Dec 2025) — Quick Reference
This skill provides execution-ready debugging strategies, troubleshooting workflows, and root cause analysis techniques.
Core references: Google SRE troubleshooting patterns (Effective Troubleshooting) and SLO-driven reliability/triage (Service Level Objectives); observability standards via OpenTelemetry (Docs) and W3C Trace Context (Spec).
Core QA (Default)
Workflow (Reproduce → Isolate → Instrument → Fix → Verify → Regress)
Reproduce:
- Capture exact failure signature: error message, stack trace, request ID/trace ID, timestamp, build SHA, environment, user/tenant, seed/test data IDs.
- Quantify reproducibility: “fails 3/20 runs” is different from “fails 20/20”.
Isolate:
- Reduce scope: minimal input, minimal config, smallest component boundary.
- Bisect changes (git bisect / feature flags) when it started “recently”.
Instrument:
- Prefer structured logs + correlation IDs and traces over ad-hoc print statements (OpenTelemetry, W3C Trace Context).
- Add assertions/guards to fail fast at the true boundary.
Fix:
- Fix root cause, not symptoms; avoid “papering over” with retries/sleeps.
Verify:
- Add regression test at the lowest effective layer; validate in CI-like conditions.
Regress:
- Record the narrative: trigger, root cause, fix, prevention, and what signal would have caught it earlier (Effective Troubleshooting).
Debugging Ergonomics (Make Failures Cheap)
- Standardize a failure bundle:
- Logs (structured), trace links, key metrics snapshot, and repro steps.
- Test artifacts (screenshots/trace/video for UI; core dumps/crash reports where relevant).
- REQUIRED: every automated suite defines what artifacts are produced on failure and where they live.
Flaky/Intermittent Failures (Test and Prod)
- Treat flakes as reliability debt, not “noise”.
- First action: classify the flake type:
- Timing/race: missing waits, async hazards, eventual consistency.
- Environment: CPU/memory pressure, timezones/locales, throttling.
- Data: shared state, ordering dependency, non-deterministic fixtures.
- Use controlled repetition: run the test N times with tracing enabled; correlate failures via request/trace IDs.
Do / Avoid
Do:
- Start with the smallest reliable reproducer.
- Use evidence to support hypotheses (logs, traces, metrics, stack traces).
- Add guardrails and regression tests as part of the fix.
Avoid:
- Adding sleeps to “stabilize” tests without proving the underlying race.
- Disabling tests or lowering assertions to make CI green.
- Debugging directly in production without a safe, scoped plan (feature flags, sampling, read-only probes).
Quick Reference
| Symptom |
Tool/Technique |
Command/Approach |
When to Use |
| Application crashes |
Stack trace analysis |
Check error logs, identify first line in your code |
Unhandled exceptions |
| Slow performance |
Profiling (CPU/memory) |
node --prof, Chrome DevTools, cProfile |
High CPU, latency issues |
| Memory leak |
Heap snapshots |
node --inspect, compare snapshots over time |
Memory usage grows |
| Database slow |
Query profiling |
EXPLAIN ANALYZE, slow query log |
Slow queries, high DB CPU |
| Production-only bug |
Log analysis + feature flags |
grep "ERROR", enable verbose logging for user |
Can't reproduce locally |
| Distributed system issue |
Distributed tracing |
OpenTelemetry, Jaeger, trace request ID |
Microservices, async workflows |
| Intermittent failures |
Logging + monitoring |
Add detailed logs, monitor metrics |
Race conditions, timeouts |
| Network timeout |
Network debugging |
curl, Postman, check firewall/DNS |
External API failures |
Decision Tree: Debugging Strategy
Issue type: [Problem Scenario]
├─ Application Behavior?
│ ├─ Crashes immediately? → Check stack trace, error logs
│ ├─ Slow/hanging? → CPU/memory profiling
│ ├─ Intermittent failures? → Add logging, reproduce consistently
│ └─ Unexpected output? → Binary search (add logs to narrow down)
│
├─ Performance Issues?
│ ├─ High CPU? → CPU profiler to find hot functions
│ ├─ Memory leak? → Heap snapshots, track over time
│ ├─ Slow database? → EXPLAIN ANALYZE, check indexes
│ ├─ Network latency? → Trace external API calls
│ └─ Frontend slow? → Lighthouse, Web Vitals profiling
│
├─ Production-Only?
│ ├─ Can't reproduce? → Analyze logs for patterns
│ ├─ Environment difference? → Compare configs, data volume
│ ├─ Need safe debugging? → Feature flags for verbose logging
│ └─ Recent deployment? → Git bisect to find regression
│
├─ Distributed Systems?
│ ├─ Multiple services involved? → Distributed tracing (Jaeger)
│ ├─ Request lost? → Search logs by request ID
│ ├─ Service dependency? → Check health checks, circuit breakers
│ └─ Async workflow? → Trace message queue, event logs
│
└─ Error Type?
├─ TypeError/NullPointer? → Check object existence, defensive coding
├─ Network timeout? → Check external service health, retry logic
├─ Database error? → Check connection pool, query syntax
└─ Unknown error? → Systematic debugging workflow (observe, hypothesize, test)
When to Use This Skill
Use this skill when a user reports:
- Application crashes or errors
- Unexpected behavior or bugs
- Performance issues (slow queries, memory leaks, high CPU)
- Production incidents requiring root cause analysis
- Stack trace or error message interpretation
- Debugging strategies for specific scenarios
- Log analysis and pattern detection
- Distributed system debugging (microservices, async workflows)
- Memory leaks and resource exhaustion
- Race conditions and concurrency issues
- Network connectivity problems
- Database query optimization
- Third-party API integration issues
Operational Deep Dives
See resources/operational-patterns.md for systematic debugging workflows, logging strategy details, stack trace and performance profiling guides, and language-specific tooling checklists.
Templates (Copy-Paste Ready)
Production templates organized by workflow type:
- Debugging Workflow: templates/debugging/template-debugging-checklist.md - Universal debugging checklist with specialized checklists for performance, memory leaks, distributed systems, and production incidents
- Debugging Worksheet: templates/debugging/template-debugging-worksheet.md - One-page worksheet (repro → isolate → instrument → verify) for fast, consistent triage
- Incident Response: templates/incidents/template-incident-response.md - Complete incident response playbook with severity levels, communication templates, and postmortem format
- Logging Setup: templates/observability/template-logging-setup.md - Production logging configurations for Node.js (Pino), Python (structlog), Go (zap), with Docker and CloudWatch integration
Resources (Deep-Dive Guides)
Operational best practices by domain:
- Operational Patterns: resources/operational-patterns.md - Core debugging workflows, stack trace triage, profiling guides, and tool selection
- Debugging Methodologies: resources/debugging-methodologies.md - Scientific method, binary search, delta debugging, rubber duck, time-travel debugging, observability-first approaches
- Logging Best Practices: resources/logging-best-practices.md - Structured logging, log levels, what to log/not log, implementations by language, request ID propagation, performance optimization
- Production Debugging: resources/production-debugging-patterns.md - Safe production debugging techniques, log analysis, metrics, distributed tracing, feature flags, incident response workflow
Navigation
Resources
- resources/operational-patterns.md
- resources/debugging-methodologies.md
- resources/logging-best-practices.md
- resources/production-debugging-patterns.md
Templates
- templates/debugging/template-debugging-checklist.md
- templates/debugging/template-debugging-worksheet.md
- templates/incidents/template-incident-response.md
- templates/observability/template-logging-setup.md
Data
- data/sources.json — Curated external references
Optional: AI / Automation
Use AI assistance to accelerate triage, not to replace evidence-based debugging.
Do:
- Summarize logs/traces and cluster failures; always include “evidence snippets” (IDs, timestamps, top errors) that can be independently verified.
- Generate hypotheses, then test them with targeted instrumentation.
Avoid:
- Letting AI decide root cause without corroborating evidence.
- Copying suggested fixes without adding regression tests.
External Resources
See data/sources.json for:
- Debugging tool documentation
- Error tracking platforms (Sentry, Rollbar, Bugsnag)
- Observability platforms (Datadog, New Relic, Honeycomb)
- Profiling tutorials and guides
- Production debugging best practices
Quick Decision Matrix
| Symptom |
Likely Cause |
First Action |
| Application crashes |
Unhandled exception |
Check error logs and stack trace |
| Slow performance |
Database/network/CPU bottleneck |
Profile with performance tools |
| Memory usage grows |
Memory leak |
Take heap snapshots over time |
| Intermittent failures |
Race condition, network timeout |
Add detailed logging around failure |
| Production-only bug |
Environment difference, data volume |
Compare prod vs dev config/data |
| High CPU usage |
Infinite loop, inefficient algorithm |
CPU profiler to find hot functions |
| Database slow |
Missing index, N+1 queries |
Run EXPLAIN ANALYZE on slow queries |
Anti-Patterns to Avoid
- Random changes - Making changes without hypothesis
- Inadequate logging - Can't debug what you can't see
- Debugging in production - Always reproduce locally when possible
- Ignoring stack traces - Stack trace tells you exactly where error occurred
- Not writing tests - Fix today, break tomorrow
- Symptom fixing - Treating symptoms instead of root cause
- No monitoring - Flying blind in production
- Skipping postmortems - Not learning from incidents
Related Skills
This skill works with other skills in the framework:
Development & Operations:
- git-workflow - Git bisect for finding regressions, version control workflows
- dev-api-design - API debugging, error handling, REST patterns, status codes
Infrastructure & Platform:
- ops-devops-platform - CI/CD pipelines, monitoring, incident response, SRE practices, Kubernetes ops
- data-sql-optimization - Database query optimization, EXPLAIN ANALYZE, index tuning, slow query debugging
Success Criteria: Issues are diagnosed systematically, root causes are identified accurately, fixes include regression tests, and debugging knowledge is documented for future reference.
1---2name: qa-debugging3description: Systematic debugging methodologies, troubleshooting workflows, logging strategies, error tracking, performance profiling, stack trace analysis, and debugging tools across languages and environments. Covers local debugging, distributed systems, production issues, and root cause analysis.4---56# Debugging & Troubleshooting (Dec 2025) — Quick Reference78This skill provides execution-ready debugging strategies, troubleshooting workflows, and root cause analysis techniques.910Core references: Google SRE troubleshooting patterns ([Effective Troubleshooting](https://sre.google/sre-book/effective-troubleshooting/)) and SLO-driven reliability/triage ([Service Level Objectives](https://sre.google/sre-book/service-level-objectives/)); observability standards via OpenTelemetry ([Docs](https://opentelemetry.io/docs/)) and W3C Trace Context ([Spec](https://www.w3.org/TR/trace-context/)).1112---1314## Core QA (Default)1516### Workflow (Reproduce → Isolate → Instrument → Fix → Verify → Regress)1718Reproduce:19- Capture exact failure signature: error message, stack trace, request ID/trace ID, timestamp, build SHA, environment, user/tenant, seed/test data IDs.20- Quantify reproducibility: “fails 3/20 runs” is different from “fails 20/20”.2122Isolate:23- Reduce scope: minimal input, minimal config, smallest component boundary.24- Bisect changes (git bisect / feature flags) when it started “recently”.2526Instrument:27- Prefer structured logs + correlation IDs and traces over ad-hoc print statements ([OpenTelemetry](https://opentelemetry.io/docs/), [W3C Trace Context](https://www.w3.org/TR/trace-context/)).28- Add assertions/guards to fail fast at the true boundary.2930Fix:31- Fix root cause, not symptoms; avoid “papering over” with retries/sleeps.3233Verify:34- Add regression test at the lowest effective layer; validate in CI-like conditions.3536Regress:37- Record the narrative: trigger, root cause, fix, prevention, and what signal would have caught it earlier ([Effective Troubleshooting](https://sre.google/sre-book/effective-troubleshooting/)).3839### Debugging Ergonomics (Make Failures Cheap)4041- Standardize a failure bundle:42 - Logs (structured), trace links, key metrics snapshot, and repro steps.43 - Test artifacts (screenshots/trace/video for UI; core dumps/crash reports where relevant).44- REQUIRED: every automated suite defines what artifacts are produced on failure and where they live.4546### Flaky/Intermittent Failures (Test and Prod)4748- Treat flakes as reliability debt, not “noise”.49- First action: classify the flake type:50 - Timing/race: missing waits, async hazards, eventual consistency.51 - Environment: CPU/memory pressure, timezones/locales, throttling.52 - Data: shared state, ordering dependency, non-deterministic fixtures.53- Use controlled repetition: run the test N times with tracing enabled; correlate failures via request/trace IDs.5455### Do / Avoid5657Do:58- Start with the smallest reliable reproducer.59- Use evidence to support hypotheses (logs, traces, metrics, stack traces).60- Add guardrails and regression tests as part of the fix.6162Avoid:63- Adding sleeps to “stabilize” tests without proving the underlying race.64- Disabling tests or lowering assertions to make CI green.65- Debugging directly in production without a safe, scoped plan (feature flags, sampling, read-only probes).6667## Quick Reference6869| Symptom | Tool/Technique | Command/Approach | When to Use |70|---------|----------------|------------------|-------------|71| Application crashes | Stack trace analysis | Check error logs, identify first line in your code | Unhandled exceptions |72| Slow performance | Profiling (CPU/memory) | `node --prof`, Chrome DevTools, cProfile | High CPU, latency issues |73| Memory leak | Heap snapshots | `node --inspect`, compare snapshots over time | Memory usage grows |74| Database slow | Query profiling | `EXPLAIN ANALYZE`, slow query log | Slow queries, high DB CPU |75| Production-only bug | Log analysis + feature flags | `grep "ERROR"`, enable verbose logging for user | Can't reproduce locally |76| Distributed system issue | Distributed tracing | OpenTelemetry, Jaeger, trace request ID | Microservices, async workflows |77| Intermittent failures | Logging + monitoring | Add detailed logs, monitor metrics | Race conditions, timeouts |78| Network timeout | Network debugging | `curl`, Postman, check firewall/DNS | External API failures |7980---8182## Decision Tree: Debugging Strategy8384```text85Issue type: [Problem Scenario]86 ├─ Application Behavior?87 │ ├─ Crashes immediately? → Check stack trace, error logs88 │ ├─ Slow/hanging? → CPU/memory profiling89 │ ├─ Intermittent failures? → Add logging, reproduce consistently90 │ └─ Unexpected output? → Binary search (add logs to narrow down)91 │92 ├─ Performance Issues?93 │ ├─ High CPU? → CPU profiler to find hot functions94 │ ├─ Memory leak? → Heap snapshots, track over time95 │ ├─ Slow database? → EXPLAIN ANALYZE, check indexes96 │ ├─ Network latency? → Trace external API calls97 │ └─ Frontend slow? → Lighthouse, Web Vitals profiling98 │99 ├─ Production-Only?100 │ ├─ Can't reproduce? → Analyze logs for patterns101 │ ├─ Environment difference? → Compare configs, data volume102 │ ├─ Need safe debugging? → Feature flags for verbose logging103 │ └─ Recent deployment? → Git bisect to find regression104 │105 ├─ Distributed Systems?106 │ ├─ Multiple services involved? → Distributed tracing (Jaeger)107 │ ├─ Request lost? → Search logs by request ID108 │ ├─ Service dependency? → Check health checks, circuit breakers109 │ └─ Async workflow? → Trace message queue, event logs110 │111 └─ Error Type?112 ├─ TypeError/NullPointer? → Check object existence, defensive coding113 ├─ Network timeout? → Check external service health, retry logic114 ├─ Database error? → Check connection pool, query syntax115 └─ Unknown error? → Systematic debugging workflow (observe, hypothesize, test)116```117118---119120## When to Use This Skill121122Use this skill when a user reports:123124- Application crashes or errors125- Unexpected behavior or bugs126- Performance issues (slow queries, memory leaks, high CPU)127- Production incidents requiring root cause analysis128- Stack trace or error message interpretation129- Debugging strategies for specific scenarios130- Log analysis and pattern detection131- Distributed system debugging (microservices, async workflows)132- Memory leaks and resource exhaustion133- Race conditions and concurrency issues134- Network connectivity problems135- Database query optimization136- Third-party API integration issues137138---139140## Operational Deep Dives141142See [resources/operational-patterns.md](resources/operational-patterns.md) for systematic debugging workflows, logging strategy details, stack trace and performance profiling guides, and language-specific tooling checklists.143144---145146## Templates (Copy-Paste Ready)147148Production templates organized by workflow type:149150- **Debugging Workflow**: [templates/debugging/template-debugging-checklist.md](templates/debugging/template-debugging-checklist.md) - Universal debugging checklist with specialized checklists for performance, memory leaks, distributed systems, and production incidents151- **Debugging Worksheet**: [templates/debugging/template-debugging-worksheet.md](templates/debugging/template-debugging-worksheet.md) - One-page worksheet (repro → isolate → instrument → verify) for fast, consistent triage152- **Incident Response**: [templates/incidents/template-incident-response.md](templates/incidents/template-incident-response.md) - Complete incident response playbook with severity levels, communication templates, and postmortem format153- **Logging Setup**: [templates/observability/template-logging-setup.md](templates/observability/template-logging-setup.md) - Production logging configurations for Node.js (Pino), Python (structlog), Go (zap), with Docker and CloudWatch integration154155---156157## Resources (Deep-Dive Guides)158159Operational best practices by domain:160161- **Operational Patterns**: [resources/operational-patterns.md](resources/operational-patterns.md) - Core debugging workflows, stack trace triage, profiling guides, and tool selection162- **Debugging Methodologies**: [resources/debugging-methodologies.md](resources/debugging-methodologies.md) - Scientific method, binary search, delta debugging, rubber duck, time-travel debugging, observability-first approaches163- **Logging Best Practices**: [resources/logging-best-practices.md](resources/logging-best-practices.md) - Structured logging, log levels, what to log/not log, implementations by language, request ID propagation, performance optimization164- **Production Debugging**: [resources/production-debugging-patterns.md](resources/production-debugging-patterns.md) - Safe production debugging techniques, log analysis, metrics, distributed tracing, feature flags, incident response workflow165166---167168## Navigation169170**Resources**171- [resources/operational-patterns.md](resources/operational-patterns.md)172- [resources/debugging-methodologies.md](resources/debugging-methodologies.md)173- [resources/logging-best-practices.md](resources/logging-best-practices.md)174- [resources/production-debugging-patterns.md](resources/production-debugging-patterns.md)175176**Templates**177- [templates/debugging/template-debugging-checklist.md](templates/debugging/template-debugging-checklist.md)178- [templates/debugging/template-debugging-worksheet.md](templates/debugging/template-debugging-worksheet.md)179- [templates/incidents/template-incident-response.md](templates/incidents/template-incident-response.md)180- [templates/observability/template-logging-setup.md](templates/observability/template-logging-setup.md)181182**Data**183- [data/sources.json](data/sources.json) — Curated external references184185---186187## Optional: AI / Automation188189Use AI assistance to accelerate triage, not to replace evidence-based debugging.190191Do:192- Summarize logs/traces and cluster failures; always include “evidence snippets” (IDs, timestamps, top errors) that can be independently verified.193- Generate hypotheses, then test them with targeted instrumentation.194195Avoid:196- Letting AI decide root cause without corroborating evidence.197- Copying suggested fixes without adding regression tests.198199---200201## External Resources202203See `data/sources.json` for:204- Debugging tool documentation205- Error tracking platforms (Sentry, Rollbar, Bugsnag)206- Observability platforms (Datadog, New Relic, Honeycomb)207- Profiling tutorials and guides208- Production debugging best practices209210---211212## Quick Decision Matrix213214| Symptom | Likely Cause | First Action |215|---------|-------------|-------------|216| Application crashes | Unhandled exception | Check error logs and stack trace |217| Slow performance | Database/network/CPU bottleneck | Profile with performance tools |218| Memory usage grows | Memory leak | Take heap snapshots over time |219| Intermittent failures | Race condition, network timeout | Add detailed logging around failure |220| Production-only bug | Environment difference, data volume | Compare prod vs dev config/data |221| High CPU usage | Infinite loop, inefficient algorithm | CPU profiler to find hot functions |222| Database slow | Missing index, N+1 queries | Run EXPLAIN ANALYZE on slow queries |223224---225226## Anti-Patterns to Avoid227228- **Random changes** - Making changes without hypothesis229- **Inadequate logging** - Can't debug what you can't see230- **Debugging in production** - Always reproduce locally when possible231- **Ignoring stack traces** - Stack trace tells you exactly where error occurred232- **Not writing tests** - Fix today, break tomorrow233- **Symptom fixing** - Treating symptoms instead of root cause234- **No monitoring** - Flying blind in production235- **Skipping postmortems** - Not learning from incidents236237---238239## Related Skills240241This skill works with other skills in the framework:242243**Development & Operations**:244245- [git-workflow](../git-workflow/SKILL.md) - Git bisect for finding regressions, version control workflows246- [dev-api-design](../dev-api-design/SKILL.md) - API debugging, error handling, REST patterns, status codes247248**Infrastructure & Platform**:249250- [ops-devops-platform](../ops-devops-platform/SKILL.md) - CI/CD pipelines, monitoring, incident response, SRE practices, Kubernetes ops251- [data-sql-optimization](../data-sql-optimization/SKILL.md) - Database query optimization, EXPLAIN ANALYZE, index tuning, slow query debugging252253---254255> **Success Criteria:** Issues are diagnosed systematically, root causes are identified accurately, fixes include regression tests, and debugging knowledge is documented for future reference.