$npx -y skills add girijashankarj/cursor-handbook --skill monitoringWorkflow for implementing comprehensive monitoring and alerting. Use when the user needs to set up or improve service monitoring.
| 1 | # Skill: Set Up Monitoring |
| 2 | |
| 3 | ## Trigger |
| 4 | When the user needs to set up or improve service monitoring. |
| 5 | |
| 6 | ## Steps |
| 7 | |
| 8 | ### Step 1: Define Metrics |
| 9 | - [ ] Request rate (throughput) |
| 10 | - [ ] Error rate (4xx, 5xx) |
| 11 | - [ ] Latency (p50, p95, p99) |
| 12 | - [ ] Resource utilization (CPU, memory, disk) |
| 13 | - [ ] Business metrics (domain-specific) |
| 14 | |
| 15 | ### Step 2: Implement Structured Logging |
| 16 | - [ ] JSON format for all logs |
| 17 | - [ ] Required fields: timestamp, level, correlationId, service |
| 18 | - [ ] No PII in logs |
| 19 | - [ ] Appropriate log levels (error, warn, info, debug) |
| 20 | |
| 21 | ### Step 3: Set Up Tracing |
| 22 | - [ ] Add OpenTelemetry or provider-specific SDK |
| 23 | - [ ] Instrument HTTP requests |
| 24 | - [ ] Instrument database queries |
| 25 | - [ ] Instrument external service calls |
| 26 | - [ ] Configure sampling rate |
| 27 | |
| 28 | ### Step 4: Create Dashboards |
| 29 | - [ ] Service health overview |
| 30 | - [ ] Request rate and error rate |
| 31 | - [ ] Latency percentiles |
| 32 | - [ ] Resource utilization |
| 33 | - [ ] Business KPIs |
| 34 | |
| 35 | ### Step 5: Configure Alerts |
| 36 | - [ ] Error rate > 1% → P3 |
| 37 | - [ ] Error rate > 5% → P1 |
| 38 | - [ ] p99 latency > 2s → P3 |
| 39 | - [ ] CPU > 80% → P3 |
| 40 | - [ ] Health check failure → P1 |
| 41 | - [ ] Set notification channels |
| 42 | |
| 43 | ### Step 6: Create Runbooks |
| 44 | - [ ] For each alert, write a runbook: |
| 45 | - What the alert means |
| 46 | - Investigation steps |
| 47 | - Resolution steps |
| 48 | - Escalation path |
| 49 | |
| 50 | ## Completion |
| 51 | Monitoring, alerting, and runbooks are in place. |