gen-runbook
Generate an operational runbook from real system knowledge — alerts, playbooks, recovery steps
SKILL.mdgen-runbook/SKILL.md
GitHubGoal
Generate an operational runbook from the real codebase and config — a document oncall/ops use when the system has problems: symptoms, diagnosis steps, mitigations, escalation
Scope
- Covers: service overview, dependencies, common failure modes, diagnosis procedures, mitigation/rollback steps, escalation contacts
- Built from: architecture, deploy config, monitoring setup, past incidents (if any), code structure
- Output: a runbook doc in
.devin/ordocs/— does not modify code
Execute
1. Map The System
Goal: Understand the system being documented
- Do
/learn(codebase) or/scan-codebase— services, dependencies, data stores - Do
/report-architecture-diagramif a visual overview is wanted - Identify deploy targets, environments, and external dependencies
2. Identify Failure Modes
Goal: Collect how the system can break
- From
/deep-review-codebasefindings — error handling, resilience gaps - External dependencies: DB down, API limits, queue backlog, cert expiry, DNS issues
- App-level: memory leaks, deadlocks, bad deploys, config errors
- Group into incident types:
outage,degraded,data-issue,security
3. Write Runbook Structure
Goal: Create a runbook that works during a panic
# Runbook: <service>
## Quick Reference
- Dashboard: <url>, Logs: <where>, Deploy: <how>
- Escalation: <who/channel>
## Service Overview
- What it does, critical paths, SLA
## Dependencies
- <dep> — if down: <symptom + mitigation>
## Incident Playbooks
### <Incident Type>: <symptom>
**Detect**: <alert/signal>
**Diagnose**: <steps to find the cause — logs, metrics, queries>
**Mitigate**: <fix steps — restart, rollback, failover>
**Rollback**: <if the fix fails>
**Escalate**: <when and to whom>
## Common Operations
- Deploy, rollback, scale, secrets rotation
## Post-Incident
- Postmortem template, action items tracking
- Fill in real copy-run commands — not floating "check the logs" advice
4. Validate Against Reality
Goal: The runbook must be actually followable
- Every command/path/query must be verified to exist in the repo/config
- Clearly mark placeholders the user must fill (contacts, URLs not present in code)
- Check that mitigation steps are not destructive without a warning
5. Report
Goal: Deliver the runbook with its gaps
- Save with
/create-report-in-dot-devinordocs/runbook-<service>.md - Use
/reportto summarize: sections completed vs sections the user must fill - Suggest
/deep-review-codebaseif diagnosis steps lack required signals
Rules
1. Runnable Steps
- Every diagnosis/mitigation step must be actually executable — verified commands
- Never write generic advice — a runbook is an executable doc
2. Evidence-Based
- Failure modes come from real code/config/findings — never guessed incident types
- Mark
[TODO: ...]for data absent from the repo (contacts, external dashboards)
3. Safety First
- Destructive mitigation steps (rollback, restart, failover) must carry warnings and confirm points
- Escalation paths are explicit — a runbook does not mean handling everything alone
- Use /run-docs if needed
Expected Outcome
- A runbook oncall can actually use during an incident
- Playbooks per failure mode with runnable steps
- Gaps to fill (contacts, dashboards) clearly marked