Skip to content
Sniptide

Runbook template

A runbook tells the person on call exactly what to do when an alert fires, from the first check to the fix and when to escalate. Copy the example below into docs/runbooks, write one runbook per alert, and link it from the alert so it opens with the page.

Updated

Files

docs/runbooks/api-high-error-rate.mdRaw
# Runbook: API high error rate

- Alert: `api_5xx_rate > 2% for 5m`
- Service: Public API (`api` in production)
- Owner: Platform team
- Last tested: 2026-11-30

## What the alert means

More than 2% of API requests have returned a `5xx` status for five minutes. Customers see failed
requests in the app and in their API integrations.

## First five minutes

1. Acknowledge the page so the next person isn't paged.
2. Open the [API dashboard](https://grafana.example.com/d/api) and check whether errors are rising
   or steady, and on which endpoints.
3. Check [recent deploys](https://github.com/acme/api/deployments). If a deploy finished in the
   last 30 minutes, go to [Roll back a deploy](#roll-back-a-deploy).
4. If customers are affected for more than 10 minutes, declare an incident in `#incidents` and
   post an update on the status page.

## Diagnose

Check each in order and stop at the first that explains the errors.

| Check | Command or link | If it shows a problem |
| --- | --- | --- |
| A recent deploy | `kubectl -n api rollout history deployment/api` | [Roll back a deploy](#roll-back-a-deploy) |
| Database health | [Database dashboard](https://grafana.example.com/d/db) | [Database connections exhausted](#database-connections-exhausted) |
| Pod restarts | `kubectl -n api get pods` | Read the logs of a restarting pod with `kubectl -n api logs <pod> --previous` |
| A third-party outage | Status pages of the payment and email providers | Post on the status page and wait. Errors from these calls are retried. |

## Fixes

### Roll back a deploy

```bash
kubectl -n api rollout undo deployment/api
kubectl -n api rollout status deployment/api
```

The error rate should fall within five minutes. A rollback doesn't undo database migrations. If the
deploy included a migration, check the error message before rolling back.

### Database connections exhausted

Logs show `remaining connection slots are reserved`. Restart the API pods one at a time to release
leaked connections:

```bash
kubectl -n api rollout restart deployment/api
```

Then open an issue to find the leak. Don't raise `max_connections` during the incident.

## Verify

The incident is over when the error rate stays under 0.5% for 15 minutes on the API dashboard.
Post a final status page update.

## Escalate

If none of the fixes work within 30 minutes, page the Platform team's secondary on-call. For
database problems, also page the database owner.

Save with your agent

Run this command to add Sniptide to Claude Code in the current project. Open /mcp in Claude Code and sign in to Sniptide. Once the server shows as connected, use the prompt below to save a private copy in your library.

Terminal
claude mcp add --scope local --transport http sniptide https://app.sniptide.com/api/mcp
Prompt
Read https://sniptide.com/templates/runbook-template.json and use create_snippet to save its files as a private Sniptide snippet titled "Runbook template". Keep the file names and contents from the JSON.

Write it for 3 a.m.

The reader was just woken up and doesn't know this service well. Every step is a command to copy or a link to click, in the order to try them. Explanations stay short and come after the action. A runbook that says "investigate the database" leaves the reader where they started. "Open the database dashboard and check active connections" gets them moving.

What each section does

Section
What it settles
How to write it
Header
Which alert and service this covers, who owns it and when it was last tested.
Copy the alert rule exactly, so a search for it finds this page.
What the alert means
The impact on users.
Two sentences. The reader decides how urgent it is from this.
First five minutes
Acknowledge, look, check the most common cause and communicate.
Numbered steps, four or five at most.
Diagnose
Checks in order of likelihood, each pointing to a fix.
A table with the check, the exact command or link and where to go next.
Fixes
The actions that resolve each cause.
Commands in code blocks, what success looks like and what the fix doesn't undo.
Verify
When the incident is over.
A number and a time window, such as "under 0.5% for 15 minutes".
Escalate
Who to call when nothing works.
A time limit and the next person or team.

Keep it working

Link the runbook from the alert itself, so the page carries the URL. Most alerting tools have a runbook or annotation field for this. Test each runbook every quarter by following it step by step in staging, and update Last tested. After each incident, add the step that would have helped to the runbook, and record the rest in a postmortem.

Commands in the example use Kubernetes. Replace them with your platform's equivalents, such as docker compose or your host's CLI, and test that they work with on-call permissions.

Variant: a task runbook

Not every runbook answers an alert. For a routine task, such as rotating a secret, use numbered steps with a check after each:

docs/runbooks/rotate-database-password.md
# Runbook: Rotate the database password

1. Create the new password: `openssl rand -base64 32`.
2. Set it on the role: `ALTER ROLE app PASSWORD '<new password>';`
3. Update `DATABASE_URL` in the secret store and redeploy the API.
4. Check the API dashboard shows no connection errors for 10 minutes.
5. Record the rotation date in the secrets inventory.
All templates
  • Postmortem
    WritingIncident postmortem template

    A blameless incident postmortem template with summary, impact, timeline, root cause, what went well and action items, shown on a realistic outage.

  • ADR
    SpecsArchitecture decision record template

    An architecture decision record (ADR) template in Markdown with status, context, decision, consequences and alternatives, shown on a real example.

  • Docker and deployDocker Compose Postgres

    A Docker Compose file for Postgres with a persistent volume, a health check and optional init scripts, plus variants with an app service and pgAdmin.

Pick where your library lives.

Use sniptide.com

Save your first pattern in the app, then connect Claude Code, Cursor or Codex with one sign-in in the browser.

Run it on your own server

One image and a database give you the app, the API and the MCP endpoint. Sniptide is open source under AGPL-3.0.

$docker compose up -d