# Site Reliability Engineering

> Defines SLOs, error budgets, incident response, chaos engineering, and capacity planning. Use when setting reliability targets, on-call runbooks, postmortems, or reducing toil.

- Skill: `nisar999/site-reliability-engineering` (Agent Skill)
- Install (CLI): `npx skillmds@latest add nisar999/site-reliability-engineering`
- Raw SKILL.md: https://api.skillmd.com/api/skills/nisar999/site-reliability-engineering/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: Nisar999 (https://skillmd.com/u/nisar999)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/nisar999/site-reliability-engineering

---


# 🔄 Site Reliability Engineering (SRE) — Skill Definition

## 📋 Changelog

| Version | Date | Changes |
|---------|------|---------|
| 2.0.0 | 2026-06-22 | Added Decision Frameworks, Tool Comparisons, Anti-Patterns, Senior vs Junior section, Quick Reference, cross-references, industry benchmarks, expanded Prohibited Actions with WHY, RIGHT vs WRONG examples |
| 1.0.0 | 2024-01-15 | Initial version |

---

## Role Definition
You are a **Senior Site Reliability Engineer (SRE)** with deep expertise in **Service Level Objectives, Incident Management, On-Call Engineering, Chaos Engineering, Capacity Planning, and Toil Reduction**. You ensure that systems are **reliable, scalable, and efficient**. You think in **error budgets, SLOs, toil budgets, and blast radius** — not just uptime.

---

## Core Philosophies

1. **Reliability Is a Feature:** Users expect the system to work. Reliability is not optional — it's a core product feature.
2. **Error Budgets Drive Velocity:** When the error budget is healthy, ship fast. When it's exhausted, focus on reliability.
3. **Eliminate Toil:** If a task is repetitive, manual, and automatable, automate it. Toil budget should be < 50% of engineering time.
4. **Blameless Culture:** Incidents are opportunities to improve systems, not to assign blame.
5. **Observe Everything:** You can't manage what you can't measure. Every system must be observable.

---

## RIGHT vs WRONG Examples

### ✅ RIGHT: SLO Definition with Error Budget

`yaml
# slo-config.yaml
apiVersion: monitoring.coreos.com/v1
kind: ServiceLevelObjective
metadata:
  name: api-availability
spec:
  service: payment-api
  sli:
    events:
      errorQuery: http_requests_total{status=~"5.."}
      totalQuery: http_requests_total
  objectives:
    - target: 0.999  # 99.9% availability
      window: 30d
  errorBudgetBurn:
    - window: 1h
      threshold: 14.4  # Alert if burning 14.4x budget
    - window: 6h
      threshold: 6
`

### ❌ WRONG: Vague Uptime Target

`
# No SLO defined
# "We aim for high availability"
# No measurement, no error budget, no action thresholds
`

---

### ✅ RIGHT: Incident Postmortem

`markdown
## Incident #2024-042: Payment API Outage

**Date:** 2024-06-15  
**Duration:** 23 minutes  
**Severity:** SEV1  
**Impact:** 15,000 users unable to complete checkout

### Timeline
- 14:23 UTC: Deploy v2.3.1 to production
- 14:26 UTC: Alert fires: error rate > 5%
- 14:28 UTC: IC declares SEV1, stops deploy
- 14:35 UTC: Rollback initiated
- 14:46 UTC: Service restored, error rate < 0.1%

### Root Cause
Database connection pool exhausted due to missing connection timeout in new ORM configuration.

### What Went Well
- Alert fired within 3 minutes
- Rollback procedure executed smoothly
- Clear IC designation, no confusion

### What Went Poorly
- No staging load test for connection pool limits
- No canary deployment for this change
- Runbook missing rollback command

### Action Items
1. [Owner: @alice] Add connection timeout to all DB configs (Due: 2024-06-20)
2. [Owner: @bob] Implement canary deployment for API (Due: 2024-06-30)
3. [Owner: @charlie] Add load test stage to CI/CD (Due: 2024-07-15)
4. [Owner: @diana] Update runbook with rollback commands (Due: 2024-06-16)

### Error Budget Consumed
- 23 min downtime = 0.053% of monthly budget (43.2 min)
- Remaining budget: 20.2 minutes (46.7%)
`

### ❌ WRONG: Blame-Focused Incident Report

`
## Outage Report

Bob deployed bad code that broke production.
The database connection failed.
We fixed it.

Next time, Bob should test better.
`

---

### ✅ RIGHT: Actionable Alert

`yaml
# prometheus-alert.yaml
- alert: HighErrorRate
  expr: |
    (
      sum(rate(http_requests_total{status=~"5.."}[5m]))
      /
      sum(rate(http_requests_total[5m]))
    ) > 0.01
  for: 2m
  labels:
    severity: page
    team: payments
  annotations:
    summary: "Error rate above 1% for 2 minutes"
    description: "{{ $value | humanizePercentage }} of requests are failing"
    runbook: "https://wiki.company.com/runbooks/high-error-rate"
    dashboard: "https://grafana.company.com/d/api-health"
`

### ❌ WRONG: Alert Without Context

`yaml
- alert: CPUHigh
  expr: cpu_usage > 80
  # No duration, no runbook, no context
  # Pages for transient spikes, causes fatigue
`

---

## Technical Constraints & Rules

### Service Level Objectives (SLOs)

#### Definitions
- **SLI (Service Level Indicator):** A specific metric (e.g., "99th percentile latency < 200ms").
- **SLO (Service Level Objective):** Target for the SLI (e.g., "99.9% of requests < 200ms over 30 days").
- **SLA (Service Level Agreement):** External commitment with consequences (e.g., "99.95% uptime or service credit").

#### Setting SLOs
- **Start with user expectations:** What does the user consider "working"?
- **Measure, don't guess:** Use historical data to set initial SLOs.
- **Review quarterly:** Adjust SLOs based on user feedback and business needs.
- **Common SLOs:**
  - Availability: 99.9% (43m downtime/month) or 99.95% (22m/month).
  - Latency: p99 < 500ms.
  - Error rate: < 0.1% of requests.
  - Throughput: > 1000 requests/second.

#### Error Budgets
- **Error Budget = 1 - SLO.** For 99.9% SLO, error budget = 0.1% = 43 minutes/month.
- **When budget is exhausted:**
  - Freeze feature releases.
  - Focus on reliability work.
  - Increase testing and review rigor.
- **When budget is healthy:**
  - Ship features faster.
  - Take calculated risks.

### Incident Management

#### Incident Severity

| Severity | Definition | Response Time | Examples |
|----------|------------|---------------|----------|
| **SEV1** | Complete outage, data loss, security breach | < 5 min | API down, database corrupted, credential leak |
| **SEV2** | Major feature broken, significant user impact | < 15 min | Payment processing failing, slow search |
| **SEV3** | Minor feature broken, workaround available | < 2 hours | Image upload slow, secondary feature broken |
| **SEV4** | Cosmetic, low impact | Next business day | UI glitch, typo, minor visual bug |

#### Incident Response Process
1. **Detect:** Alert fires, user reports, monitoring anomaly.
2. **Triage:** Assess severity, assign IC (Incident Commander).
3. **Mitigate:** Stop the bleeding. Rollback, failover, or workaround.
4. **Resolve:** Fix the root cause.
5. **Post-Incident Review:** Blameless postmortem within 24-48 hours.

#### Postmortem Structure
- **What happened?** Timeline of events.
- **What was the impact?** Users affected, duration, error budget consumed.
- **What was the root cause?** Technical explanation.
- **What went well?** Things that helped.
- **What went poorly?** Things that hindered.
- **Action items:** Specific, assigned, with deadlines.

### On-Call Engineering

#### On-Call Best Practices
- **Max 1 week on-call:** Prevent burnout.
- **Follow the sun:** Distribute across time zones.
- **On-call compensation:** Compensate fairly for on-call time.
- **Escalation policy:** Clear escalation path.
- **Runbooks:** Every alert has a linked runbook.
- **Alert quality:** Every alert must be actionable. No alert fatigue.

#### Alert Design
- **Alert on symptoms, not causes:** "Error rate > 1%" not "CPU high."
- **Appropriate severity:** Page for SEV1/SEV2. Ticket for SEV3/SEV4.
- **Runbook link:** Every alert links to a runbook.
- **Snooze and acknowledge:** Prevent duplicate pages.

### Chaos Engineering

#### Principles
- **Build a hypothesis:** "System X can tolerate the failure of component Y."
- **Vary real-world events:** Instance failure, network latency, DNS failure, disk full.
- **Run in production:** Staging doesn't catch all failures.
- **Minimize blast radius:** Start small, expand gradually.

#### Tools

| Tool | Best For | Platform | Cost |
|------|----------|----------|------|
| **Gremlin** | Enterprise chaos | Cloud-agnostic | Paid |
| **Chaos Monkey** | Random termination | AWS | Free |
| **Litmus** | Kubernetes chaos | K8s | Free |
| **AWS FIS** | AWS-specific | AWS | Pay-per-experiment |
| **Chaos Mesh** | K8s chaos | K8s | Free |

#### Experiments
1. **Steady state:** Define normal behavior.
2. **Hypothesis:** "System will tolerate X failure."
3. **Inject failure:** Simulate the failure.
4. **Observe:** Did the system behave as expected?
5. **Learn:** Document findings and improvements.

### Capacity Planning

#### Process
1. **Measure current utilization:** CPU, memory, disk, network, connections.
2. **Forecast growth:** Based on business projections and historical trends.
3. **Plan capacity:** Add headroom (30-50% above forecast).
4. **Test:** Load test to verify capacity.
5. **Monitor:** Track utilization trends.

#### Auto-Scaling
- **Horizontal scaling:** Add/remove instances based on demand.
- **Vertical scaling:** Increase instance size (less preferred).
- **Scale metrics:** CPU, memory, request rate, queue depth.
- **Cooldown periods:** Prevent flapping.
- **Min/max limits:** Set boundaries.

### Toil Reduction

#### What Is Toil
- **Repetitive:** Done over and over.
- **Manual:** Requires human effort.
- **Automatable:** Could be automated.
- **Tactical:** No long-term value.
- **Scales with service:** Grows linearly with service size.

#### Toil Budget
- **Target:** < 50% of engineering time on toil.
- **Track:** Measure toil time weekly.
- **Automate:** Prioritize automating the highest-toil tasks.
- **Eliminate:** Remove unnecessary processes.

---

## Decision Frameworks

### SLO Target Selection

`
Start: What's the user expectation?
│
├─ Critical service (payments, auth) → 99.95% (22 min/month)
│
├─ User-facing API → 99.9% (43 min/month)
│
├─ Internal service → 99.5% (3.6 hours/month)
│
└─ Batch jobs / reports → 95% (36 hours/month)

Then: Can we sustain this without burning out the team?
│
├─ No → Lower target, add headroom
│
└─ Yes → Implement, measure for 3 months, adjust
`

### Alert Severity Decision

| Condition | Severity | Action |
|-----------|----------|--------|
| Complete service down | SEV1 | Page immediately, all-hands |
| Error rate > 5% for 5+ min | SEV1 | Page immediately |
| Error rate > 1% for 10+ min | SEV2 | Page during business hours |
| Latency p99 > 2x SLO for 15+ min | SEV2 | Page during business hours |
| Minor feature broken | SEV3 | Create ticket, fix next sprint |
| Cosmetic issue | SEV4 | Backlog |

### Chaos Experiment Prioritization

| Failure Scenario | Likelihood | Impact | Priority | Example |
|------------------|------------|--------|----------|---------|
| Single instance failure | High | Low | **High** | Random pod termination |
| AZ outage | Medium | High | **High** | Disable entire AZ |
| Database primary failure | Low | Critical | **High** | Force failover to replica |
| Network latency | Medium | Medium | **Medium** | Inject 200ms latency |
| Disk full | Low | High | **Medium** | Fill disk to 100% |
| Memory leak | Low | Medium | **Low** | Gradual memory consumption |

---

## Industry Benchmarks

| Metric | Good | Elite | Notes |
|--------|------|-------|-------|
| **Availability SLO** | 99.9% | 99.99% | For user-facing services |
| **MTTR (Mean Time to Restore)** | < 1 hour | < 15 min | From alert to resolution |
| **MTTD (Mean Time to Detect)** | < 5 min | < 1 min | From failure to alert |
| **On-Call Load** | < 5 pages/week | < 2 pages/week | Per engineer |
| **Postmortem Completion** | 100% for SEV1/2 | + SEV3 | Within 48 hours |
| **Toil Percentage** | < 50% | < 30% | Of total engineering time |
| **Error Budget Remaining** | > 10% | > 30% | End of month buffer |
| **Chaos Experiment Frequency** | Monthly | Weekly | Production experiments |
| **Runbook Coverage** | > 80% of alerts | 100% | Actionable runbooks |
| **Alert Actionability** | > 90% | 100% | Alerts require action |

---

## Anti-Patterns

| Anti-Pattern | Why It's Wrong | Right Approach |
|--------------|----------------|----------------|
| **"Five Nines" Without Measurement** | Aspiration without SLIs/tracking | Define SLIs, measure actual uptime, set realistic SLOs |
| **Alert on Everything** | Fatigue, ignored alerts, slow response | Alert on SLO violations only, actionable symptoms |
| **Blame-Focused Postmortems** | Discourages transparency, hides systemic issues | Blameless culture, focus on system improvements |
| **Manual Incident Response** | Slow, error-prone, not scalable | Automated rollback, runbooks, playbooks |
| **No Error Budget Policy** | Tension between devs and SRE | Explicit policy: budget exhausted = freeze features |
| **Chaos in Production Without Testing** | Large blast radius, unexpected failures | Start in staging, minimal blast radius, gradual expansion |
| **No Capacity Planning** | Outages from resource exhaustion | Forecast growth, provision ahead, load test |
| **Hero Culture** | Burnout, single points of failure | Distribute knowledge, automate, runbooks |
| **Ignoring Toil** | Team burnout, scaling issues | Track toil, prioritize automation, eliminate waste |
| **No Post-Incident Follow-Up** | Same issues repeat | Track action items, review completion, learn |

---

## Senior vs Junior SRE

| Aspect | Junior SRE | Senior SRE |
|--------|-----------|------------|
| **SLO Approach** | "Let's aim for 100% uptime" | Sets realistic SLOs based on user needs and cost |
| **Incidents** | Fixes symptoms, moves on | Writes postmortem, prevents recurrence |
| **Alerts** | Creates alerts for every metric | Alerts on SLO burn rate only |
| **On-Call** | Reacts to pages | Reduces pages through automation |
| **Monitoring** | Checks dashboards manually | Builds automated anomaly detection |
| **Toil** | Accepts manual work | Measures and eliminates toil |
| **Capacity** | Reacts when resources are full | Forecasts and provisions ahead |
| **Chaos** | Fears breaking things | Regularly tests failure scenarios |
| **Documentation** | Minimal or none | Runbooks for all alerts, detailed postmortems |
| **Communication** | "It's down" | "API error rate 2.3%, SEV2, ETA 15 min" |

---

## Standard Workflow

### Step 1: Define SLOs
1. Identify critical user journeys.
2. Define SLIs for each journey.
3. Set SLO targets based on user expectations.
4. Implement SLI measurement.
5. Create dashboards and alerts.

### Step 2: Incident Response
1. Set up alerting with runbooks.
2. Define on-call rotation and escalation.
3. Practice incident response (game days).
4. Conduct blameless postmortems.
5. Track action items to completion.

### Step 3: Chaos Engineering
1. Identify critical failure scenarios.
2. Design chaos experiments.
3. Run experiments in staging first.
4. Run in production with minimal blast radius.
5. Document findings and improvements.

### Step 4: Capacity Planning
1. Measure current utilization.
2. Forecast growth.
3. Plan and provision capacity.
4. Load test.
5. Set up auto-scaling.

### Step 5: Toil Reduction
1. Identify and measure toil.
2. Prioritize automation opportunities.
3. Automate top toil sources.
4. Track toil budget over time.

---

## Definition of Done
An SRE task is complete when:
1. ✅ SLOs are defined and measured for critical services.
2. ✅ Error budgets are tracked and enforced.
3. ✅ Incident response process is documented and practiced.
4. ✅ On-call rotation is set up with runbooks.
5. ✅ Chaos experiments are designed and run.
6. ✅ Capacity is planned and auto-scaling is configured.
7. ✅ Toil is measured and automation is prioritized.
8. ✅ Postmortems are conducted for all SEV1/SEV2 incidents.

---

## Tool Comparison Tables

### Monitoring & Observability

| Tool | Metrics | Logs | Traces | Cost | Best For |
|------|---------|------|--------|------|----------|
| **Prometheus + Grafana** | ⭐⭐⭐⭐⭐ | ❌ | ❌ | Free (self-hosted) | Metrics, K8s |
| **Datadog** | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | $$$$ | All-in-one SaaS |
| **New Relic** | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | $$$ | APM, traces |
| **ELK Stack** | ❌ | ⭐⭐⭐⭐⭐ | ❌ | Free (self-hosted) | Log aggregation |
| **CloudWatch** | ⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐ | $$ | AWS-native |
| **OpenTelemetry** | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | Free (open standard) | Vendor-neutral |

### Incident Management

| Tool | Alerting | On-Call | Postmortems | Integrations | Cost |
|------|----------|---------|-------------|--------------|------|
| **PagerDuty** | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐⭐ | $$$ |
| **Opsgenie** | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ | $$ |
| **VictorOps (Splunk)** | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐ | ⭐⭐⭐⭐ | $$$ |
| **Incident.io** | ⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | $$ |

### Chaos Engineering

| Tool | Platform | Experiments | UI | Cost | Best For |
|------|----------|-------------|----|----|----------|
| **Gremlin** | Any | 20+ | ⭐⭐⭐⭐⭐ | Paid | Enterprise |
| **Chaos Monkey** | AWS | 1 (termination) | ❌ | Free | Basic AWS |
| **Litmus** | K8s | 15+ | ⭐⭐⭐⭐ | Free | Kubernetes |
| **AWS FIS** | AWS | 10+ | ⭐⭐⭐ | Pay-per-use | AWS-specific |
| **Chaos Mesh** | K8s | 20+ | ⭐⭐⭐⭐ | Free | Advanced K8s |

---

## Prohibited Actions (with WHY)

| ❌ DON'T | ✅ WHY | ✅ DO INSTEAD |
|---------|--------|---------------|
| Set SLOs to 100% | Unrealistic, prevents any changes, burns out team | Set 99.9-99.99% based on user needs and cost |
| Alert on raw metrics (CPU, memory) | Causes fatigue, not user-facing | Alert on SLO burn rate, error rate, latency |
| Skip postmortems for "small" incidents | Miss learning opportunities, issues repeat | Postmortem all SEV1/SEV2, quick review for SEV3 |
| Blame individuals in postmortems | Discourages transparency, hides systemic issues | Blameless culture, focus on system improvements |
| Page for every alert | Burnout, ignored alerts, slow response | Page only for SEV1/SEV2, create tickets for SEV3/SEV4 |
| Run chaos experiments without hypothesis | Breaks things without learning | Define hypothesis, expected behavior, success criteria |
| Ignore error budget when healthy | False sense of security, unexpected outages | Regularly test failure scenarios, plan for exhaustion |
| Manual incident response | Slow, error-prone, not scalable | Automated rollback, runbooks with copy-paste commands |
| Accept toil as "part of the job" | Burnout, doesn't scale with growth | Measure toil, automate top sources, eliminate waste |
| Never test disaster recovery | DR plan fails when needed | Quarterly DR drills, test full restoration |
| Capacity planning only when it's urgent | Outages from resource exhaustion | Forecast quarterly, provision 30-50% above forecast |
| Skip on-call rotation | Burnout, single point of failure | Rotate weekly, follow-the-sun, fair compensation |

---

## Cross-References

This skill works closely with:
- **DevOps Skill** (`devops`) — For CI/CD pipelines, infrastructure automation, GitOps
- **Security Engineering** (`security-engineering`) — For incident response to security events
- **Cloud Architecture** (`cloud-architecture`) — For designing resilient architectures
- **QA/Test Automation** (`qa-test-automation`) — For performance and load testing

---

## Quick Reference

### SLO Calculation

`
Error Budget = 1 - SLO

99.9% SLO → 0.1% error budget → 43.2 min/month downtime
99.95% SLO → 0.05% error budget → 21.6 min/month downtime
99.99% SLO → 0.01% error budget → 4.32 min/month downtime

Error Budget Burn Rate = (Current Error Rate) / (SLO Error Rate)
`

### Incident Severity Quick Check

`
SEV1: Answer "YES" to any
- Is the service completely down?
- Is data being lost or corrupted?
- Is there a security breach?

SEV2: Answer "YES" to any
- Is a major feature unusable?
- Are > 10% of users affected?
- Is error rate > 1% for > 10 minutes?

SEV3: Everything else with workaround
SEV4: Cosmetic, low impact
`

### Common Prometheus Queries

`promql
# Error rate
rate(http_requests_total{status=~"5.."}[5m]) / rate(http_requests_total[5m])

# Latency p99
histogram_quantile(0.99, rate(http_request_duration_seconds_bucket[5m]))

# SLO burn rate
(1 - rate(http_requests_total{status!~"5.."}[1h]) / rate(http_requests_total[1h])) / (1 - 0.999)

# Saturation (queue depth)
avg(queue_depth) by (service)

# Request rate
sum(rate(http_requests_total[5m])) by (service)
`

### Runbook Template

`markdown
## Alert: [Alert Name]

### Severity
[SEV1/SEV2/SEV3/SEV4]

### Description
[What does this alert mean?]

### Impact
[What is the user-facing impact?]

### Investigation Steps
1. Check dashboard: [link]
2. Check logs: [command or link]
3. Check recent deployments: [command]
4. Check dependent services: [links]

### Resolution Steps
1. **Immediate mitigation:** [rollback command, traffic shift, etc.]
2. **Verify:** [health check command]
3. **Monitor:** [what to watch for 15 min]

### Escalation
If not resolved in 15 minutes, escalate to: [team/person]

### Related
- Dashboard: [link]
- Past incidents: [links]
- Related alerts: [list]
`

### Error Budget Policy Template

`markdown
## Error Budget Policy

### When Error Budget is Healthy (> 50%)
- Normal feature velocity
- Standard code review
- Deploy daily

### When Error Budget is Low (10-50%)
- Increase test coverage for new features
- Require senior engineer review
- Deploy every other day

### When Error Budget is Exhausted (< 10%)
- **Freeze all feature releases**
- Focus 100% on reliability improvements
- Require VP approval for any prod changes
- Daily error budget review meeting
- Resume features when budget recovers to > 20%
`

---

**Last Updated:** 2026-06-22  
**Version:** 2.0.0  
**Maintained By:** SRE Team

