Agent skill
runbook
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).
Install this agent skill to your Project
npx add-skill https://github.com/sd0xdev/sd0x-dev-flow/tree/main/skills/runbook
SKILL.md
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
sequenceDiagram
participant U as User
participant S as /runbook
participant FR as Feature Resolver
participant CB as Codebase
participant RB as runbook-release.md
U->>S: /runbook [feature] [--update|--check] [--request path]
S->>FR: node scripts/resolve-feature-cli.js
FR-->>S: {key, doc_inventory, canonical_docs}
S->>S: Mode dispatch + Request selection
alt Create Mode
S->>CB: Read canonical docs + active requests
S->>CB: Scoped discovery (4-priority cascade)
S->>RB: Write runbook-release.md from template
else Update Mode
S->>RB: Read existing runbook + provenance
S->>CB: Compare current state vs provenance SHAs
S->>RB: Edit changed sections only
else Check Mode
S->>RB: Read existing runbook + provenance
S->>CB: Validate per-section SHAs
S-->>U: Report: Fresh/Stale/Missing/Unknown
end
Phase 0: Context Resolution
Resolve feature using the 5-level cascade:
# If positional feature arg provided, pass as --feature
if [ -n "$FEATURE_ARG" ]; then
FEATURE_JSON=$(node scripts/resolve-feature-cli.js --feature "$FEATURE_ARG" 2>/dev/null || echo '{}')
else
FEATURE_JSON=$(node scripts/resolve-feature-cli.js 2>/dev/null || echo '{}')
fi
| Source | Mapping |
|---|---|
/runbook auth |
FEATURE_ARG=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, canonical_docs |
| 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) |
Note: Mode dispatch keys off the specific file
runbook-release.md, not any runbook-typed doc indoc_inventory. A feature may haverunbook-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 | Canonical docs (tech-spec, architecture) | High |
| 3 | Feature-local paths (docs/features/{feature}/) |
Medium |
| 4 | Repo-wide grep | Low (tag results) |
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 canonical docs via
canonical_docsmap (tech_spec, architecture, requirements) - Read active request(s) for AC, scope, 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
resolve-feature-cli.js - 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: /runbook
Action: Auto-detect feature → create runbook-release.md → /codex-review-doc
Input: /runbook auth --check
Action: Read auth/runbook-release.md → validate provenance SHAs → output report
Input: /runbook --update --request docs/features/auth/requests/2026-04-01-login-fix.md
Action: Read existing runbook → diff stale sections → update → /codex-review-doc
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
ask
Context-aware Q&A with auto context gathering. Use when: user has a quick question about codebase, git history, rules, docs, or skills during development. Not for: code changes (use feature-dev), code review (use codex-review-fast), deep research (use deep-research), full code trace (use code-explore). Output: structured answer with source attribution.
project-brief
Convert a technical spec into a PM/CTO-readable executive summary. Simplify technical details, focus on business value.
codex-test-gen
Generate unit tests for specified functions using Codex MCP
bug-fix
Bug fix workflow. Use when: fixing bugs, resolving issues, regression fixes. Not for: new features (use feature-dev), understanding code (use code-explore). Output: fix + regression test + review gate.
skill-health-check
Validate skill quality against routing, progressive loading, and verification criteria. Use when: auditing skills, checking skill health, reviewing skill design. Not for: code review (use codex-code-review) or doc review (use doc-review). Output: health report with per-skill ratings + Gate.
doc-refactor
Refactor documents — simplify without losing information, visualize flows with sequenceDiagram.
Didn't find tool you were looking for?