| name | technical-runbook |
| argument-hint | [service or system name] |
| description | Write a production operations runbook that provides on-call engineers with step-by-step procedures for operating, monitoring, and recovering a system. Covers system overview, alert response procedures, common failure modes, diagnostic commands, escalation paths, and maintenance procedures. Modeled on Google SRE runbook standards. |
| intent | Produce a production operations runbook that enables any on-call engineer - including one unfamiliar with this specific service - to diagnose and resolve common incidents without calling the original developer. Runbooks are the operational contract of a service: they translate system knowledge from the heads of the authors into durable, executable procedures. A runbook that reduces mean time to recovery (MTTR) from 2 hours to 15 minutes for common failures pays for its authorship cost in the first incident it handles. This skill follows Google SRE Book principles: runbooks document what to do, not why the system was designed this way (that is the SAD's job). |
| type | workflow |
| theme | engineering-docs |
| best_for | ["Documenting the operations procedures for a new service before it goes to production","Capturing tribal knowledge from senior engineers about how a legacy service behaves","Preparing on-call documentation before a service is handed to a new team","Creating the reference document linked from monitoring alerts"] |
| scenarios | ["Write a runbook for the PayFlow payment gateway application","Create an operations manual for our webhook delivery worker service","Document how to operate and troubleshoot our Redis session cache"] |
| estimated_time | 2-4 hours |
| license | MIT |
| compatibility | Designed for Gemini (Antigravity), Claude Code, Cursor/Windsurf, Kimi Code, Codex/Copilot |
Purpose
Produce a runbook that enables any trained engineer - with no prior knowledge of this specific service - to respond to an alert, diagnose a failure, and execute recovery procedures.
A runbook is not a tutorial or an architecture overview. It is a rapid-reference guide for someone who is paged at 3 AM and needs to resolve an incident in 15 minutes, not learn the system from scratch.
Input
Works best with: The name of the service being documented.
Also valuable: The alert definitions, common failure modes, diagnostic commands, architecture overview, and escalation contacts.
Example invocation: Write a runbook for the PayFlow payment gateway. It's a PHP 8.3 app on Nginx/PHP-FPM, MySQL primary + replica, Redis for sessions/cache, and a queue worker process for async jobs. Alerts fire for: high 5xx rate, slow DB queries, queue depth > 1000, and PHP-FPM pool exhaustion.
Key Concepts
What a Good Runbook Contains (Google SRE Standard)
- Overview - What the service does, its SLA, and its dependencies (30 seconds to read)
- Monitoring and Dashboards - Where to look when something is wrong
- Alert Response Procedures - One procedure per alert: diagnosis, mitigation, escalation
- Common Failure Modes - The top 5-10 failures that happen repeatedly
- Diagnostic Commands - The exact commands to run for each symptom
- Escalation Path - Who to call when the runbook cannot resolve the issue
- Maintenance Procedures - Restart, scale, backup, restore
MTTR Reduction
The primary goal of a runbook is to reduce MTTR. Every section should ask: "Can an on-call engineer execute this step in < 5 minutes?" If not, simplify or add more specific commands.
Certificate Management and Rotation
TLS certificates are a common source of outages when they expire or are misconfigured. Document:
Secret Rotation Procedures
Secrets (API keys, database passwords, encryption keys, service account credentials) must be rotatable without downtime. Document:
- Secret inventory: Every secret in use, where it is stored (Vault, AWS Secrets Manager, env vars), and which services consume it.
- Rotation procedure per secret type:
- API keys: Generate new key -> update secret store -> restart/reload consumers -> revoke old key (with grace period if dual-key is supported).
- Database passwords: Create new user with new password -> update secret store -> restart consumers -> drop old user (after confirming no connections).
- Encryption keys: Generate new key -> re-encrypt data (if required) -> update key reference -> retain old key for decryption of legacy data.
- Zero-downtime rotation: How to rotate secrets without service interruption. Does the secret store support dual-read? Does the application hot-reload secrets or require a restart?
- Rotation schedule: How often each secret type is rotated (e.g., API keys quarterly, DB passwords monthly).
- Emergency rotation: What to do if a secret is suspected compromised. Include the expedited path and the blast radius assessment.
Configuration Change Procedures
Configuration changes (environment variables, feature flags, runtime settings) are a common source of incidents when applied incorrectly or without validation. Document:
- Configuration inventory: Where configuration lives (env files, config management tool, feature flag service, Kubernetes ConfigMaps/Secrets).
- Change procedure:
- Document the current value and the proposed new value.
- Verify the change in staging (if applicable).
- Apply the change (exact command or tool).
- Verify the application picked up the change (log entry, health check, feature behavior).
- Document rollback: how to revert the configuration change if it causes issues.
- Feature flag management: How flags are toggled, who has authority, and what the blast radius is. Document the flag state required for each deployment phase.
- Sensitive configuration: Changes to secrets, credentials, or encryption settings follow the Secret Rotation Procedures (above), not the general configuration change procedure.
Performance Profiling Procedures
When the service is slow but not failing, runbook steps must include performance profiling, not just restart-and-hope:
- When to profile: Trigger profiling when p99 latency exceeds warning threshold but is below critical, or when a specific endpoint is slow while others are fine.
- Profiling tools and commands:
- Xdebug profiler: Enable for a single request, capture cachegrind file, analyze with KCachegrind or QCachegrind.
curl "https://[domain]/[slow-endpoint]?XDEBUG_PROFILE=1"
- Blackfire profiler:
blackfire curl https://[domain]/[slow-endpoint]
- New Relic / Datadog APM: Check the APM dashboard for slow transaction traces. Identify the slow span (database query, external HTTP call, template rendering).
- MySQL slow query log:
tail -n 50 /var/log/mysql/slow.log
- PHP-FPM slow log:
tail -n 50 /var/log/php-fpm-slow.log
- Profile in production safely: Profiling tools add overhead. Use sampling (1-5% of requests) or enable profiling only for specific requests (query parameter, cookie) to avoid degrading all users.
Runbook Validation Drills
A runbook that has never been tested against a real incident is a hypothesis, not a tool. Conduct validation drills:
- Quarterly review checklist:
- Drill format: Simulate an alert (e.g., inject a test error, stage a slow query) and have an engineer resolve it using only the runbook. Time it. If it takes longer than the target MTTR, the runbook needs improvement.
- Drill log: Record every drill in the Change Log with the date, scenario, result (pass/fail), and any gaps found.
Multi-Region / Multi-Server Procedures
When the service runs across multiple regions or servers, additional operational considerations apply:
- Per-region dashboards: Do monitoring dashboards filter by region? Can an on-call engineer quickly isolate which region is degraded?
- Region-specific runbooks: Are there any procedures that differ by region (e.g., different DNS records, different backup locations, different scaling groups)?
- Cross-region failover: Document the failover procedure if one region becomes unavailable. Reference the disaster-recovery-plan for the full failover runsheet.
- Distributed debugging: How to correlate logs and traces across multiple servers. What request ID or trace ID is used, and how to search for it across all servers.
- Server inventory: Maintain a list of all servers/instances, their roles, and their region. An on-call engineer must be able to answer "how many servers are running this service and where?" in under 60 seconds.
Living Document
A runbook that is not updated when the system changes becomes worse than no runbook (it gives false confidence). Add a "Last Verified" date to each procedure. Put the runbook update in the deployment checklist.
Conflict Resolution
When your analysis conflicts with the user's stated preference:
- Present both positions — show your analysis and their preference side by side
- Explain the trade-off — what are the consequences of each choice?
- Recommend with reasoning — state your recommendation and why
- Respect the user's decision — they own the final call
- Document the decision — record it as an
[owner-specified] override with reasoning
Document Length
Target length: 8-15 pages (excluding appendices).
Shorter is better than longer. If the document exceeds the target, check for:
- Redundant content that can be cut
- Overly verbose explanations
- Content that belongs in a separate reference document
- Material the agent already knows (don't explain what HTTP is)
If the document is significantly shorter than the target, check for:
- Missing sections
- Insufficient detail in critical areas
- Unaddressed edge cases
Application
Phase 1: Socratic Clarification & Brainstorming (Mandatory Interview)
Interview Mechanism: Use tool calls (e.g., AskUserQuestion) to present questions — do NOT ask inline in the conversation. The user selects from options rather than typing responses. One question per tool call, multiple-choice options preferred, with "I don't know, you decide" as an escape hatch.
Context Loading: Before asking ANY questions, read ALL prior documents in .engineering-docs/ to extract already-known information. Look for:
- Team size, budget, timeline (from business-plan)
- Tech stack, hosting (from system-architecture)
- Target users, JTBD (from user-personas)
- Constraints, regulatory requirements (from business-plan)
- Scope, features (from technical-specification)
If information exists in a prior document, USE IT — do not re-ask.
Maximum 2-3 questions per skill. Only ask about:
- Skill-specific details not covered in prior documents
- Technical decisions that affect this specific document
- Clarifications on ambiguous requirements
Ask questions to resolve:
- Critical Alerts: What are the most common alerts that trigger for this service?
- Escalation contacts: Who is the primary engineer on-call, secondary contact, or manager?
Wait for the user's response to these questions before drafting the final runbook.
Phase 2: Document Generation
- Start with the service overview (what it does, SLA, dependencies).
- Document every active alert with a response procedure.
- Walk through the most common failure modes from recent incident history.
- Write exact diagnostic commands - no vague instructions.
- Define the escalation path unambiguously.
- Document routine maintenance procedures.
Phase 3: Revision (After User Review)
If the user requests changes after reviewing the document:
- Read the user's feedback carefully — understand what they want changed
- Check for conflicts — does the requested change conflict with prior documents (e.g., deployment plan, SLO document)?
- Apply changes — update the runbook
- Re-run consistency check — verify the change doesn't break cross-document consistency (e.g., alert names still match monitoring definitions in the architecture)
- Update metadata — set
last_updated to today's date
- Confirm with user — show the changes and get approval
Gotchas
- Writing "why" instead of "what to do." A runbook is an operational procedure, not an architecture document. An on-call engineer at 3 AM needs exact commands and decision trees, not design rationale. Save the "why" for the System Architecture Document.
- Vague diagnostic commands. "Check the logs" is not a diagnostic step. Write the exact command with the exact file path, filter pattern, and what to look for in the output. Every step must be executable by someone who has never seen this system before.
- Missing the Quick Reference section. An engineer mid-incident needs to jump to the right procedure in under 60 seconds. Without a symptom-to-section lookup table, the runbook fails its primary use case.
- Not covering the "last verified" date. A runbook that has not been verified against the current production state is dangerous - it may reference commands that no longer work or services that have been decommissioned. Every procedure needs a "Last Verified" timestamp.
- Forgetting escalation triggers. Every alert response procedure must state exactly when to stop trying the runbook and escalate. Without this, engineers waste time on steps that will not resolve the issue, increasing MTTR instead of reducing it.
Handoff
Reads from:
7-system-architecture.md — system components, dependencies, infrastructure
16-deployment-plan.md — deployment procedures, rollback steps
19-slo-error-budget.md — SLI/SLO targets, alert thresholds
9-api-design.md — endpoints to monitor and diagnose
Feeds into:
- Incident postmortems — diagnostic procedures referenced during incidents
18-disaster-recovery.md — operational procedures for recovery scenarios
- On-call handoff documentation — operational context for new responders
Quality Gate
Before marking this document as final, verify:
Next Steps
After this document is complete, proceed to:
disaster-recovery-plan — define RTO/RPO targets and failover procedures for catastrophic scenarios
slo-error-budget-document — formalize reliability targets and error budget policies
- Or invoke
using-engineering-docs to continue the pipeline