Create Runbook
Overview
Generate an operational runbook with step-by-step procedures, copy-pasteable commands, troubleshooting decision trees, and clear escalation paths. Runbooks are designed to be followed under pressure by an on-call engineer who may not be familiar with the system, so every step must be explicit, every command must be runnable, and every decision point must have clear criteria.
Workflow
Read architecture context — Scan .chalk/docs/engineering/ for:
- Architecture docs (service names, endpoints, infrastructure components)
- Previous runbooks (to match format and avoid duplication)
- Incident reports and postmortems (to identify procedures that should exist but do not)
- Monitoring and alerting docs (dashboard links, alert names)
Also check
.chalk/docs/ root for any configuration or infrastructure documentation.
Parse the runbook scope — From $ARGUMENTS, identify:
- Which service or process the runbook covers
- What scenario it addresses (deployment, rollback, scaling, failover, data recovery, etc.)
- Whether this is a routine procedure or an emergency procedure
If the scope is too broad (e.g., "runbook for everything"), ask the user to narrow to a specific service or scenario.
Gather operational details — Use Bash to inspect the codebase for:
- Service configuration files, deployment scripts, and infrastructure-as-code
- Environment variables and configuration references
- Health check endpoints, monitoring integrations
- Database connection details (without exposing credentials)
This ensures commands reference real service names and endpoints, not generic placeholders.
Write procedures as numbered steps — Each step must:
- Describe what the step does and why
- Include a copy-pasteable command in a code block (if applicable)
- Show expected output so the operator can verify success
- State what to do if the step fails (go to troubleshooting, retry, or escalate)
Build the troubleshooting decision tree — For common failure modes:
- Start with the symptom the operator observes
- Branch based on observable conditions (log messages, status codes, metrics)
- Each branch leads to a specific action or escalation
- No dead ends: every branch must terminate in either a fix or an escalation
Define escalation criteria — Specify:
- When to escalate (time thresholds, severity conditions)
- Who to escalate to (team, role, or on-call channel — not individual names)
- What information to include in the escalation
Write verification steps — After each procedure, include steps to confirm success:
- Health check commands
- Expected metric values
- Log patterns that confirm normal operation
- How long to monitor before considering the procedure complete
Write rollback procedures — For every procedure that changes state, include:
- How to undo the change
- What data or state may be affected by the rollback
- Verification steps specific to the rollback
Validate commands — Review all commands in the runbook to ensure:
- No generic placeholders like
<your-service-name> or $SERVICE without definition
- Environment-specific values are clearly documented at the top as prerequisites
- Commands use actual service names, endpoints, and paths from the codebase
Determine the next file number — List files in .chalk/docs/engineering/ to find the highest numbered file. Increment by 1.
Write the file — Save to .chalk/docs/engineering/<n>_runbook_<service_or_process>.md.
Confirm — Present the runbook with a summary of procedures covered, prerequisites, and any gaps that need input from the team.
Runbook Structure
# Runbook: <Service/Process Name>
**Last Updated**: <YYYY-MM-DD>
**Owner**: <team or role>
**Review Cadence**: <quarterly / after each incident>
## Purpose
<When should an operator use this runbook? What scenario does it address?>
## Prerequisites
Before starting, ensure you have:
- [ ] Access to <system/tool> (request via <channel>)
- [ ] <CLI tool> installed (version <X.Y+>)
- [ ] Environment variables set:
```bash
export SERVICE_URL=<actual-url>
export DB_HOST=<actual-host>
Procedures
Procedure 1:
When to use:
Estimated duration:
Risk level: Low / Medium / High
Why:
<copy-pasteable command>
Expected output:
<what the operator should see>
If this fails: <go to Troubleshooting section X / retry / escalate>
<command>
Expected output:
<expected result>
Procedure 2:
Troubleshooting
Symptom:
Is <condition A> true?
├── Yes → <Action or next check>
│ └── Did it resolve?
│ ├── Yes → Done. Verify with <command>
│ └── No → Escalate to <team>
└── No → Check <condition B>
├── <condition B> true → <Action>
└── <condition B> false → Escalate to <team>
Symptom:
Escalation
| Condition |
Escalate To |
Channel |
Include |
|
|
<Slack channel / PagerDuty / etc.> |
|
| Procedure exceeds minutes |
|
|
Timeline of steps taken, current state |
| Data integrity concern |
|
|
Affected records, scope of impact |
Verification
After completing any procedure, verify success:
Health check
<health check command>
Expected: <healthy response>
Metrics check
- should return to within
- Dashboard:
Log check
<command to check for error patterns>
Expected: No errors matching <pattern> in the last
Monitoring period: Watch for before considering the procedure complete.
Rollback
If the procedure needs to be undone:
<rollback command>
Verify rollback
<verification command>
Expected:
Rollback risks:
## Output
- **File**: `.chalk/docs/engineering/<n>_runbook_<service_or_process>.md`
- **Format**: Plain markdown, no YAML frontmatter
- **First line**: `# Runbook: <Service/Process Name>`
## Anti-patterns
- **Prose instead of steps** — "First you'll want to check the service health and then maybe restart it if needed" is not a runbook. "Step 1: Check service health. Step 2: If unhealthy, restart." Runbooks are followed under pressure. Use numbered steps, not paragraphs.
- **Non-copyable commands** — Commands with placeholders like `<your-service>`, `$REPLACE_ME`, or `[insert name here]` force the operator to think and substitute under pressure. Define all variables in the Prerequisites section and use actual values in commands.
- **Missing escalation path** — A runbook without escalation criteria leaves the operator stranded when the procedure does not work. Every runbook must answer: "What do I do if this doesn't fix it?"
- **No verification step** — Completing a procedure without verifying success is dangerous. The operator must be able to confirm the system is healthy before walking away. Include health checks, metric thresholds, and monitoring duration.
- **Outdated commands** — Runbooks that reference decommissioned services, old endpoints, or deprecated CLI flags are worse than no runbook at all. Include a review cadence and last-updated date. Flag commands that depend on specific versions.
- **Missing rollback** — Any procedure that changes system state must include instructions to undo it. If a procedure is irreversible, that must be stated explicitly so the operator understands the risk before proceeding.
- **Assuming expertise** — Runbooks are often used by on-call engineers who did not build the system. Do not assume familiarity with internals. Explain what each step does and why, not just how.
1---2name: create-runbook-23description: Create an operational runbook when the user asks to document a procedure, write a runbook, create an ops guide, or document how to handle a specific operational task4---5
6# Create Runbook
7
8## Overview
9
10Generate an operational runbook with step-by-step procedures, copy-pasteable commands, troubleshooting decision trees, and clear escalation paths. Runbooks are designed to be followed under pressure by an on-call engineer who may not be familiar with the system, so every step must be explicit, every command must be runnable, and every decision point must have clear criteria.
11
12## Workflow
13
141. **Read architecture context** — Scan `.chalk/docs/engineering/` for:
15 - Architecture docs (service names, endpoints, infrastructure components)
16 - Previous runbooks (to match format and avoid duplication)
17 - Incident reports and postmortems (to identify procedures that should exist but do not)
18 - Monitoring and alerting docs (dashboard links, alert names)
19 Also check `.chalk/docs/` root for any configuration or infrastructure documentation.
20
212. **Parse the runbook scope** — From `$ARGUMENTS`, identify:
22 - Which service or process the runbook covers
23 - What scenario it addresses (deployment, rollback, scaling, failover, data recovery, etc.)
24 - Whether this is a routine procedure or an emergency procedure
25 If the scope is too broad (e.g., "runbook for everything"), ask the user to narrow to a specific service or scenario.
26
273. **Gather operational details** — Use `Bash` to inspect the codebase for:
28 - Service configuration files, deployment scripts, and infrastructure-as-code
29 - Environment variables and configuration references
30 - Health check endpoints, monitoring integrations
31 - Database connection details (without exposing credentials)
32 This ensures commands reference real service names and endpoints, not generic placeholders.
33
344. **Write procedures as numbered steps** — Each step must:
35 - Describe what the step does and why
36 - Include a copy-pasteable command in a code block (if applicable)
37 - Show expected output so the operator can verify success
38 - State what to do if the step fails (go to troubleshooting, retry, or escalate)
39
405. **Build the troubleshooting decision tree** — For common failure modes:
41 - Start with the symptom the operator observes
42 - Branch based on observable conditions (log messages, status codes, metrics)
43 - Each branch leads to a specific action or escalation
44 - No dead ends: every branch must terminate in either a fix or an escalation
45
466. **Define escalation criteria** — Specify:
47 - When to escalate (time thresholds, severity conditions)
48 - Who to escalate to (team, role, or on-call channel — not individual names)
49 - What information to include in the escalation
50
517. **Write verification steps** — After each procedure, include steps to confirm success:
52 - Health check commands
53 - Expected metric values
54 - Log patterns that confirm normal operation
55 - How long to monitor before considering the procedure complete
56
578. **Write rollback procedures** — For every procedure that changes state, include:
58 - How to undo the change
59 - What data or state may be affected by the rollback
60 - Verification steps specific to the rollback
61
629. **Validate commands** — Review all commands in the runbook to ensure:
63 - No generic placeholders like `<your-service-name>` or `$SERVICE` without definition
64 - Environment-specific values are clearly documented at the top as prerequisites
65 - Commands use actual service names, endpoints, and paths from the codebase
66
6710. **Determine the next file number** — List files in `.chalk/docs/engineering/` to find the highest numbered file. Increment by 1.
68
6911. **Write the file** — Save to `.chalk/docs/engineering/<n>_runbook_<service_or_process>.md`.
70
7112. **Confirm** — Present the runbook with a summary of procedures covered, prerequisites, and any gaps that need input from the team.
72
73## Runbook Structure
74
75```markdown
76# Runbook: <Service/Process Name>
77
78**Last Updated**: <YYYY-MM-DD>
79**Owner**: <team or role>
80**Review Cadence**: <quarterly / after each incident>
81
82## Purpose
83
84<When should an operator use this runbook? What scenario does it address?>
85
86## Prerequisites
87
88Before starting, ensure you have:
89
90- [ ] Access to <system/tool> (request via <channel>)
91- [ ] <CLI tool> installed (version <X.Y+>)
92- [ ] Environment variables set:
93 ```bash
94 export SERVICE_URL=<actual-url>
95 export DB_HOST=<actual-host>
96 ```
97- [ ] Familiarity with <relevant dashboard or monitoring tool>
98
99## Procedures
100
101### Procedure 1: <Name>
102
103**When to use**: <trigger condition>
104**Estimated duration**: <time>
105**Risk level**: Low / Medium / High
106
1071. **<Step description>**
108
109 Why: <brief explanation of purpose>
110
111 ```bash
112 <copy-pasteable command>
113 ```
114
115 Expected output:
116 ```
117 <what the operator should see>
118 ```
119
120 If this fails: <go to Troubleshooting section X / retry / escalate>
121
1222. **<Next step>**
123
124 ```bash
125 <command>
126 ```
127
128 Expected output:
129 ```
130 <expected result>
131 ```
132
133### Procedure 2: <Name>
134
135<Same format as above>
136
137## Troubleshooting
138
139### Symptom: <What the operator observes>
140
141```
142Is <condition A> true?
143├── Yes → <Action or next check>
144│ └── Did it resolve?
145│ ├── Yes → Done. Verify with <command>
146│ └── No → Escalate to <team>
147└── No → Check <condition B>
148 ├── <condition B> true → <Action>
149 └── <condition B> false → Escalate to <team>
150```
151
152### Symptom: <Another common issue>
153
154<Decision tree for this symptom>
155
156## Escalation
157
158| Condition | Escalate To | Channel | Include |
159|-----------|-------------|---------|---------|
160| <when to escalate> | <team or role> | <Slack channel / PagerDuty / etc.> | <what info to provide> |
161| Procedure exceeds <X> minutes | <team> | <channel> | Timeline of steps taken, current state |
162| Data integrity concern | <team> | <channel> | Affected records, scope of impact |
163
164## Verification
165
166After completing any procedure, verify success:
167
1681. **Health check**
169 ```bash
170 <health check command>
171 ```
172 Expected: `<healthy response>`
173
1742. **Metrics check**
175 - <metric name> should return to <normal range> within <timeframe>
176 - Dashboard: <link>
177
1783. **Log check**
179 ```bash
180 <command to check for error patterns>
181 ```
182 Expected: No errors matching `<pattern>` in the last <timeframe>
183
1844. **Monitoring period**: Watch for <duration> before considering the procedure complete.
185
186## Rollback
187
188If the procedure needs to be undone:
189
1901. **<Rollback step>**
191 ```bash
192 <rollback command>
193 ```
194
1952. **Verify rollback**
196 ```bash
197 <verification command>
198 ```
199 Expected: <state returns to pre-procedure baseline>
200
201**Rollback risks**: <any data or state that cannot be recovered>
202```
203
204## Output
205
206- **File**: `.chalk/docs/engineering/<n>_runbook_<service_or_process>.md`
207- **Format**: Plain markdown, no YAML frontmatter
208- **First line**: `# Runbook: <Service/Process Name>`
209
210## Anti-patterns
211
212- **Prose instead of steps** — "First you'll want to check the service health and then maybe restart it if needed" is not a runbook. "Step 1: Check service health. Step 2: If unhealthy, restart." Runbooks are followed under pressure. Use numbered steps, not paragraphs.
213- **Non-copyable commands** — Commands with placeholders like `<your-service>`, `$REPLACE_ME`, or `[insert name here]` force the operator to think and substitute under pressure. Define all variables in the Prerequisites section and use actual values in commands.
214- **Missing escalation path** — A runbook without escalation criteria leaves the operator stranded when the procedure does not work. Every runbook must answer: "What do I do if this doesn't fix it?"
215- **No verification step** — Completing a procedure without verifying success is dangerous. The operator must be able to confirm the system is healthy before walking away. Include health checks, metric thresholds, and monitoring duration.
216- **Outdated commands** — Runbooks that reference decommissioned services, old endpoints, or deprecated CLI flags are worse than no runbook at all. Include a review cadence and last-updated date. Flag commands that depend on specific versions.
217- **Missing rollback** — Any procedure that changes system state must include instructions to undo it. If a procedure is irreversible, that must be stated explicitly so the operator understands the risk before proceeding.
218- **Assuming expertise** — Runbooks are often used by on-call engineers who did not build the system. Do not assume familiarity with internals. Explain what each step does and why, not just how.