/quality-engineering:debugging-and-observabilityfrom quality-engineering
Practitioner guide to debugging, logging, error handling, and production observability. Covers Agans' nine rules, delta debugging, OpenTelemetry, structured logging, eBPF, SLO alerting, resilience patterns, and language-specific patterns for Python, TypeScript/JavaScript, and Go.
Ships in quality-engineering. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Systematic beats heroic. The fastest debuggers reproduce the failure, gather data ("quit thinking and look"), bisect the search space, and change one thing at a time. Reproducibility and correlation IDs are the two highest-leverage investments any team can make.
Observability has consolidated around OpenTelemetry, which graduated from the CNCF on May 11, 2026. Structured logging is the universal default. The frontier is wide structured events ("Observability 2.0"), continuous profiling as a fourth signal, and eBPF zero-instrumentation telemetry.
AI helps at the margins but is not trustworthy unsupervised. Veracode's 2025 study found 45% of AI-generated code introduced OWASP Top 10 vulnerabilities. The OpenRCA benchmark shows the best model solved only 11.34% of real root-cause-analysis cases at publication (rising toward ~36% by 2026). Use AI for triage, localization, and first-draft fixes — gate everything behind tests and human review.
Debugging is hypothesis-driven science: observe → hypothesize → predict → test → analyze → repeat. The cardinal sin is "debugging by changing things and seeing what happens" — mutating code based on guesses rather than evidence. Form a falsifiable hypothesis, predict what you'd observe if it were true, then test it.
From Debugging: The 9 Indispensable Rules (2002, ISBN 978-0-8144-7457-0) — technology-agnostic, canonical mindset framework:
Cognitive biases actively sabotage debugging:
Agans' Rule 8 ("get a fresh view") is the institutional countermeasure.
Explaining code line-by-line to an inanimate object works through the self-explanation effect (Chi, de Leeuw, Chiu & LaVancher, Cognitive Science 18(3):439–477, 1994) and the production effect. Articulation forces tacit assumptions explicit, exposing the gap between what you think the code does and what it says.
Caveat: Widely-circulated "fixes 56% more bugs" claims trace only to low-quality secondary sources with no underlying study. The legitimate evidence base is the self-explanation and metacognition literature, not a controlled debugging trial.
Gloria Mark (UC Irvine, 2004) found it takes an average of 23 minutes 15 seconds to fully return to a task after an interruption. Timebox solo debugging (30–60 minutes) before escalating to pair debugging, and protect debugging sessions from interruption.
"If it can't be reproduced it can't be fixed." Strategies:
git bisect to find the commit that introduced a regressionDelta debugging (Andreas Zeller, Saarland University, 1999; formalized in Zeller & Hildebrandt, IEEE TSE 28(2):183–200, 2002, DOI 10.1109/32.988498) automates minimization using a binary-search-with-twist algorithm (ddmin) to reduce a failing input to a 1-minimal test case where no single element can be removed.
Canonical case study: Mozilla crashed after 95 user actions; the prototype automatically reduced it to 3 relevant actions and simplified 896 lines of HTML to the single line that caused the failure, in 139 automated test runs (~35 minutes on a 500 MHz PC).
Modern reducers (Perses, C-Reduce, DustMite) build on delta debugging; it pairs naturally with fuzzing. Worst case is O(n²).
Correlation IDs are the fundamental distributed-debugging primitive. Every system should propagate them from day one.
Propagate request context through the call chain without threading parameters everywhere using per-language mechanisms:
contextvarsAsyncLocalStoragecontext packageThe W3C TraceContext standard propagates traceparent/tracestate headers across service boundaries.
High-cardinality attributes are essential for root cause. High-cardinality fields let you answer "is this affecting everyone, or only a specific subset?" — distinguishing a generic error spike from "the error spike is coming from user:8675309 on the canary deployment in eu-west-1 who has the new-checkout-flow feature flag enabled."
Logs are the primary data source when production bugs can't be reproduced locally. Watch the Heisenberg problem: excessive logging changes the timing/behavior of the system being observed and can itself cause performance issues on hot paths.
Structured over unstructured logging is the modern default. JSON is the lingua franca. The rule: the message field is a static, greppable string; variable data goes in structured fields.
| Level | Purpose |
|---|---|
| TRACE | Finest detail |
| DEBUG | Diagnostic |
| INFO | Business events |
| WARN | Recoverable/unusual |
| ERROR | Failures needing attention |
| FATAL/CRITICAL | Process death |
Run production at INFO or WARN. Support dynamic level adjustment at runtime without restart.
Common misuse: logging everything at INFO, or using ERROR for recoverable conditions (causing alert fatigue).
Log:
initCause)Never log:
ReplaceAttr in Go slog, redaction in Pino, Serilog enrichers)A complete log record carries: timestamp (UTC), level, message, service/component, correlation/trace ID, user/tenant context, environment, host/pod, and additional structured fields. The emerging standard for field naming is OpenTelemetry semantic conventions (e.g., http.method, http.status_code, exception.type/exception.message/exception.stacktrace).
Java/JVM:
java.util.logging@Slf4j, MDC for contextPython:
logging (baseline)python-json-logger for JSON outputcontextvars for propagationNode.js:
console.log in productionAsyncLocalStorage for context propagationGo:
log/slog (standard library since Go 1.21, largest stdlib addition since Go 1) — now the recommended defaultLogger + pluggable Handler (TextHandler/JSONHandler).NET/C#:
Microsoft.Extensions.Logging abstraction with ILogger<T> + DIRust:
log (API) + env_logger for simple casesRuby: stdlib Logger, Ougai, semantic_logger, Rails logger
PHP: Monolog (PSR-3) is the standard
Shipping patterns: sidecar (Fluentd/Fluent Bit), DaemonSet shippers, application-direct
Fluent Bit — lightweight, high-performance C-based shipper
Fluentd — heavier, plugin-rich Ruby-based aggregator
Backends:
Cost management: tiered hot/warm/cold retention and selective indexing.
OpenTelemetry graduated from the CNCF on May 11, 2026 (announced May 21, 2026 at the Observability Summit), confirming its status as the de facto observability standard — the second-highest-velocity CNCF project after Kubernetes.
Scale: Over 12,000 contributors from over 2,800 companies. In the past twelve months, the OTel JavaScript API package was downloaded more than 1.36 billion times and the Python API package surpassed 1.3 billion downloads, both setting new monthly download records in April 2026.
What OTel provides:
Adopt OTel now. Auto-instrument for traces, emit structured JSON logs with trace IDs, propagate correlation IDs from day one. This is the highest-leverage observability investment.
The four signals complement each other:
| Signal | Purpose |
|---|---|
| Metrics | Numeric time-series — alert you |
| Logs | Discrete events with context — explain what happened |
| Traces | Request flow across services — show where |
| Continuous Profiling | CPU/memory/goroutine flame graphs in production — show how much |
A trace = trace ID + spans (span ID, parent, attributes, events, status).
Sampling strategies: head-based, tail-based (decide after outcome), adaptive.
Backends: Jaeger, Zipkin, Grafana Tempo, Honeycomb, Datadog APM, Azure Monitor, AWS X-Ray.
Always include trace ID + span ID in every log record for log↔trace correlation. The otelslog bridge (Go), WinstonInstrumentation, and Serilog Activity enrichment do this automatically.
Always-on, aggregated CPU/memory profiling in production for trend analysis and deploy-correlated regression detection. Overhead is typically under 1% at production sampling rates.
Tools: Parca (CNCF), Grafana Pyroscope, Google Cloud Profiler, Datadog Continuous Profiler.
APM: Datadog APM (market leader), New Relic, Dynatrace, Elastic APM, Honeycomb (wide events, high cardinality, BubbleUp).
Error tracking:
Sentry Seer: Runs RCA → Solution → Code Generation using issue context, traces, logs, and profiles. Vendor-reported "94.5% accuracy / 38,000+ issues helped" — not independently audited.
AI observability assistants:
eBPF runs sandboxed programs in the Linux kernel for observability without kernel-module changes or app instrumentation — "zero-instrumentation observability."
Key tools:
In 2025, AWS EKS adopted Cilium as a default CNI. The OTel eBPF profiling agent (donated by Elastic) brought whole-system continuous profiling.
Limitations: Linux-only, kernel-version requirements, steep expertise curve.
The core tension: too few alerts miss problems; too many cause alert fatigue. The SRE philosophy is symptom-based alerting on user-visible behavior, not cause-based alerting.
Burn rate = how fast you consume the error budget relative to the rate that would exactly exhaust it over the SLO window.
Recommended multi-window, multi-burn-rate setup (30-day SLO window):
| Trigger | Burn Rate | Long Window | Short Window | Action |
|---|---|---|---|---|
| Page immediately | ~14.4 | 1 hour | 5 min | 2% budget consumed |
| Ticket | ~6 | 6 hours | 30 min | 5% budget consumed |
| Track | ~1 | 3 days | 6 hours | 10% budget consumed |
The short secondary window (1/12 of the long window) reduces false positives.
Example threshold: If your error rate is fine but burn rate exceeds ~14.4 on a 1-hour window, page immediately; if a 1% error rate sits on a 99.9% SLO, that's a 10× burn — treat it as an active incident.
ML-based anomaly detection (Datadog Watchdog, Dynatrace Davis) supplements static thresholds.
OpsGenie sunset notice: End of sale June 4, 2025; full end of support April 5, 2027, after which all OpsGenie data is deleted. Migrate to PagerDuty, incident.io, Jira Service Management, or Compass.
The fundamental question is propagate vs. handle locally. "Let it crash" (Erlang/Elixir — supervised processes restart cleanly) suits systems with strong supervision and isolation; defensive handling suits monoliths without it.
Distinguish recoverable vs. unrecoverable and fail-fast vs. fail-safe.
Most dangerous anti-pattern: catching an exception and doing nothing (swallowing). Preserve the original cause and stack trace — the "poisoned exception" problem is re-throwing without chaining.
Functional approaches make errors part of the type signature:
Result<T,E>(value, error)EitherTryException-based languages (Java, Python, C#) separate the happy path but risk invisible control flow. Railway-oriented programming (Scott Wlaschin) chains fallible operations via Result types.
Libraries bringing result types to exception languages: Vavr (Java), neverthrow (TypeScript), OneOf/FluentResults (.NET).
Taxonomy: system, application, user, transient (retryable), permanent (not retryable). Structured errors carry both a human message and machine-readable fields (code, status, context).
RFC 9457 (Problem Details for HTTP APIs, July 2023, obsoletes RFC 7807): The standard for machine-readable HTTP errors, using media type application/problem+json with members type (URI identifying the problem type), title, status, detail, and instance, plus custom extension members.
Critically: "Problem details are not a debugging tool for the underlying implementation" — don't leak internals in API responses.
Formula: delay = random(0, min(cap, base × 2^attempt))
AWS's Marc Brooker showed full jitter dramatically reduces synchronized retry storms ("thundering herd") vs. no-jitter backoff: "In the case with 100 contending clients, we've reduced our call count by more than half." AWS SDKs use jittered exponential backoff with a 20-second cap and a token-bucket retry quota.
Rules:
State machine: closed → open → half-open. Trips on a failure threshold to stop hammering a failing dependency, preventing cascade and resource exhaustion.
Reference implementations:
Resilience4j nesting: Retry(CircuitBreaker(RateLimiter(TimeLimiter(Bulkhead(fn))))).
Isolate resource pools so one dependency's failure doesn't drain all threads/connections.
Map status codes correctly: 2xx success, 3xx redirect, 4xx client error, 5xx server error.
Recurring decisions: 404 vs 200-with-error-body; 403 vs 404 for security (hide existence); 422 vs 400 for validation. Provide field-level validation error lists. Keep error response shapes consistent across microservices. Separate detailed internal errors (logged) from safe external messages (no stack traces, SQL, or connection strings in API responses).
The fallacies of distributed computing each create a debugging challenge: network is reliable, latency is zero, bandwidth is infinite, network is secure, topology is static, one administrator, transport cost is zero, network is homogeneous.
Partial failures (a service that is up but slow, degraded, or returning wrong answers) are harder than binary up/down. Clock skew means timestamps from different services can't be totally ordered without vector clocks or hybrid logical clocks. Delivery semantics (at-most-once / at-least-once / exactly-once) determine retry safety.
google.rpc.Status error detailsProfiling tools:
Kubernetes: kubectl exec, ephemeral debug containers (kubectl debug), pod describe/events, cross-pod log streaming.
Chaos engineering as proactive debugging — built on Netflix's Chaos Monkey (invented 2011, open-sourced 2012, Apache 2.0). The Simian Army extended it: Latency Monkey injects network latency, Chaos Gorilla simulates AZ failure, Chaos Kong a whole Region.
Principles of Chaos Engineering (principlesofchaos.org):
Tools:
OpenRCA benchmark (ICLR 2025, Microsoft/Tsinghua — 335 real failure cases across three enterprise systems with 68+ GB of telemetry):
This is real progress but remains far below human reliability and far below coding benchmarks.
Veracode's 2025 GenAI Code Security Report tested 100+ LLMs across 80 tasks:
pdb/ipdb: commands n (next), s (step), c (continue), p (print), bt (backtrace), l (list), q (quit)breakpoint() builtin (Python 3.7+) — invokes pdb by defaultlogging.exception() for full context including stack traceloop.set_debug(True))raise X from Y chaining; contextlib.suppress.error, .warn, .table, .group, .time, .trace, .assert--async-stack-traces for better async debuggingunhandledRejection/uncaughtException handlers for process-level error capturedlv debug/test/attach/core) — the Go debuggergo tool pprof — CPU/heap/goroutine/mutex/block flame graphsgo test -race / ThreadSanitizer — race condition detectionlog/slog — standard library structured logging (Go 1.21+)go vet/staticcheck — static analysiserrors.Is/errors.As (Go 1.13+), %w wrapping, sentinel and custom error types(value, error) idiom — the Go team withdrew if err != nil reduction proposals in 2024–2025; the pattern will stay-XX:+HeapDumpOnOutOfMemoryError, -XX:+PrintGCDetailsdotnet-dump/dotnet-trace/dotnet-countersMicrosoft.Extensions.LoggingPower moves underused by most engineers:
Lightrun / Rookout — inject logpoints/breakpoints into running production code without restart or source changes.
Leak detection via heap profiling and memory-growth monitoring. Common causes: lingering references, JS event-listener leaks, unintended statics.
Tools: Eclipse MAT (JVM), dotMemory (.NET), AddressSanitizer/MemorySanitizer/Valgrind (C/C++), gc/objgraph (Python reference cycles), Chrome DevTools heap snapshots (V8).
go test -raceAsync pitfalls: Promise swallowing, await in loops, event-loop blocking. Connection-pool exhaustion is a frequent concurrency-induced production failure.
Network: curl/httpie, Postman/Insomnia, Wireshark/tcpdump, openssl s_client for TLS chains, dig/nslookup for DNS, grpcurl for gRPC.
Database/query debugging:
EXPLAIN/EXPLAIN ANALYZE for query plans (missing indexes, table scans, join strategy)pg_locks+pg_stat_activity (Postgres)Tests are debugging tools: a focused failing test pinpoints exactly what broke.
should_throw_when_X)Finds tests that pass even when code is broken:
Mutation score is a signal of test suite quality.
Generates edge cases automatically and shrinks failures to a minimal example (automating MRE creation):
Stateful variants find state-dependent bugs.
A good bug report captures: steps to reproduce, expected vs. actual behavior, environment, frequency, severity, business impact, customer screenshots/logs.
Triage questions: All users or some? Did something change? Is there a workaround? What is the urgency?
| Priority | Meaning |
|---|---|
| P0 | Production down |
| P1 | Major feature broken |
| P2 | Workaround exists |
| P3 | Minor |
| P4 | Enhancement |
SLA turnaround scales with severity. The "can we reproduce it?" gate drives prioritization.
Five Whys (Toyota/Ohno) — drills from symptom to systemic cause. Known limitation: assumes a single linear causal chain. Complex software systems fail through networks of contributing conditions, not single root causes.
Complementary techniques:
Avoid "fix the symptom not the cause" — verify the proposed root cause explains all observed symptoms.
Charity Majors (Honeycomb) defines observability via control theory: "the ability to ask any question of your systems — understand any internal state just by observing it from the outside — without having to predict that question in advance." This is about unknown-unknowns, requiring high cardinality and high dimensionality with no pre-aggregation.
Observability 1.0: three pillars (metrics, logs, traces) in separate tools; cost driven by cardinality.
Observability 2.0: a single source of truth of arbitrarily-wide structured events stored in a columnar database, from which metrics/traces are derived; cost driven by traffic/architecture, scaling with business value. "You can derive metrics from these wide events. And you can't go any other direction."
Observability-Driven Development (ODD): engineers design the right logs, metrics, and spans before a bug happens. Missing observability is "dark debt." Test that your instrumentation actually emits correctly.
Caveat: "Observability 2.0" is a contested framing advanced primarily by Majors/Honeycomb (a vendor with a commercial interest in wide-event tooling). The three-pillars model remains widely and effectively used.
| Situation | Action |
|---|---|
| Cannot reliably reproduce a bug | Stop fixing; invest in reproduction infrastructure (record/replay, better logging) |
| Burn rate >14.4 on 1-hour window | Page immediately — treat as active incident |
| AI fix touches auth/crypto/input handling/data access | Mandatory human security review regardless of confidence |
| Solo debugging >30–60 minutes | Rubber-duck or pair (Agans' Rule 8) |
| Error rate 1% on 99.9% SLO | That's 10× burn rate — active incident |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
OpenTelemetry, Python, TypeScript, JavaScript, Go, Elasticsearch
debugging, observability, logging, opentelemetry, error-handling, resilience
npx claudepluginhub theviziusgroup/vibe-engineering-skills --plugin quality-engineering2 plugins ship this exact skill · first indexed Aug 12, 2026
3 skills in this plugin
/python-quality-testingUse when writing Python tests, setting up pytest, implementing TDD in Python, using Hypothesis for property-based testing, setting up mutation testing, configuring Ruff/mypy/Black, implementing contract testing with Pact, or building Python quality pipelines on Azure. Triggers on any Python testing or quality tooling question, including pytest fixtures, parametrize, conftest, coverage thresholds, testcontainers, Azurite, Cosmos DB emulator, or Azure DevOps pipeline YAML for Python./test-strategyUse when designing a test strategy, choosing a testing framework, setting up test architecture, balancing unit vs integration vs E2E tests, implementing contract testing between services, or assessing test suite health. Use whenever someone asks about how to test or what testing approach to take. Also triggers on test pyramid questions, microservice testing, Swiss Cheese model, SMURF, TDD vs BDD choices, test doubles (mock vs stub vs fake), or any question about test portfolio design.Other plugins' skills for the same job