tune-alerts
Skill0 starsChanged 6 months agoMITView on GitHub
Tune alerting rules using data-driven thresholds from baselines. Use when the user says "my alerts are noisy", "tune this alert", "reduce alert fatigue", "what threshold should I use", "alert is firing too often", "create an alerting rule", "write a PrometheusRule", "suggest alert thresholds", "review my alerts", or needs help with Prometheus alerting configuration.
In this repository4 other files it gives its agents.
- dashboardSkill
- define-sloSkill
- discoverSkill
- investigateSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
If the user provides an existing alert rule, parse it for:
- Distinctive: line 26
If creating a new alert, determine what to alert on based on the service's available metrics.
- Distinctive: line 53
If the alert has been firing/resolving frequently:
- Distinctive: line 96
If tuning an existing alert, show the comparison:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Data-Driven Alert Tuning
Tune alerting thresholds using actual baseline data from .sre/baselines/, not guesswork. Noisy alerts erode trust — data-driven thresholds are the fix.
Prerequisite: .sre/ context. Baselines are critical for this skill.
Phase 1: Understand the Alert
If the user provides an existing alert rule, parse it for:
- The metric being monitored
- Current threshold
for:duration (pending time)- Labels and routing
If creating a new alert, determine what to alert on based on the service's available metrics.
Phase 2: Query Historical Distribution
For the metric in question, query its distribution over 7-30 days:
# Percentiles over time
curl -s --get "${PROMETHEUS_URL}/api/v1/query" \
--data-urlencode 'query=quantile_over_time(0.50, <metric>[7d])'
curl -s --get "${PROMETHEUS_URL}/api/v1/query" \
--data-urlencode 'query=quantile_over_time(0.95, <metric>[7d])'
curl -s --get "${PROMETHEUS_URL}/api/v1/query" \
--data-urlencode 'query=quantile_over_time(0.99, <metric>[7d])'
# Standard deviation (for anomaly-based thresholds)
curl -s --get "${PROMETHEUS_URL}/api/v1/query" \
--data-urlencode 'query=stddev_over_time(<metric>[7d])'Phase 3: Recommend Thresholds
Strategy: Baseline + Headroom
- Warning: p95 of historical values (catches real anomalies, ignores normal variance)
- Critical: p99 + 1 standard deviation (fires only for true outliers)
for:duration: At least 5m for infrastructure, 2m for user-facing latency
Anti-Flapping
If the alert has been firing/resolving frequently:
# Check how often the metric crosses the current threshold
curl -s --get "${PROMETHEUS_URL}/api/v1/query_range" \
--data-urlencode 'query=<metric> > <current_threshold>' \
--data-urlencode 'start=<7d_ago>' \
--data-urlencode 'end=<now>' \
--data-urlencode 'step=5m'Count the number of transitions. If > 10/day, the threshold is too tight.
Phase 4: Generate Tuned Alert Rule
Output a PrometheusRule YAML:
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: <service>-alerts
namespace: monitoring
labels:
release: monitoring # matches kube-prometheus-stack selector
spec:
groups:
- name: <service>.rules
rules:
- alert: <ServiceName>HighCPU
expr: |
sum(rate(container_cpu_usage_seconds_total{
namespace="<ns>",pod=~"<pattern>",container!=""
}[5m])) > <data-driven-threshold>
for: 5m
labels:
severity: warning
service: <name>
annotations:
summary: "{{ $labels.pod }} CPU usage above baseline"
description: "CPU is {{ $value | humanize }} cores (baseline: <baseline> cores, threshold: <threshold> cores)"
runbook_url: ""Phase 5: Compare Old vs New
If tuning an existing alert, show the comparison:
Current threshold: 0.5 cores (fires 12x/day)
Recommended threshold: 0.85 cores (p95 + headroom)
Expected fire rate: ~1x/week (based on 7d history)Offer to apply via kubectl apply if in a Kubernetes environment.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

