Runbook Generator
Goal
Create a comprehensive operational runbook that answers "what needs to be running" for a system to be tested and deployed effectively, with startup checklists and smoke tests for both local and production environments.
Input Sources
- Codebase Analysis - Automatically discover services, dependencies, and deployment patterns from the repository
Output
- Format: Markdown (
.md)
- Location: Repository root
- Filename:
RUNBOOK.md
Process
Phase 1: Environment & Architecture Discovery
Discover System Architecture
Analyze the codebase to identify:
Service Discovery:
package.json files and their scripts (start commands, dev commands)
docker-compose.yml files (service definitions, ports, dependencies)
- Deployment configs (
fly.toml, vercel.json, Dockerfile, K8s manifests)
- Multiple service directories (backend, frontend, worker, api, etc.)
Dependency Discovery:
.env.example files (required environment variables, external services)
- Database configs (PostgreSQL, MongoDB, Redis, etc.)
- External APIs and storage backends (S3, Mech Storage, etc.)
- Authentication providers (OAuth, Auth0, Clerk, etc.)
Port & Health Check Discovery:
- Service ports from configs
- Health check endpoints (
/health, /status, /ping)
- API base URLs
Runtime Discovery:
- CLI tools or daemons that must run (background workers, polling agents)
- Hook systems or integrations
- Build/bundle requirements
GATE: Environment Strategy
Ask the user:
Which environments does this system have?
a) Local/Development only
b) Local + Staging
c) Local + Production
d) Local + Staging + Production
Where are production secrets stored?
(e.g., 1Password, AWS Secrets Manager, Fly.io secrets, Vercel env vars, etc.)
Ask About Testing Scope
What level of local testing should the runbook support?
a) Minimum (just the core services, no external dependencies)
b) Full local stack (all services + external deps or local stubs)
c) Hybrid (local services + remote staging dependencies)
Phase 2: Runbook Generation
Generate "System Pieces" Section
Document the system architecture:
## System Pieces (What Talks To What)
**Runs on developer machine:**
- [CLI tool name] (what it does)
- [Background daemon] (what it polls/monitors)
- [Hook system] (what it intercepts)
**Runs as services:**
- [Service 1] (`path/`) - what it does, what it exposes
- [Service 2] (`path/`) - what it does, dependencies
**External dependencies:**
- [Database/Storage] - why it's needed
- [Third-party API] - what features depend on it
Generate "Local Testing" Section
Minimum Requirements:
## Local Testing (What Must Be Running)
### Minimum to test "[core functionality]"
1. **[Service 1] running locally** on `http://localhost:XXXX`
2. **[Service 2] running locally** on `http://localhost:YYYY`
Docs:
- [Link to relevant local dev guide with line number]
Full Local E2E:
### Full local end-to-end (closest to real usage)
In addition to the minimum above:
3. **[Daemon/CLI] running** (`command to start`)
4. **[Hook system] enabled** (`command to enable`)
5. **[Dependencies]** (database seeded, external service configured)
Environment variables required:
- `VAR_NAME` (example value, what it controls)
- `API_KEY` (where to get it)
Local Bring-Up Checklist:
### Local bring-up checklist
**1) Configure environment**
- Copy `.env.example` → `.env` and fill required values
- Required vars: [list critical ones]
**2) Start [Service 1]**
- From repo root: `bun run dev:service1`
- Or directly: `cd service1 && npm run dev`
- Or via Docker: `docker-compose up service1`
**3) Start [Service 2]**
- [Commands...]
**4) Smoke checks**
- Service 1 health: `curl http://localhost:3000/health`
- Service 2 loads: open `http://localhost:5173`
- [Other verification commands]
Generate "Production Testing" Section
Minimum Production Deployment:
## Production Testing (What Must Be Running)
### Minimum production deployment
- **[Service 1] deployed** (platform name)
- **[Service 2] deployed** (platform name)
- **[Database/Storage] configured** (provider name)
- **Production secrets configured** (list critical secrets)
Docs:
- Deployment guide: `DEPLOYMENT_GUIDE.md:1`
- Production setup: `path/PRODUCTION_SETUP.md:1`
Production Smoke Test Checklist:
### Production smoke test checklist
1. Service 1 is up: `GET /health` returns 200
2. Service 2 is up: homepage loads
3. Authentication works: login flow completes
4. API key creation works: can generate keys in UI
5. Core flow works end-to-end:
- [Step 1]
- [Step 2]
- [Step 3]
- Confirm expected outcome
Automated test scripts:
- `path/to/test-script.sh` (what it tests)
Generate "Notes / Common Gotchas" Section
Document common failure modes discovered during analysis:
## Notes / Common Gotchas
- If [Service] can't talk to [Dependency] (bad creds/network), [what breaks]
- If testing [feature] across [architecture detail], [config vars] need to match [topology]
- Port conflicts: If you see [error], check if [service] is already running
- Missing dependencies: [Service] requires [dependency] to be installed
- Environment mismatches: [Common mistake and how to fix it]
Phase 3: Review & Save
Present Draft for Review
Show the generated runbook to the user before saving:
I've generated a runbook with the following sections:
- System architecture (X services, Y dependencies)
- Local testing requirements (minimum + full E2E)
- Production deployment requirements
- Startup checklists with copy-pasteable commands
- Smoke test verification steps
- Common gotchas
Would you like me to save this to RUNBOOK.md?
Save Runbook
Save to RUNBOOK.md at repository root
Summarize Next Steps
Runbook created at RUNBOOK.md:1
To use this runbook:
- For local development: Follow "Local Testing" section
- For deployment: Follow "Production Testing" section
- For troubleshooting: Check "Common Gotchas" section
To update this runbook when infrastructure changes:
- Re-run this skill to regenerate
- Or manually edit RUNBOOK.md
Output Format Template
The generated RUNBOOK.md should follow this structure:
# [Project Name] Runbook (Local + Production)
This runbook answers: "what needs to be running" for [Project] to be tested effectively.
## System Pieces (What Talks To What)
**Runs on the developer machine**
- [List CLI tools, daemons, hooks]
**Runs as services**
- [List backend services, frontends, APIs]
**External dependencies**
- [List databases, storage, third-party APIs]
## Local Testing (What Must Be Running)
### Minimum to test "[core functionality]"
[Numbered list with ports and docs references]
### Full local end-to-end (closest to real usage)
[Additional requirements beyond minimum]
### Local bring-up checklist
**1) Configure [thing]**
[Copy-pasteable commands]
**2) Start [service]**
[Copy-pasteable commands]
**3) Smoke checks**
[Verification curl commands]
## Production Testing (What Must Be Running)
### Minimum production deployment
[List deployed services, dependencies, secrets]
### Production smoke test checklist
[Numbered verification steps with expected outcomes]
## Notes / Common Gotchas
[Bulleted list of common failure modes and solutions]
Interaction Model
- Automated Discovery: Scan codebase for services/dependencies/configs
- User Confirmation: Ask about environment strategy and testing scope
- Draft Review: Present runbook before saving
- Iterative: Update based on user corrections
Target Audience
The runbook should be usable by:
- A new developer joining the project (onboarding)
- An AI agent setting up the development environment
- An SRE deploying to production
- A QA engineer validating deployment health
Key Principles
- Discovery over Assumptions - Scan actual configs, don't guess structure
- Copy-Pasteable Commands - Every command should work as-is
- Environment-Aware - Different requirements for local vs production
- Smoke Tests Included - Verification steps for each service
- Reference Existing Docs - Link to deeper guides with line numbers (e.g.,
README.md:42)
Integration with Other Skills
- After deployment changes: Re-run runbook-generator to update RUNBOOK.md
- Before test-plan-generator: Use RUNBOOK.md to understand prerequisites
- After prd-writer: May need runbook updates if new services are added
1---2name: runbook-generator3description: Generate operational runbooks documenting what needs to be running locally and in production for effective system testing and deployment.4---56# Runbook Generator78## Goal9Create a comprehensive operational runbook that answers "what needs to be running" for a system to be tested and deployed effectively, with startup checklists and smoke tests for both local and production environments.1011## Input Sources12- **Codebase Analysis** - Automatically discover services, dependencies, and deployment patterns from the repository1314## Output15- **Format:** Markdown (`.md`)16- **Location:** Repository root17- **Filename:** `RUNBOOK.md`1819---2021## Process2223### Phase 1: Environment & Architecture Discovery24251. **Discover System Architecture**26 Analyze the codebase to identify:2728 **Service Discovery:**29 - `package.json` files and their `scripts` (start commands, dev commands)30 - `docker-compose.yml` files (service definitions, ports, dependencies)31 - Deployment configs (`fly.toml`, `vercel.json`, `Dockerfile`, K8s manifests)32 - Multiple service directories (backend, frontend, worker, api, etc.)3334 **Dependency Discovery:**35 - `.env.example` files (required environment variables, external services)36 - Database configs (PostgreSQL, MongoDB, Redis, etc.)37 - External APIs and storage backends (S3, Mech Storage, etc.)38 - Authentication providers (OAuth, Auth0, Clerk, etc.)3940 **Port & Health Check Discovery:**41 - Service ports from configs42 - Health check endpoints (`/health`, `/status`, `/ping`)43 - API base URLs4445 **Runtime Discovery:**46 - CLI tools or daemons that must run (background workers, polling agents)47 - Hook systems or integrations48 - Build/bundle requirements49502. **GATE: Environment Strategy**51 Ask the user:52 ```53 Which environments does this system have?54 a) Local/Development only55 b) Local + Staging56 c) Local + Production57 d) Local + Staging + Production5859 Where are production secrets stored?60 (e.g., 1Password, AWS Secrets Manager, Fly.io secrets, Vercel env vars, etc.)61 ```62633. **Ask About Testing Scope**64 ```65 What level of local testing should the runbook support?66 a) Minimum (just the core services, no external dependencies)67 b) Full local stack (all services + external deps or local stubs)68 c) Hybrid (local services + remote staging dependencies)69 ```7071### Phase 2: Runbook Generation72734. **Generate "System Pieces" Section**74 Document the system architecture:75 ```markdown76 ## System Pieces (What Talks To What)7778 **Runs on developer machine:**79 - [CLI tool name] (what it does)80 - [Background daemon] (what it polls/monitors)81 - [Hook system] (what it intercepts)8283 **Runs as services:**84 - [Service 1] (`path/`) - what it does, what it exposes85 - [Service 2] (`path/`) - what it does, dependencies8687 **External dependencies:**88 - [Database/Storage] - why it's needed89 - [Third-party API] - what features depend on it90 ```91925. **Generate "Local Testing" Section**9394 **Minimum Requirements:**95 ```markdown96 ## Local Testing (What Must Be Running)9798 ### Minimum to test "[core functionality]"99 1. **[Service 1] running locally** on `http://localhost:XXXX`100 2. **[Service 2] running locally** on `http://localhost:YYYY`101102 Docs:103 - [Link to relevant local dev guide with line number]104 ```105106 **Full Local E2E:**107 ```markdown108 ### Full local end-to-end (closest to real usage)109 In addition to the minimum above:110 3. **[Daemon/CLI] running** (`command to start`)111 4. **[Hook system] enabled** (`command to enable`)112 5. **[Dependencies]** (database seeded, external service configured)113114 Environment variables required:115 - `VAR_NAME` (example value, what it controls)116 - `API_KEY` (where to get it)117 ```118119 **Local Bring-Up Checklist:**120 ```markdown121 ### Local bring-up checklist122123 **1) Configure environment**124 - Copy `.env.example` → `.env` and fill required values125 - Required vars: [list critical ones]126127 **2) Start [Service 1]**128 - From repo root: `bun run dev:service1`129 - Or directly: `cd service1 && npm run dev`130 - Or via Docker: `docker-compose up service1`131132 **3) Start [Service 2]**133 - [Commands...]134135 **4) Smoke checks**136 - Service 1 health: `curl http://localhost:3000/health`137 - Service 2 loads: open `http://localhost:5173`138 - [Other verification commands]139 ```1401416. **Generate "Production Testing" Section**142143 **Minimum Production Deployment:**144 ```markdown145 ## Production Testing (What Must Be Running)146147 ### Minimum production deployment148 - **[Service 1] deployed** (platform name)149 - **[Service 2] deployed** (platform name)150 - **[Database/Storage] configured** (provider name)151 - **Production secrets configured** (list critical secrets)152153 Docs:154 - Deployment guide: `DEPLOYMENT_GUIDE.md:1`155 - Production setup: `path/PRODUCTION_SETUP.md:1`156 ```157158 **Production Smoke Test Checklist:**159 ```markdown160 ### Production smoke test checklist161 1. Service 1 is up: `GET /health` returns 200162 2. Service 2 is up: homepage loads163 3. Authentication works: login flow completes164 4. API key creation works: can generate keys in UI165 5. Core flow works end-to-end:166 - [Step 1]167 - [Step 2]168 - [Step 3]169 - Confirm expected outcome170171 Automated test scripts:172 - `path/to/test-script.sh` (what it tests)173 ```1741757. **Generate "Notes / Common Gotchas" Section**176 Document common failure modes discovered during analysis:177 ```markdown178 ## Notes / Common Gotchas179180 - If [Service] can't talk to [Dependency] (bad creds/network), [what breaks]181 - If testing [feature] across [architecture detail], [config vars] need to match [topology]182 - Port conflicts: If you see [error], check if [service] is already running183 - Missing dependencies: [Service] requires [dependency] to be installed184 - Environment mismatches: [Common mistake and how to fix it]185 ```186187### Phase 3: Review & Save1881898. **Present Draft for Review**190 Show the generated runbook to the user before saving:191 ```192 I've generated a runbook with the following sections:193 - System architecture (X services, Y dependencies)194 - Local testing requirements (minimum + full E2E)195 - Production deployment requirements196 - Startup checklists with copy-pasteable commands197 - Smoke test verification steps198 - Common gotchas199200 Would you like me to save this to RUNBOOK.md?201 ```2022039. **Save Runbook**204 Save to `RUNBOOK.md` at repository root20520610. **Summarize Next Steps**207 ```208 Runbook created at RUNBOOK.md:1209210 To use this runbook:211 - For local development: Follow "Local Testing" section212 - For deployment: Follow "Production Testing" section213 - For troubleshooting: Check "Common Gotchas" section214215 To update this runbook when infrastructure changes:216 - Re-run this skill to regenerate217 - Or manually edit RUNBOOK.md218 ```219220---221222## Output Format Template223224The generated `RUNBOOK.md` should follow this structure:225226```markdown227# [Project Name] Runbook (Local + Production)228229This runbook answers: "what needs to be running" for [Project] to be tested effectively.230231## System Pieces (What Talks To What)232233**Runs on the developer machine**234- [List CLI tools, daemons, hooks]235236**Runs as services**237- [List backend services, frontends, APIs]238239**External dependencies**240- [List databases, storage, third-party APIs]241242## Local Testing (What Must Be Running)243244### Minimum to test "[core functionality]"245[Numbered list with ports and docs references]246247### Full local end-to-end (closest to real usage)248[Additional requirements beyond minimum]249250### Local bring-up checklist251**1) Configure [thing]**252[Copy-pasteable commands]253254**2) Start [service]**255[Copy-pasteable commands]256257**3) Smoke checks**258[Verification curl commands]259260## Production Testing (What Must Be Running)261262### Minimum production deployment263[List deployed services, dependencies, secrets]264265### Production smoke test checklist266[Numbered verification steps with expected outcomes]267268## Notes / Common Gotchas269270[Bulleted list of common failure modes and solutions]271```272273---274275## Interaction Model276277- **Automated Discovery:** Scan codebase for services/dependencies/configs278- **User Confirmation:** Ask about environment strategy and testing scope279- **Draft Review:** Present runbook before saving280- **Iterative:** Update based on user corrections281282---283284## Target Audience285286The runbook should be usable by:287- A new developer joining the project (onboarding)288- An AI agent setting up the development environment289- An SRE deploying to production290- A QA engineer validating deployment health291292---293294## Key Principles2952961. **Discovery over Assumptions** - Scan actual configs, don't guess structure2972. **Copy-Pasteable Commands** - Every command should work as-is2983. **Environment-Aware** - Different requirements for local vs production2994. **Smoke Tests Included** - Verification steps for each service3005. **Reference Existing Docs** - Link to deeper guides with line numbers (e.g., `README.md:42`)301302---303304## Integration with Other Skills305306- **After deployment changes:** Re-run runbook-generator to update RUNBOOK.md307- **Before test-plan-generator:** Use RUNBOOK.md to understand prerequisites308- **After prd-writer:** May need runbook updates if new services are added