Skip to content
AI Skills Central

Type to search Agent Skills, workflows, tutorials, tools and the glossary.

Agent Skills guide

Skill recipe: turn an incident runbook into a skill

A worked runbook skill for one service: a triage checklist, a read-only diagnostics script, and fixes the agent may only propose until a person says yes.

By Intermediate · Updated 25 November 20267 min read
Bookmark

Bookmarks are kept in your free account, so you can find this page again on any device.

Sign in to bookmark
On this page

A runbook skill gives an agent your service’s incident procedure in a form it can follow at 3am: what to check first, a script that gathers the facts without changing anything, and a short list of fixes it may propose but never run on its own. The agent cannot infer any of that from the code. It does not know which dashboard matters, what “degraded” means for this service, or that a rollback needs the release manager’s say-so.

Most teams already have the material, in a wiki page called “Checkout API runbook” that is accurate for about six months. Turning it into a skill puts it next to the code, under review, and in front of whichever agent the on-call engineer has open. This recipe builds one for a fictional checkout API. It uses only spec fields, so it works in Claude Code, Codex, Cursor, Copilot and Antigravity; the script was run with Bash 5 and curl on 25 November 2026. For the general rules on shipping code inside a skill, see bundling scripts in skills.

What goes in

  1. Scope: one service, named in the description, so the skill does not fire for every outage in the company.
  2. A triage checklist: the same five questions every time, in order, before anyone touches anything.
  3. A read-only diagnostics script: health, latency, DNS and certificate expiry in one command whose output the agent can quote.
  4. Ask-before-acting steps: each fix written as an exact command the agent shows and explains, and runs only after a person replies “yes”.
  5. Escalation and comms: who to page, and a status update template.
  6. The hand-off: once the service is stable, the write-up belongs to a separate postmortem skill.

SKILL.md

---
name: checkout-api-incident
description: >-
  Runbook for incidents on the Acme checkout API (services/checkout): triage
  checklist, read-only diagnostics and the approved fixes, each proposed for a
  human to confirm. Use when checkout is down, slow or returning errors, when a
  checkout alert fires, or when someone asks what is wrong with checkout. Not
  for other services.
license: Proprietary. Acme internal.
metadata:
  owner: payments-platform
  reviewed: "2026-11-25"
---

# Checkout API incident runbook

You are helping the on-call engineer. They decide; you gather facts and
propose. Never run a command from "Fixes" without an explicit "yes" from
the person in this conversation, given after you showed the command.

## 1. Triage checklist (do these in order, report each answer)

1. What is the symptom? Errors, latency, or wrong results. Quote the alert
   or the user's words.
2. When did it start? Compare with the last deploy:
   `git log -5 --format='%h %ci %s' -- services/checkout`
3. How wide is it? One region, one payment provider, or everything.
   See references/service-map.md for the dependencies.
4. Is it us or a dependency? Check the provider status pages listed in
   references/service-map.md before blaming our code.
5. Severity, using references/severity.md. Say which rule you applied.

## 2. Diagnostics (read-only)

Run `scripts/diagnose.sh https://checkout.internal.acme.dev` and paste the
output. It makes GET requests and DNS/TLS lookups only. If the health
endpoint fails from here but users say checkout works, say so: the problem
may be our network, not the service.

Do not query the production database, restart anything or change a feature
flag during diagnosis.

## 3. Fixes (propose, never run unasked)

For each fix: say why the evidence points to it, show the exact command,
say what it changes and how to undo it, then wait.

- Roll back the last deploy: see references/actions.md#rollback.
  Needs the release manager on SEV1 and SEV2.
- Disable the new payment provider: references/actions.md#provider-flag.
- Scale out: references/actions.md#scale. Only if latency, not errors,
  is the symptom and CPU is above 80%.

If none fits, say so and suggest escalating. Do not invent a fix.

## 4. Escalate and communicate

- SEV1: page payments-platform primary and the incident commander rota.
- Post an update in #inc-checkout every 30 minutes using
  references/status-update.md, even if nothing changed.

## 5. After it is stable

Stop here. Summarise the timeline with timestamps and the evidence for
each decision, and suggest starting the postmortem.

The opening paragraph does the most work. Telling the agent who decides, and repeating “never run unasked” next to the fixes, is what turns a runbook into something you can open during an outage without worrying about what the agent will do next.

scripts/diagnose.sh

#!/usr/bin/env bash
# Read-only first-look diagnostics for the checkout API.
# Usage: scripts/diagnose.sh <base-url>   e.g. scripts/diagnose.sh https://checkout.internal.acme.dev
# Makes GET requests and DNS/TLS lookups only. Changes nothing.
set -euo pipefail

base="${1:?usage: diagnose.sh <base-url>}"
host="$(printf '%s' "$base" | sed -E 's#^https?://##; s#[:/].*$##')"

echo "== DNS"
getent hosts "$host" || echo "DNS: no answer for $host"

echo "== Health endpoint"
for path in /healthz /readyz; do
  curl -sS -o /dev/null --max-time 10 \
    -w "$path status=%{http_code} time=%{time_total}s\n" \
    "$base$path" || echo "$path: request failed"
done

echo "== Latency, 5 requests to /healthz"
for _ in 1 2 3 4 5; do
  curl -sS -o /dev/null --max-time 10 -w "%{time_total}\n" "$base/healthz" || echo "failed"
done

echo "== TLS certificate expiry"
if [[ "$base" == https://* ]]; then
  echo | openssl s_client -servername "$host" -connect "$host:443" 2>/dev/null \
    | openssl x509 -noout -enddate || echo "TLS: could not read certificate"
fi

echo "== Done. No changes were made."

Point it at an unreachable host once before you trust it: every check should fail cleanly, print what failed and still reach the last line with exit code 0, which is what the run on 25 November 2026 did. It takes the URL as an argument rather than hard-coding production, never prompts (an agent cannot answer a prompt), times out every request after ten seconds, and keeps going when one check fails, because a half-broken service is exactly when you need the other checks. getent is Linux; on macOS swap in dig +short or host. If your service has a metrics API, add a read-only query for error rate here rather than asking the agent to compose one under pressure.

references/service-map.md

One table: each dependency (database, cache, payment providers, the auth service), how checkout uses it, the dashboard link and the provider’s public status page. This is the part of the old wiki page most worth keeping, and the part most likely to be out of date, so put the reviewed date from metadata at the top and update both together.

references/actions.md

One section per approved fix, with a stable heading for the SKILL.md to link to (## rollback, ## provider-flag, ## scale). Each section has the exact command, what it changes, how long it takes to work, how to undo it, and who must agree first. Write the undo step as carefully as the fix: during an incident the second command is the one people get wrong. Keeping the commands here rather than in SKILL.md means the agent only loads them when a fix is on the table, and a reviewer can see every state-changing command in one file.

references/severity.md and status-update.md

Your severity definitions, copied from the incident policy rather than rewritten, and a five-line status template: what is affected, since when, what we know, what we are doing, next update time. A fixed template stops the agent padding updates when nothing has changed.

Testing the skill

Run these in a fresh session, without naming the skill:

  1. “Checkout is throwing 502s since about 14:10.” It should load, walk the checklist in order, run the script, and propose at most one fix with its command, then stop and wait.
  2. Reply “go ahead” to a proposed rollback on what the agent judged SEV1. It should ask whether the release manager has agreed, because the skill says so.
  3. “The search service is slow.” It should not load: the description names checkout only.
  4. Point the script at a URL that does not resolve. The output should show the DNS failure and the other checks failing cleanly, with exit code 0.

Re-run the first test whenever someone edits references/actions.md. Testing and evaluating skills covers turning prompts like these into a small eval set.

Pairs well with

  • Incident response for the parts this skill stops short of: severity triage across services, the incident timeline and a blameless postmortem.
  • Systematic debugging once the fire is out and you are looking for the root cause in code.
  • Skill design patterns for the “propose, then confirm” pattern used here, which suits any skill that touches production.
Back to top