Claude Code for SRE: SLOs, Error Budgets, and Reliability Engineering — Claude Skills 360 Blog
Blog / Operations / Claude Code for SRE: SLOs, Error Budgets, and Reliability Engineering
Operations

Claude Code for SRE: SLOs, Error Budgets, and Reliability Engineering

Published: September 26, 2026
Read time: 8 min read
By: Claude Skills 365

Site Reliability Engineering replaces vague “system is healthy” monitoring with concrete, business-aligned commitments: “99.9% of checkout requests succeed within 2 seconds.” These Service Level Objectives (SLOs) connect reliability to business impact, give teams an error budget to work with, and create clear escalation thresholds. Claude Code helps define SLOs, write the Prometheus recording rules and alerts, build dashboards, and structure postmortems.

Defining SLIs and SLOs

Define SLOs for our e-commerce checkout service.
We want to measure what actually matters to users.

SLI (Service Level Indicator): The metric you measure
SLO (Service Level Objective): The threshold you commit to
Error Budget: 100% - SLO = how much failure is allowed

# slo-definitions.yaml — human-readable SLO definitions
service: checkout-api
owner: payments-team
review_schedule: quarterly

slos:
  - name: checkout_availability
    description: "Successful checkout completions as a fraction of all attempts"
    # SLI: count of successful responses / total requests
    sli:
      numerator: "requests with status < 500"
      denominator: "all requests to /api/checkout"
    target: 99.9%    # 43.8 minutes downtime/month allowed
    window: 30d
    
  - name: checkout_latency
    description: "95% of checkout requests complete within 2 seconds"
    sli:
      metric: "p95 latency for POST /api/checkout"
    target: 99%      # 1% of requests can exceed 2s
    threshold: 2000ms
    window: 30d
    
  - name: payment_success_rate
    description: "Payment processing success rate (excludes declined cards)"
    sli:
      numerator: "payment_intents with status=succeeded"
      denominator: "payment_intents where status != 'requires_payment_method'"
    target: 99.5%
    window: 7d

Prometheus Recording Rules

Implement the SLOs as Prometheus recording rules and burn rate alerts.
# prometheus/rules/checkout-slo.yaml
groups:
  - name: checkout_slo_recording
    interval: 30s
    rules:
      # --- Availability SLI ---
      
      # Request rate: good requests (non-5xx)
      - record: job:checkout_requests_success:rate5m
        expr: |
          sum(rate(http_requests_total{
            job="checkout-api",
            status!~"5.."
          }[5m]))
      
      # Total request rate
      - record: job:checkout_requests_total:rate5m
        expr: |
          sum(rate(http_requests_total{
            job="checkout-api"
          }[5m]))
      
      # Error rate (complement of availability)
      - record: job:checkout_error_rate:rate5m
        expr: |
          1 - (job:checkout_requests_success:rate5m / job:checkout_requests_total:rate5m)
      
      # Multi-window error rates (for multi-window burn rate alerts)
      - record: job:checkout_error_rate:rate1h
        expr: |
          1 - (
            sum(rate(http_requests_total{job="checkout-api",status!~"5.."}[1h]))
            /
            sum(rate(http_requests_total{job="checkout-api"}[1h]))
          )
      
      - record: job:checkout_error_rate:rate6h
        expr: |
          1 - (
            sum(rate(http_requests_total{job="checkout-api",status!~"5.."}[6h]))
            /
            sum(rate(http_requests_total{job="checkout-api"}[6h]))
          )
      
      # Error budget remaining (1 = full budget, 0 = fully consumed)
      - record: job:checkout_error_budget_remaining:30d
        expr: |
          1 - (
            (1 - job:checkout_error_rate:rate5m)
            /
            (1 - 0.999)  # SLO = 99.9%
          )
  
  - name: checkout_slo_alerts
    rules:
      # Burn rate alert: fast burn (page now)
      # Consuming 14.4x budget = will exhaust remaining budget in ~1 hour
      - alert: CheckoutSLOFastBurn
        expr: |
          job:checkout_error_rate:rate1h > (14.4 * (1 - 0.999))
          and
          job:checkout_error_rate:rate5m > (14.4 * (1 - 0.999))
        for: 2m
        labels:
          severity: critical
          team: payments
        annotations:
          summary: "Checkout SLO burning budget at 14x rate"
          description: |
            Error rate {{ $value | humanizePercentage }} is 14x above SLO threshold.
            At this rate, the full 30-day error budget will be consumed in ~2 hours.
          runbook: https://runbooks.internal/checkout-high-error-rate
      
      # Slow burn (alert for on-call awareness, not immediate page)
      # Consuming 6x budget = will exhaust remaining budget in ~5 days
      - alert: CheckoutSLOSlowBurn
        expr: |
          job:checkout_error_rate:rate6h > (6 * (1 - 0.999))
          and
          job:checkout_error_rate:rate1h > (6 * (1 - 0.999))
        for: 15m
        labels:
          severity: warning
          team: payments
        annotations:
          summary: "Checkout SLO slow burn — investigate during business hours"
          description: "Error rate elevated for 6+ hours. Budget consumption: 6x normal."
      
      # Latency SLO: P95 > 2s for 5 minutes
      - alert: CheckoutLatencySLOBreach
        expr: |
          histogram_quantile(0.95,
            sum(rate(http_request_duration_seconds_bucket{
              job="checkout-api",
              path="/api/checkout"
            }[5m])) by (le)
          ) > 2.0
        for: 5m
        labels:
          severity: critical

Error Budget Tracking Dashboard

Build a Grafana dashboard that shows our error budget consumption
over the 30-day rolling window.
{
  "panels": [
    {
      "title": "Checkout SLO - 30 Day Error Budget Remaining",
      "type": "gauge",
      "targets": [{
        "expr": "job:checkout_error_budget_remaining:30d * 100",
        "legendFormat": "Budget Remaining %"
      }],
      "fieldConfig": {
        "defaults": {
          "unit": "percent",
          "thresholds": {
            "steps": [
              {"color": "red", "value": 0},
              {"color": "yellow", "value": 25},
              {"color": "green", "value": 50}
            ]
          }
        }
      }
    },
    {
      "title": "Error Rate - 1h vs SLO",
      "type": "timeseries",
      "targets": [
        {
          "expr": "job:checkout_error_rate:rate1h * 100",
          "legendFormat": "Error Rate %"
        },
        {
          "expr": "vector((1 - 0.999) * 100)",
          "legendFormat": "SLO Threshold (0.1%)"
        }
      ]
    }
  ]
}

Blameless Postmortem Template

We had an outage. Help me write a blameless postmortem
that focuses on systemic issues.
# Postmortem: Checkout Service Outage — 2026-09-25

**Status**: Complete  
**Severity**: SEV1 (complete checkout unavailability, 47 minutes)  
**Error Budget Impact**: 32.6% of 30-day budget consumed in this incident  

## Impact
- Duration: 2026-09-25 14:23 UTC → 15:10 UTC (47 minutes)
- Users affected: ~8,400 checkout attempts (100% failure rate during window)
- Revenue impact: Estimated $42,000 in lost transactions
- SLO: 68 minutes remaining in 30-day error budget before SLO breach

## Timeline (UTC)
| Time | Event |
|------|-------|
| 14:18 | Database migration deployed to production |
| 14:23 | Checkout error rate spikes to 100% |
| 14:27 | Fast burn alert fires — on-call paged |
| 14:35 | On-call investigates, identifies DB connection pool exhausted |
| 14:51 | Root cause identified: missing index on new column causing table scan |
| 15:08 | Index added, performance restored |
| 15:10 | Error rate returns to baseline |

## Root Cause
Database migration added a `status_updated_at` column and the application immediately started filtering on it. Without an index, every checkout request triggered a full table scan on the 18M-row orders table, saturating the DB connection pool.

## Contributing Factors
1. Migration ran in production without load testing the new query pattern
2. No canary rollout — migration applied to 100% of traffic immediately
3. Alerting on `error_rate > fast_burn_threshold` caught it in 4 minutes, but the fix took 43 more minutes — the table scan wasn't immediately obvious from the connection pool error

## Action Items
| Action | Owner | Due |
|--------|-------|-----|
| Add pre-migration query plan check to CI pipeline | Platform | 2026-10-09 |
| Implement canary database migrations (5% → 100%) | Platform | 2026-10-16 |
| Add slow query logging alert for queries > 500ms | On-call | 2026-10-02 |
| Update runbook with "connection pool exhausted" diagnostic steps | Payments | 2026-10-02 |

## What Went Well
- Burn rate alerting correctly paged within 4 minutes of onset
- On-call engineer correctly triaged the database layer first
- Rollback procedure was clear (the fix was additive — add index — not a rollback)

## Lessons Learned
Schema changes that add filter columns require indexes deployed before application code that uses them (or deploy index first, ship code second).

For the distributed tracing that provides request-level context during SLO investigations, see the observability guide. For the incident response runbooks and chaos engineering that validates reliability before incidents, see the incident response guide. The Claude Skills 360 bundle includes SRE skill sets covering SLO definition, Prometheus rules, and postmortem processes. Start with the free tier to try reliability engineering templates.

Keep Reading

AI

Claude Code for email.contentmanager: Python Email Content Accessors

Read and write EmailMessage body content with Python's email.contentmanager module and Claude Code — email contentmanager ContentManager for the class that maps content types to get and set handler functions allowing EmailMessage to support get_content and set_content with type-specific behaviour, email contentmanager raw_data_manager for the ContentManager instance that handles raw bytes and str payloads without any conversion, email contentmanager content_manager for the standard ContentManager instance used by email.policy.default that intelligently handles text plain text html multipart and binary content types, email contentmanager get_content_text for the handler that returns the decoded text payload of a text-star message part as a str, email contentmanager get_content_binary for the handler that returns the raw decoded bytes payload of a non-text message part, email contentmanager get_data_manager for the get-handler lookup used by EmailMessage get_content to find the right reader function for the content type, email contentmanager set_content text for the handler that creates and sets a text part correctly choosing charset and transfer encoding, email contentmanager set_content bytes for the handler that creates and sets a binary part with base64 encoding and optional filename Content-Disposition, email contentmanager EmailMessage get_content for the method that reads the message body using the registered content manager handlers, email contentmanager EmailMessage set_content for the method that sets the message body and MIME headers in one call, email contentmanager EmailMessage make_alternative make_mixed make_related for the methods that convert a simple message into a multipart container, email contentmanager EmailMessage add_attachment for the method that attaches a file or bytes to a multipart message, and email contentmanager integration with email.message and email.policy and email.mime and io for building high-level email readers attachment extractors text body accessors HTML readers and policy-aware MIME construction pipelines.

5 min read Feb 12, 2029
AI

Claude Code for email.charset: Python Email Charset Encoding

Control header and body encoding for international email with Python's email.charset module and Claude Code — email charset Charset for the class that wraps a character set name with the encoding rules for header encoding and body encoding describing how to encode text for that charset in email messages, email charset Charset header_encoding for the attribute specifying whether headers using this charset should use QP quoted-printable encoding BASE64 encoding or no encoding, email charset Charset body_encoding for the attribute specifying the Content-Transfer-Encoding to use for message bodies in this charset such as QP or BASE64, email charset Charset output_codec for the attribute giving the Python codec name used to encode the string to bytes for the wire format, email charset Charset input_codec for the attribute giving the Python codec name used to decode incoming bytes to str, email charset Charset get_output_charset for returning the output charset name, email charset Charset header_encode for encoding a header string using the charset's header_encoding method, email charset Charset body_encode for encoding body content using the charset's body_encoding, email charset Charset convert for converting a string from the input_codec to the output_codec, email charset add_charset for registering a new charset with custom encoding rules in the global charset registry, email charset add_alias for adding an alias name that maps to an existing registered charset, email charset add_codec for registering a codec name mapping for use by the charset machinery, and email charset integration with email.message and email.mime and email.policy and email.encoders for building international email senders non-ASCII header encoders Content-Transfer-Encoding selectors charset-aware message constructors and MIME encoding pipelines.

5 min read Feb 11, 2029
AI

Claude Code for email.utils: Python Email Address and Header Utilities

Parse and format RFC 2822 email addresses and dates with Python's email.utils module and Claude Code — email utils parseaddr for splitting a display-name plus angle-bracket address string into a realname and email address tuple, email utils formataddr for combining a realname and address string into a properly quoted RFC 2822 address with angle brackets, email utils getaddresses for parsing a list of raw address header strings each potentially containing multiple comma-separated addresses into a list of realname address tuples, email utils parsedate for parsing an RFC 2822 date string into a nine-tuple compatible with time.mktime, email utils parsedate_tz for parsing an RFC 2822 date string into a ten-tuple that includes the UTC offset timezone in seconds, email utils parsedate_to_datetime for parsing an RFC 2822 date string into an aware datetime object with timezone, email utils formatdate for formatting a POSIX timestamp or the current time as an RFC 2822 date string with optional usegmt and localtime flags, email utils format_datetime for formatting a datetime object as an RFC 2822 date string, email utils make_msgid for generating a globally unique Message-ID string with optional idstring and domain components, email utils decode_rfc2231 for decoding an RFC 2231 encoded parameter value into a tuple of charset language and value, email utils encode_rfc2231 for encoding a string as an RFC 2231 encoded parameter value, email utils collapse_rfc2231_value for collapsing a decoded RFC 2231 tuple to a Unicode string, and email utils integration with email.message and email.headerregistry and datetime and time for building address parsers date formatters message-id generators header extractors and RFC-compliant email construction utilities.

5 min read Feb 10, 2029

Put these ideas into practice

Claude Skills 360 gives you production-ready skills for everything in this article — and 2,350+ more. Start free or go all-in.

Back to Blog

Get 360 skills free