agentleFS
charles-adedotuncharles-adedotun/sre-plugin/skills/define-slo/SKILL.md

define-slo

Skill0 starsChanged 6 months agoMITView on GitHub

Define SLOs and calculate error budgets for services. Use when the user asks to "define an SLO", "set a service level objective", "calculate error budget", "how much error budget do I have", "what's my availability", "create SLO recording rules", "generate SLO burn rate alerts", "track reliability", or needs SLO/SLI definitions.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use baselines from .sre/baselines/<name>.yaml to inform latency targets.

    line 40
  2. Very specific:

    Write SLO definition to .sre/services/<name>.yaml under the slos field:

    line 86

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

SLO Definition & Error Budget Tracking

Define Service Level Objectives, calculate error budgets, and generate Prometheus recording rules and burn-rate alert rules.

Prerequisite: .sre/ context from the discover skill.

Phase 1: Choose SLI Type

Based on available metrics in .sre/services/<name>.yaml:

If HTTP/gRPC metrics available:

  • Availability SLI: ratio of successful requests to total requests
    • 1 - (rate(http_requests_total{status=~"5.."}[window]) / rate(http_requests_total[window]))
  • Latency SLI: ratio of requests faster than threshold
    • histogram_quantile(0.99, rate(http_request_duration_seconds_bucket[window]))

If container metrics only:

  • Availability SLI: pod uptime ratio
    • avg_over_time(kube_deployment_status_replicas_available{deployment="X"}[window]) / kube_deployment_spec_replicas{deployment="X"}

Phase 2: Set Targets

Common SLO targets (suggest based on service criticality):

TierAvailabilityLatency p99Error Budget (30d)
Critical (payment, auth)99.95%based on baseline p99 × 1.521.6 min
Standard (API, frontend)99.9%based on baseline p99 × 243.2 min
Best-effort (batch, internal)99.5%N/A3.6 hours

Use baselines from .sre/baselines/<name>.yaml to inform latency targets.

Phase 3: Calculate Error Budget

Error budget = 1 - SLO target
Budget minutes (30d) = 30 * 24 * 60 * (1 - SLO)

Query current consumption:

# If availability SLI:
# Total errors in window / total requests in window
curl -s --get "${PROMETHEUS_URL}/api/v1/query" \
  --data-urlencode 'query=sum(increase(http_requests_total{job="<job>",status=~"5.."}[30d])) / sum(increase(http_requests_total{job="<job>"}[30d]))'

Phase 4: Generate Artifacts

Prometheus Recording Rules (YAML)

groups:
- name: slo:<service>
  rules:
  - record: slo:<service>:availability:ratio_rate5m
    expr: 1 - (sum(rate(http_requests_total{job="<job>",status=~"5.."}[5m])) / sum(rate(http_requests_total{job="<job>"}[5m])))
  - record: slo:<service>:error_budget:remaining
    expr: 1 - (slo:<service>:errors:ratio_30d / (1 - <SLO_TARGET>))

Multi-window Burn Rate Alerts

groups:
- name: slo:<service>:alerts
  rules:
  - alert: SLOBurnRateCritical
    expr: slo:<service>:availability:ratio_rate5m < <SLO> AND slo:<service>:availability:ratio_rate1h < <SLO>
    for: 2m
    labels:
      severity: critical
    annotations:
      summary: "<service> is burning error budget at critical rate"

Phase 5: Update Context

Write SLO definition to .sre/services/<name>.yaml under the slos field:

slos:
  - type: availability
    target: 0.999
    window: 30d
    sli_query: "<PromQL>"
    defined_at: <ISO timestamp>

Generate a Grafana panel for the error budget (use the dashboard skill patterns) and suggest adding it to the service's existing dashboard.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.