Skill v1.0.1
currentAutomated scan100/100+6 new
version: "1.0.1" name: runbook description: "Generate and update feature release runbooks from existing docs and codebase. Use when: creating operational runbook, release handbook, deployment checklist, pre-release preparation. Not for: incident response (v2), code review (use codex-code-review), architecture design (use architecture)." allowed-tools: Read, Grep, Glob, Bash(git:), Bash(node:), Write, Edit, Agent, AskUserQuestion
Runbook Generation Skill
Trigger
- Keywords: runbook, release runbook, deployment handbook, release handbook, operational guide, pre-release checklist, rollback plan
When NOT to Use
| Scenario | Alternative | |
|---|---|---|
| Incident response runbook | v2 (not yet implemented) | |
| Code review | /codex-review-fast | |
| Architecture design | /architecture | |
| Tech spec writing | /tech-spec | |
| Request tracking | /create-request |
Usage
/runbook # Auto-detect feature, create or update/runbook <feature-keyword> # Specify feature/runbook --update # Force update mode/runbook --check # Read-only staleness validation/runbook --request <path|title> # Specify target request (multi-request features)
Workflow
sequenceDiagramparticipant U as Userparticipant S as /runbookparticipant FR as Feature Resolverparticipant CB as Codebaseparticipant RB as runbook-release.mdU->>S: /runbook [feature] [--update|--check] [--request path]S->>FR: node scripts/resolve-feature.jsFR-->>S: {key, doc_inventory, source sets}S->>S: Mode dispatch + Request selectionalt Create ModeS->>CB: Read current_authority + requests/*.mdS->>CB: Scoped discovery (5-priority cascade)S->>RB: Write runbook-release.md from templateelse Update ModeS->>RB: Read existing runbook + provenanceS->>CB: Compare current state vs provenance SHAsS->>RB: Edit changed sections onlyelse Check ModeS->>RB: Read existing runbook + provenanceS->>CB: Validate per-section SHAsS-->>U: Report: Fresh/Stale/Missing/Unknownend
Phase 0: Context Resolution
Resolve feature using the 5-level cascade:
The wrapper, not the CLI directly: resolve-feature.js owns the failure payload, so the full shape with scan_error: true arrives however the CLI fails — a nonzero exit, a signal, a partial write, a payload that is not the agreed shape. (It cannot survive node itself being unavailable: nothing running under node can. What it removes is the CLI's failure domain, not the interpreter's.) Calling the CLI with || echo '{}' produces a payload the gate below cannot recognise as a failure.
Decide the branch yourself, then run one command. This skill grants Bash(node:*), which matches a direct node … invocation and nothing else — a shell if/[ … ]/$(…) compound is not a node command and cannot run here. Parse $ARGUMENTS first (Step 1 below), then issue exactly one of:
node scripts/resolve-feature.js --feature <the feature key from $ARGUMENTS>
node scripts/resolve-feature.js
Use the first when $ARGUMENTS carried a positional feature key, the second otherwise. Pass the key as a separate argv token — never interpolate it into a larger shell expression.
| Source | Mapping | |
|---|---|---|
/runbook auth | Positional key auth → --feature auth (two separate argv tokens) | |
/runbook (no arg) | No --feature, resolver uses branch/diff/fallback | |
/runbook --check | No --feature, parse flags only |
| Step | Action | |
|---|---|---|
| 1 | Parse $ARGUMENTS for feature key or --check/--update/--request flags | |
| 2 | Run feature resolver, get key, doc_inventory, and the four source sets (current_authority, design_records, work_records, history_records) | |
| 2b | If `scan_error !== false`, stop — not === true: a payload missing the field is a failure too. See the gate below | |
| 3 | Check for runbook-release.md specifically in feature directory (not any runbook-*.md) | |
| 4 | Determine mode: create (runbook-release.md absent) / update (runbook-release.md exists) / check (--check flag) |
`scan_error` gate. Gate on `scan_error !== false`, not onscan_error === true. When itis not exactlyfalsethe four source sets are unknown, not empty — the corpus could not beenumerated (unreadable directory, broken taxonomy, no repository), or the resolver never ranand a shell fallback supplied a payload with no such field at all.{}is the shape that madethe stricter test useless: it has noscan_error, so=== trueis false and the gate passes apayload that contains nothing. Do not proceed as though the feature has no authority documents —report and take the ⚠️ Need Human exit. Akeymay still be present, so a non-nullkeyis notevidence the sets are complete.
Note: Mode dispatch keys off the specific file runbook-release.md, not any runbook-typed doc in doc_inventory. A feature may have runbook-deploy.md (a different topic) without triggering update mode for the release runbook.
Request Selection
| Condition | Behavior | |
|---|---|---|
--request specified | Use specified request | |
| Single active request | Auto-select | |
| Multiple active requests | AskUserQuestion: list requests, let user choose | |
| No active requests | Use most recent request (warn) |
Phase 1: Content Discovery (Create/Update modes)
Use scoped discovery cascade — narrow to wide, with confidence degradation:
| Priority | Scope | Confidence | |
|---|---|---|---|
| 1 | Request Related Files paths | High | |
| 2 | current_authority — code, rules/, and the docs that claim to be current | High | |
| 3 | design_records (tech spec, architecture) | Medium — intent only, mark steps unverified | |
| 4 | Feature-local paths (docs/features/{feature}/) | Medium | |
| 5 | Repo-wide grep | Low (tag results) |
A P1 path is classified before it is used. Related Files is High confidence because the request author named those paths deliberately — not because a path in that table is exempt from the role split. Resolve each one first: a path landing in design_records (a tech spec, an architecture doc) is treated as P3 — Medium, marked unverified — even though it arrived via P1. Otherwise the row the split removed comes straight back through the front door, since a request's Related Files table routinely names 2-tech-spec.md.
Priorities 2 and 3 used to be one row reading "canonical docs (tech-spec, architecture) — High", which is the confusion this feature exists to remove: a tech spec is a design record, and a runbook built from one describes a procedure that may never have been built.
See references/discovery-heuristics.md for per-section mapping.
Security — Redaction Rules
When mining configs/workflows/logs into committed markdown:
| Prohibited | Replacement | |
|---|---|---|
| API keys, tokens, secrets | ${ENV_VAR_NAME} placeholder | |
| Webhook URLs with credentials | <webhook-url> symbolic reference | |
| Internal-only endpoints | <internal-endpoint> placeholder | |
| Database connection strings | ${DATABASE_URL} placeholder |
Phase 2: Generate / Update
Create Mode
- Read
current_authorityfirst — a runbook describes what operators will actually run, so the
sources are code, rules/, and the docs that claim to be current. Fall back to design_records (tech spec, architecture) only for the intent behind a step, and mark any step sourced that way as unverified in the provenance manifest: a design record may describe a procedure that was never built
- Read active request(s) by enumerating
docs/features/{feature}/requests/*.md— not by
filtering work_records. That set answers "is this document a work record", and a ticket that resolves to some other role — authority Yes, or a Doc role naming one of the other three — leaves it while staying an open ticket; selecting from the set would drop exactly that ticket's AC, scope and related files
- Run scoped discovery for each template section
- Fill template from
references/template.md - Embed
<!-- runbook-provenance -->manifest with source SHAs - Write to
docs/features/{feature}/runbook-release.md
Update Mode
- Read existing
runbook-release.mdand parse<!-- runbook-provenance -->block - Compare each
sources[].shaagainstgit hash-object <file> - Identify stale sections (any source SHA mismatch)
- Re-run discovery for stale sections only
- Edit stale sections via Edit tool (preserve fresh sections)
- Update provenance manifest with new SHAs
Phase 3: Check Mode (--check)
Read-only validation — does not modify the runbook file.
- Read existing
runbook-release.mdand parse provenance manifest - For each section, compare
sources[].shaagainst currentgit hash-object - Classify: Fresh / Stale / Missing / Unknown (see
references/check-output.md) - Output report with per-section status and SHA diffs
- Emit verdict: Ready / Stale / Incomplete
Output
| Mode | Output | Location | |
|---|---|---|---|
| Create | New runbook | docs/features/{feature}/runbook-release.md | |
| Update | Updated sections | Same file, incremental edit | |
| Check | Console report | stdout only (no file modification) |
Verification
- [ ] Feature resolved via
node scripts/resolve-feature.js, andscan_errorwas exactlyfalse - [ ] Runbook detected in
doc_inventory(ancillary/runbook type) - [ ] Template has all 9 sections (see
references/template.md) - [ ] Provenance manifest embedded with multi-source SHA tracking
- [ ] Discovery uses scoped cascade (not repo-wide grep as first option)
- [ ] Redaction rules applied (no secrets in committed markdown)
- [ ]
--checkmode is read-only (no file writes)
Auto-Loop Integration
This skill produces .md output. Per @rules/auto-loop.md:
| Event | Action | |
|---|---|---|
Create/Update writes .md | /codex-review-doc auto-triggered | |
| Check mode (no writes) | No review needed |
References
| File | Purpose | |
|---|---|---|
references/template.md | 9-section runbook template with provenance block | |
references/discovery-heuristics.md | Scoped discovery cascade and per-section mapping | |
references/check-output.md | --check mode output template and verdict logic |
Examples
Input: /runbookAction: Auto-detect feature → create runbook-release.md → /codex-review-docInput: /runbook auth --checkAction: Read auth/runbook-release.md → validate provenance SHAs → output reportInput: /runbook --update --request docs/features/auth/requests/2026-04-01-login-fix.mdAction: Read existing runbook → diff stale sections → update → /codex-review-doc