Add production observability—health checks, metrics, tracing, alerts, and runbooks—when the task is to instrument or operationalize an existing service.
Instalação
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Add production observability—health checks, metrics, tracing, alerts, and runbooks—when the task is to instrument or operationalize an existing service.
Monitoring Setup
Overview
Add production-grade observability to any service by instrumenting health
checks, metrics, tracing, and alerts as a cohesive system. The skill treats
monitoring as structured output — not ad-hoc logging — producing files that
integrate with standard observability stacks (Prometheus, Grafana,
OpenTelemetry, PagerDuty/OpsGenie).
When to use
The task is to instrument or operationalize an existing service with health checks, metrics, tracing, alerts, or runbooks.
The user is preparing a system for production readiness, SLOs, or on-call support.
The deliverable is observability configuration, code instrumentation, and operational guidance.
The problem is missing monitoring coverage, not analysis of an already-failing monitoring stack.
Do NOT use when:
The task is debugging a current incident or broken observability pipeline.
The request is only vendor-specific dashboard clicking with no reusable monitoring design.
The work is log aggregation alone without broader observability requirements.
Response format
Always structure the final response with these top-level sections, in this order:
Summary — state the task, scope, and main conclusion in 1-3 sentences.
Decision / Approach — state the key classification, assumptions, or chosen path.
Artifacts — provide the primary deliverable(s) for this skill. Use clear subheadings for multiple files, commands, JSON payloads, queries, or documents.
Validation — state checks performed, important risks, caveats, or unresolved questions.
Next steps — list concrete follow-up actions, or write None if nothing remains.
Rules:
Do not omit a section; write None when a section does not apply.
If files are produced, list each file path under Artifacts before its contents.
If commands, JSON, SQL, YAML, or code are produced, put each artifact in fenced code blocks with the correct language tag when possible.
Keep section names exactly as written above so output stays predictable across skills.
Workflow
1. Add health check endpoints
Create three distinct health check endpoints. Each serves a different purpose in
orchestration systems like Kubernetes:
Endpoint
Path
Purpose
What to check
Liveness
GET /healthz
"Is the process alive?"
Process is running, not deadlocked. Minimal checks only.
Migrations run, config loaded, initial data seeded.
Critical distinction: Liveness should NEVER check external dependencies. If
your liveness probe checks the database and the DB goes down, Kubernetes will
restart your healthy pods — making an outage worse. Liveness = "is this process
fundamentally broken?" Readiness = "should traffic be routed here?"
Every alert MUST include a runbook annotation linking to resolution steps.
5. Create runbook templates
Generate a runbook for each alert with this structure:
# Runbook: [Alert Name]## Alert Details-**Severity:** critical/warning/info
-**SLO:** Which SLO this protects
-**Dashboard:** Link to relevant Grafana dashboard
## Symptoms
What the operator will observe when this fires.
## Diagnosis Steps1. Check [specific metric/dashboard]
2. Look for [specific log pattern]
3. Verify [specific dependency]
## Resolution### If caused by [root cause A]1. Step-by-step fix
### If caused by [root cause B]1. Step-by-step fix
## Escalation- If not resolved in [time]: escalate to [team/person]
- If customer-facing: notify [channel]
6. Generate dashboard configuration
Produce a Grafana dashboard JSON or config covering:
Liveness = process health only. Move dependency checks to readiness. DB down + liveness fail = cascading restarts.
Using console.log instead of metrics
Logs are for debugging, metrics are for monitoring. Use counters/histograms for anything you'd alert on.
Arbitrary alert thresholds ("error > 10")
Derive thresholds from SLOs and burn rates. "10 errors" means nothing without knowing request volume.
No correlation ID propagation
Generate trace ID on ingress, propagate to ALL downstream calls. Without this, distributed debugging is impossible.
Missing runbook links on alerts
Every alert must link to a runbook. An alert without a runbook is just noise that trains operators to ignore alerts.
Single health endpoint for everything
Separate liveness/readiness/startup. Kubernetes uses them differently; conflating them causes incorrect pod lifecycle decisions.
Metrics without labels
Always label with method, path, status. Aggregate metrics hide the signal — you need to slice by dimension.
No histogram buckets for latency
Use histograms, not averages. P99 latency matters more than mean. Configure buckets for your expected range.
Quick reference
Component
Output file
Format
Health checks
health.{js,ts,py}
Express/Fastify/Flask routes
Metrics
metrics.{js,ts,py}
Prometheus client + middleware
Tracing
tracing.{js,ts,py}
OpenTelemetry SDK config
Alert rules
alert-rules.yml
Prometheus alerting rules
Runbooks
runbooks/*.md
Markdown per alert
Dashboard
dashboard.json
Grafana dashboard JSON
Key principles
Liveness is sacred — Never put dependency checks in liveness probes. A
liveness failure triggers a pod restart. If your DB is down and liveness
checks the DB, Kubernetes restarts all pods, making recovery harder. Liveness
answers only: "is this process fundamentally broken?"
SLOs drive alerts — Every alert threshold must trace back to a Service
Level Objective. "Error rate > 1%" is meaningless without knowing the SLO.
Use burn rate alerting: alert when you're consuming error budget faster than
sustainable.
Metrics over logs — Anything you would alert on must be a metric, not a
log line. Metrics are aggregatable, queryable, and cheap. Log-based alerting
is fragile, expensive, and misses patterns that counters catch naturally.
Trace everything cross-service — Every request entering the system gets a
trace ID. Every downstream call propagates it. Without end-to-end tracing,
debugging distributed systems requires correlating timestamps across log
streams — which doesn't scale.
Alerts without runbooks are noise — Every alert must link to a runbook
with diagnosis steps and resolution procedures. Operators receiving alerts
without context will either ignore them or waste time investigating from
scratch. Runbooks encode institutional knowledge.
Optimization Notes
Preserve the user's requested output shape exactly and do not substitute generic advice for concrete artifacts.
Include exact commands, code structures, protocol fields, tags, parameters, file paths, or deliverable sections when the task asks for them.
Make safety gates explicit before irreversible, destructive, externally visible, or compliance-sensitive actions.
For multi-step work, present steps in execution order and include validation or rollback checks where relevant.
Avoid overfitting to a single eval example: express lessons as reusable rules, not as task-specific answers.