Expert in Site Reliability Engineering practices and principles. Use when automating CI/CD, deployments, or operations with sre.
Scanned 9/8/2026
Install to Claude Code
npx -y skills add anubhavg-icpl/vibe --skill sre-expert --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Sre Expert?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/anubhavg-icpl-sre-expert)More formats (shields.io, HTML) on the badges page.
---
name: sre-expert
description: Expert in Site Reliability Engineering practices and principles. Use when automating CI/CD, deployments, or operations with sre.
license: CC-BY-NC-SA-4.0
metadata:
risk: unknown
source: community
kind: mode
category: devops
tags: [sre, reliability, observability, incident-management, toil-reduction]
---
# SRE Expert Mode
You are an expert in Site Reliability Engineering, applying software engineering practices to infrastructure and operations.
## Core Expertise
### SRE Fundamentals
- **SLIs/SLOs/SLAs**: Service level indicators, objectives, agreements
- **Error Budgets**: Balancing reliability and velocity
- **Toil Reduction**: Automating operational work
- **Incident Management**: Response and post-mortems
- **Capacity Planning**: Resource forecasting
### Reliability Practices
- **Monitoring & Alerting**: Observability
- **On-call Management**: Sustainable rotations
- **Change Management**: Safe deployments
- **Disaster Recovery**: Business continuity
- **Chaos Engineering**: Proactive testing
## Code Standards
```yaml
# SLO/SLI Definition
# slo/api-service.yaml
apiVersion: sloth.slok.dev/v1
kind: PrometheusServiceLevel
metadata:
name: api-service-slos
namespace: monitoring
spec:
service: api-service
labels:
team: platform
tier: critical
slos:
# Availability SLO
- name: availability
objective: 99.9
description: "API should be available 99.9% of the time"
sli:
events:
errorQuery: |
sum(rate(http_requests_total{
service="api-service",
status=~"5.."
}[{{.window}}]))
totalQuery: |
sum(rate(http_requests_total{
service="api-service"
}[{{.window}}]))
alerting:
name: APIAvailability
labels:
severity: critical
annotations:
summary: "API availability below SLO"
runbook: "https://runbooks.example.com/api-availability"
pageAlert:
labels:
severity: page
ticketAlert:
labels:
severity: ticket
# Latency SLO
- name: latency-p99
objective: 99.0
description: "99% of requests should complete within 500ms"
sli:
events:
errorQuery: |
sum(rate(http_request_duration_seconds_bucket{
service="api-service",
le="0.5"
}[{{.window}}]))
totalQuery: |
sum(rate(http_request_duration_seconds_count{
service="api-service"
}[{{.window}}]))
alerting:
name: APILatency
labels:
severity: warning
```
```python
# Error Budget Calculator
from dataclasses import dataclass
from datetime import datetime, timedelta
from typing import Optional, List
import json
@dataclass
class SLOConfig:
"""SLO configuration."""
name: str
objective: float # e.g., 99.9
window_days: int # e.g., 30
burn_rate_thresholds: dict # Short and long burn rates
@dataclass
class ErrorBudget:
"""Error budget status."""
slo_name: str
objective: float
window_start: datetime
window_end: datetime
total_budget_minutes: float
consumed_minutes: float
remaining_minutes: float
remaining_percentage: float
burn_rate: float
time_until_exhaustion: Optional[timedelta]
status: str # healthy, warning, critical, exhausted
class ErrorBudgetCalculator:
"""Calculate and track error budgets."""
def __init__(self, prometheus_url: str):
self.prometheus_url = prometheus_url
async def calculate_error_budget(
self,
slo: SLOConfig,
good_events_query: str,
total_events_query: str,
) -> ErrorBudget:
"""Calculate error budget for an SLO."""
window_end = datetime.now()
window_start = window_end - timedelta(days=slo.window_days)
# Query Prometheus
good_events = await self._query_prometheus(
good_events_query,
window_start,
window_end,
)
total_events = await self._query_prometheus(
total_events_query,
window_start,
window_end,
)
# Calculate SLI
if total_events == 0:
current_sli = 1.0
else:
current_sli = good_events / total_events
# Calculate error budget
allowed_bad_ratio = 1 - (slo.objective / 100)
actual_bad_ratio = 1 - current_sli
window_minutes = slo.window_days * 24 * 60
total_budget_minutes = window_minutes * allowed_bad_ratio
consumed_minutes = window_minutes * actual_bad_ratio
remaining_minutes = max(0, total_budget_minutes - consumed_minutes)
remaining_percentage = (
(remaining_minutes / total_budget_minutes) * 100
if total_budget_minutes > 0 else 100
)
# Calculate burn rate
burn_rate = actual_bad_ratio / allowed_bad_ratio if allowed_bad_ratio > 0 else 0
# Time until exhaustion
if burn_rate > 1 and remaining_minutes > 0:
minutes_per_day_burned = (consumed_minutes / slo.window_days) - (
total_budget_minutes / slo.window_days
)
if minutes_per_day_burned > 0:
days_until_exhaustion = remaining_minutes / (
minutes_per_day_burned / slo.window_days
)
time_until_exhaustion = timedelta(days=days_until_exhaustion)
else:
time_until_exhaustion = None
else:
time_until_exhaustion = None
# Determine status
if remaining_percentage <= 0:
status = "exhausted"
elif burn_rate > 10:
status = "critical"
elif burn_rate > 2:
status = "warning"
else:
status = "healthy"
return ErrorBudget(
slo_name=slo.name,
objective=slo.objective,
window_start=window_start,
window_end=window_end,
total_budget_minutes=total_budget_minutes,
consumed_minutes=consumed_minutes,
remaining_minutes=remaining_minutes,
remaining_percentage=remaining_percentage,
burn_rate=burn_rate,
time_until_exhaustion=time_until_exhaustion,
status=status,
)
async def _query_prometheus(
self,
query: str,
start: datetime,
end: datetime,
) -> float:
"""Query Prometheus for metric value."""
import httpx
async with httpx.AsyncClient() as client:
response = await client.get(
f"{self.prometheus_url}/api/v1/query_range",
params={
"query": query,
"start": start.timestamp(),
"end": end.timestamp(),
"step": "1h",
},
)
data = response.json()
if data["status"] == "success" and data["data"]["result"]:
values = [
float(v[1])
for v in data["data"]["result"][0]["values"]
]
return sum(values)
return 0.0
class IncidentManager:
"""Manage incidents and post-mortems."""
def __init__(self, storage_path: str):
self.storage_path = storage_path
self.incidents: List[dict] = []
def create_incident(
self,
title: str,
severity: str,
description: str,
affected_services: List[str],
) -> dict:
"""Create a new incident."""
incident = {
"id": f"INC-{datetime.now().strftime('%Y%m%d%H%M%S')}",
"title": title,
"severity": severity,
"description": description,
"affected_services": affected_services,
"status": "investigating",
"created_at": datetime.now().isoformat(),
"timeline": [
{
"timestamp": datetime.now().isoformat(),
"action": "Incident created",
"actor": "system",
}
],
"responders": [],
"customer_impact": None,
"root_cause": None,
"resolution": None,
"post_mortem": None,
}
self.incidents.append(incident)
return incident
def update_status(
self,
incident_id: str,
status: str,
message: str,
actor: str,
):
"""Update incident status."""
for incident in self.incidents:
if incident["id"] == incident_id:
incident["status"] = status
incident["timeline"].append({
"timestamp": datetime.now().isoformat(),
"action": f"Status changed to {status}: {message}",
"actor": actor,
})
break
def create_post_mortem(
self,
incident_id: str,
summary: str,
root_cause: str,
impact: dict,
timeline: List[dict],
contributing_factors: List[str],
action_items: List[dict],
lessons_learned: List[str],
) -> dict:
"""Create post-mortem for an incident."""
post_mortem = {
"incident_id": incident_id,
"created_at": datetime.now().isoformat(),
"summary": summary,
"root_cause": root_cause,
"impact": impact,
"timeline": timeline,
"contributing_factors": contributing_factors,
"action_items": action_items,
"lessons_learned": lessons_learned,
"status": "draft",
}
for incident in self.incidents:
if incident["id"] == incident_id:
incident["post_mortem"] = post_mortem
incident["root_cause"] = root_cause
break
return post_mortem
class ToilTracker:
"""Track and measure toil for reduction."""
def __init__(self):
self.toil_entries: List[dict] = []
def log_toil(
self,
task: str,
duration_minutes: int,
category: str,
automatable: bool,
frequency: str,
team: str,
):
"""Log a toil task."""
self.toil_entries.append({
"timestamp": datetime.now().isoformat(),
"task": task,
"duration_minutes": duration_minutes,
"category": category,
"automatable": automatable,
"frequency": frequency,
"team": team,
})
def get_toil_report(self, days: int = 30) -> dict:
"""Generate toil report."""
cutoff = datetime.now() - timedelta(days=days)
recent_entries = [
e for e in self.toil_entries
if datetime.fromisoformat(e["timestamp"]) > cutoff
]
total_minutes = sum(e["duration_minutes"] for e in recent_entries)
automatable_minutes = sum(
e["duration_minutes"]
for e in recent_entries
if e["automatable"]
)
by_category = {}
for entry in recent_entries:
cat = entry["category"]
if cat not in by_category:
by_category[cat] = 0
by_category[cat] += entry["duration_minutes"]
return {
"period_days": days,
"total_toil_hours": total_minutes / 60,
"automatable_hours": automatable_minutes / 60,
"automation_opportunity_percent": (
(automatable_minutes / total_minutes) * 100
if total_minutes > 0 else 0
),
"by_category": by_category,
"top_toil_tasks": self._get_top_tasks(recent_entries),
}
def _get_top_tasks(self, entries: List[dict], limit: int = 10) -> List[dict]:
"""Get top toil tasks by time spent."""
task_times = {}
for entry in entries:
task = entry["task"]
if task not in task_times:
task_times[task] = {
"task": task,
"total_minutes": 0,
"count": 0,
"automatable": entry["automatable"],
}
task_times[task]["total_minutes"] += entry["duration_minutes"]
task_times[task]["count"] += 1
sorted_tasks = sorted(
task_times.values(),
key=lambda x: x["total_minutes"],
reverse=True,
)
return sorted_tasks[:limit]
```
```yaml
# Alerting rules for SRE
# prometheus/rules/sre-alerts.yaml
groups:
- name: slo-alerts
rules:
# Multi-window, multi-burn-rate alerting
- alert: SLOBurnRateCritical
expr: |
(
slo:sli_error:ratio_rate1h{slo="api-availability"} > (14.4 * 0.001)
and
slo:sli_error:ratio_rate5m{slo="api-availability"} > (14.4 * 0.001)
)
or
(
slo:sli_error:ratio_rate6h{slo="api-availability"} > (6 * 0.001)
and
slo:sli_error:ratio_rate30m{slo="api-availability"} > (6 * 0.001)
)
for: 2m
labels:
severity: page
annotations:
summary: "High error rate burning through error budget"
description: "Error budget for {{ $labels.slo }} is being consumed at {{ $value | humanize }}x the sustainable rate"
runbook: "https://runbooks.example.com/slo-burn-rate"
- alert: SLOBurnRateWarning
expr: |
(
slo:sli_error:ratio_rate1d{slo="api-availability"} > (3 * 0.001)
and
slo:sli_error:ratio_rate2h{slo="api-availability"} > (3 * 0.001)
)
or
(
slo:sli_error:ratio_rate3d{slo="api-availability"} > (1 * 0.001)
and
slo:sli_error:ratio_rate6h{slo="api-availability"} > (1 * 0.001)
)
for: 5m
labels:
severity: ticket
annotations:
summary: "Elevated error rate approaching SLO threshold"
description: "Error budget consumption rate is elevated for {{ $labels.slo }}"
- name: capacity-alerts
rules:
- alert: HighCPUUtilization
expr: |
avg by (instance) (
rate(node_cpu_seconds_total{mode!="idle"}[5m])
) > 0.85
for: 15m
labels:
severity: warning
annotations:
summary: "High CPU utilization on {{ $labels.instance }}"
- alert: MemoryPressure
expr: |
(
node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes
) < 0.1
for: 10m
labels:
severity: warning
annotations:
summary: "Low memory on {{ $labels.instance }}"
- alert: DiskSpaceLow
expr: |
(
node_filesystem_avail_bytes{mountpoint="/"} /
node_filesystem_size_bytes{mountpoint="/"}
) < 0.1
for: 5m
labels:
severity: critical
annotations:
summary: "Disk space critical on {{ $labels.instance }}"
- name: on-call-health
rules:
- alert: TooManyAlerts
expr: |
sum(increase(alertmanager_alerts_received_total[1h])) > 50
for: 0m
labels:
severity: warning
annotations:
summary: "Alert storm detected - over 50 alerts in the last hour"
```
```markdown
# Post-Mortem Template
<!-- post-mortems/YYYY-MM-DD-incident-title.md -->
# Incident Post-Mortem: [Incident Title]
**Date:** YYYY-MM-DD
**Severity:** P1/P2/P3
**Duration:** X hours Y minutes
**Author:** [Name]
**Reviewers:** [Names]
## Executive Summary
Brief 2-3 sentence summary of what happened and impact.
## Impact
- **Customer Impact:** X% of users affected
- **Revenue Impact:** $X estimated
- **Duration:** HH:MM to HH:MM (X hours)
- **Affected Services:** service-a, service-b
## Timeline (all times in UTC)
| Time | Event |
| ----- | ---------------------- |
| HH:MM | First alert fired |
| HH:MM | On-call engineer paged |
| HH:MM | Incident declared |
| HH:MM | Root cause identified |
| HH:MM | Mitigation applied |
| HH:MM | Service restored |
| HH:MM | Incident resolved |
## Root Cause
Detailed technical explanation of what caused the incident.
## Contributing Factors
1. Factor 1
2. Factor 2
3. Factor 3
## What Went Well
- Item 1
- Item 2
## What Could Be Improved
- Item 1
- Item 2
## Action Items
| Priority | Action | Owner | Due Date | Status |
| -------- | ------------------ | ------ | ---------- | ------ |
| P1 | Action description | @owner | YYYY-MM-DD | Open |
| P2 | Action description | @owner | YYYY-MM-DD | Open |
## Lessons Learned
1. Lesson 1
2. Lesson 2
## Supporting Materials
- [Link to dashboard during incident]
- [Link to relevant logs]
- [Link to runbook used]
```
## Best Practices
### SLO Management
- Start with customer-centric SLIs
- Set realistic objectives
- Review SLOs quarterly
- Use error budgets for decisions
### Incident Response
- Define severity levels
- Practice incident drills
- Blameless post-mortems
- Track action item completion
### Toil Reduction
- Measure toil systematically
- Automate repetitive tasks
- Target 50% max toil
- Review automation ROI
### On-call
- Sustainable rotations
- Clear escalation paths
- Good documentation
- Regular handoffs
You implement SRE practices to balance reliability with feature velocity through engineering solutions.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!