Monitoring

From tinh2/skills-hub-registry · View interactive version

Monitoring is an AI agent skill from the GitHub repository tinh2/skills-hub-registry. Set up application observability with Prometheus, Grafana, Datadog, or CloudWatch — instrument metrics endpoints, configure Golden Signal dashboards, define alert rules with burn-rate SLOs, and add structured logging

How to use this skill

Skill file

You are in AUTONOMOUS MODE. Do NOT ask questions. Do NOT pause for confirmation.

Execute every phase below in sequence, making decisions based on what you find.

============================================================

PHASE 0 — INPUT

============================================================

$ARGUMENTS may contain:

============================================================

PHASE 1 — INFRASTRUCTURE DETECTION

============================================================

Scan for existing monitoring setup:

Prometheus ecosystem:

Cloud-native:

Third-party:

Application stack:

Infrastructure:

============================================================

PHASE 2 — METRICS DESIGN (Golden Signals)

============================================================

Design metrics based on the Four Golden Signals:

1. Latency — time to service a request

2. Traffic — demand on the system

3. Errors — rate of failed requests

4. Saturation — how full the service is

============================================================

PHASE 3 — APPLICATION INSTRUMENTATION (if --instrument)

============================================================

Add metrics middleware to the application:

Node.js (Express/Fastify):

Python (FastAPI/Django):

Go:

Also add to the application:

============================================================

PHASE 4 — PROMETHEUS + GRAFANA SETUP

============================================================

If using Prometheus stack, generate:

monitoring/prometheus/prometheus.yml:

monitoring/prometheus/alerts/app.yml:

Alert rules (all with for duration to prevent flapping):

monitoring/grafana/dashboards/app.json:

Grafana dashboard JSON with panels:

  1. Request Rate (by status code)
  2. Error Rate (percentage over time)
  3. Latency Distribution (heatmap)
  4. P50/P90/P99 Latency (time series)
  5. Active Connections (gauge)
  6. Memory Usage (time series)
  7. CPU Usage (time series)
  8. Saturation (connection pool, queue depth)

monitoring/grafana/provisioning/dashboards.yml: File-based dashboard provisioning.

Docker Compose (monitoring/docker-compose.monitoring.yml):

============================================================

PHASE 5 — CLOUD MONITORING (if Datadog/CloudWatch/New Relic)

============================================================

Datadog:

CloudWatch:

New Relic:

============================================================

PHASE 6 — SLO CONFIGURATION (if --slo)

============================================================

Define SLOs based on service type:

Generate burn rate alerts:

============================================================

SELF-HEALING VALIDATION (max 2 iterations)

============================================================

After completing deployment/infrastructure changes, validate:

  1. Verify all generated files are syntactically valid (YAML, JSON, HCL, Dockerfile).
  2. Run validation commands if available (terraform validate, docker build --check, kubectl dry-run).
  3. Verify no secrets, credentials, or sensitive values are hardcoded.
  4. If validation fails, diagnose and fix the specific syntax or config error.
  5. Repeat up to 2 iterations.

IF STILL FAILING after 2 iterations:

============================================================

OUTPUT

============================================================

## Monitoring Setup Complete

### Stack: {Prometheus + Grafana / Datadog / CloudWatch / New Relic}

### Files Created
{list of all generated files with one-line descriptions}

### Metrics Endpoints
- Application: http://localhost:{port}/metrics
- Prometheus: http://localhost:9090
- Grafana: http://localhost:3001 (admin/admin)
- Alertmanager: http://localhost:9093

### Alert Rules
| Alert | Condition | Severity |
|-------|-----------|----------|
| HighErrorRate | >1% for 5m | critical |
| HighLatency | P99 >2s for 5m | warning |
| HighMemory | >512MB for 10m | warning |
| DiskUsageHigh | >80% for 5m | warning |
| ServiceDown | down for 1m | critical |

### Dashboard Panels
{list of dashboard panels with their metric queries}

============================================================

NEXT STEPS

============================================================

  1. Start monitoring stack: docker compose -f monitoring/docker-compose.monitoring.yml up -d
  2. Verify metrics are being scraped: check Prometheus targets page at :9090/targets
  3. Configure alerting notification channels (Slack, PagerDuty, email) in Alertmanager
  4. Add application-specific custom metrics for business KPIs
  5. Set up log aggregation if not already configured (Loki, ELK)
  6. Review alert thresholds after 1 week of baseline data

============================================================

SELF-EVOLUTION TELEMETRY

============================================================

After producing output, record execution metadata for the /evolve pipeline.

Check if a project memory directory exists:

Entry format:

### /monitoring — {{YYYY-MM-DD}}
- Outcome: {{SUCCESS | PARTIAL | FAILED}}
- Self-healed: {{yes — what was healed | no}}
- Iterations used: {{N}} / {{N max}}
- Bottleneck: {{phase that struggled or "none"}}
- Suggestion: {{one-line improvement idea for /evolve, or "none"}}

Only log if the memory directory exists. Skip silently if not found.

Keep entries concise — /evolve will parse these for skill improvement signals.

============================================================

DO NOT

============================================================

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.