$npx -y skills add Rune-kit/rune --skill docsAuto-generate and maintain project documentation. Creates README, API docs, architecture docs, changelogs, and keeps them in sync with code changes. The \"docs are never outdated\" skill.
| 1 | # docs |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | Documentation lifecycle manager. Generates initial project documentation, keeps docs in sync with code changes, produces API references, and auto-generates changelogs. Solves the #1 documentation problem: docs that exist but are outdated. |
| 6 | |
| 7 | <HARD-GATE> |
| 8 | Docs MUST be generated from actual code, not invented. Every statement in generated docs must be traceable to a specific file, function, or configuration in the codebase. If code doesn't exist yet, docs describe the PLAN, not the implementation. |
| 9 | </HARD-GATE> |
| 10 | |
| 11 | ## Triggers |
| 12 | |
| 13 | - Called by `scaffold` Phase 7 for initial documentation generation |
| 14 | - Called by `cook` post-Phase 7 to update docs after feature implementation |
| 15 | - Called by `launch` pre-deploy to ensure docs are current |
| 16 | - `/rune docs init` — first-time documentation generation |
| 17 | - `/rune docs update` — sync docs with recent code changes |
| 18 | - `/rune docs api` — generate API documentation |
| 19 | - `/rune docs changelog` — auto-generate changelog from git history |
| 20 | |
| 21 | ## Calls (outbound) |
| 22 | |
| 23 | - `scout` (L2): scan codebase for documentation targets (routes, exports, components, configs) |
| 24 | - `doc-processor` (L3): generate PDF/DOCX exports if requested |
| 25 | - `git` (L3): read commit history for changelog generation |
| 26 | |
| 27 | ## Called By (inbound) |
| 28 | |
| 29 | - `scaffold` (L1): Phase 7 — generate initial docs for new project |
| 30 | - `cook` (L1): post-implementation — update docs for changed modules |
| 31 | - `launch` (L1): pre-deploy — verify docs are current |
| 32 | - `mcp-builder` (L2): generate MCP server documentation |
| 33 | - User: `/rune docs` direct invocation |
| 34 | |
| 35 | ## Modes |
| 36 | |
| 37 | ### Init Mode — `/rune docs init` |
| 38 | |
| 39 | First-time documentation generation for a project. |
| 40 | |
| 41 | ### Update Mode — `/rune docs update` |
| 42 | |
| 43 | Incremental sync — update only docs affected by recent code changes. |
| 44 | |
| 45 | ### API Mode — `/rune docs api` |
| 46 | |
| 47 | Generate or update API documentation specifically. |
| 48 | |
| 49 | ### Changelog Mode — `/rune docs changelog` |
| 50 | |
| 51 | Auto-generate changelog from git commit history. |
| 52 | |
| 53 | ## Executable Steps |
| 54 | |
| 55 | ### Init Mode |
| 56 | |
| 57 | #### Step 1 — Scan Codebase |
| 58 | |
| 59 | Invoke `rune:scout` to extract: |
| 60 | - Project name, description, tech stack |
| 61 | - Directory structure and key files |
| 62 | - Entry points (main, index, app) |
| 63 | - Public API surface (exports, routes, components) |
| 64 | - Configuration files (.env.example, config patterns) |
| 65 | - Existing docs (if any — merge, don't overwrite) |
| 66 | |
| 67 | #### Step 2 — Generate README.md |
| 68 | |
| 69 | Structure: |
| 70 | ```markdown |
| 71 | # [Project Name] |
| 72 | [One-line description] |
| 73 | |
| 74 | ## Quick Start |
| 75 | [3-5 commands to get running: install, configure, start] |
| 76 | |
| 77 | ## Features |
| 78 | [Bullet list extracted from code — routes, components, capabilities] |
| 79 | |
| 80 | ## Tech Stack |
| 81 | [Detected from package.json, requirements.txt, Cargo.toml, etc.] |
| 82 | |
| 83 | ## Project Structure |
| 84 | [Key directories with one-line descriptions] |
| 85 | |
| 86 | ## Configuration |
| 87 | [Environment variables from .env.example with descriptions] |
| 88 | |
| 89 | ## Development |
| 90 | [Dev server, test, lint, build commands] |
| 91 | |
| 92 | ## API Reference |
| 93 | [Link to API.md if applicable, or inline summary] |
| 94 | |
| 95 | ## License |
| 96 | [Detected from LICENSE file or package.json] |
| 97 | ``` |
| 98 | |
| 99 | #### Step 3 — Generate ARCHITECTURE.md (if project has 10+ files) |
| 100 | |
| 101 | Structure: |
| 102 | ```markdown |
| 103 | # Architecture |
| 104 | |
| 105 | ## Overview |
| 106 | [System diagram in text/mermaid — components and data flow] |
| 107 | |
| 108 | ## Key Decisions |
| 109 | [Detected patterns: framework choice, state management, DB, auth approach] |
| 110 | |
| 111 | ## Module Map |
| 112 | [Each top-level directory: purpose, key files, dependencies] |
| 113 | |
| 114 | ## Data Flow |
| 115 | [Request lifecycle or data pipeline description] |
| 116 | ``` |
| 117 | |
| 118 | #### Step 4 — Generate API.md (if routes/endpoints detected) |
| 119 | |
| 120 | Scan route files and extract: |
| 121 | - HTTP method + path |
| 122 | - Request parameters (path, query, body) |
| 123 | - Response shape |
| 124 | - Authentication requirements |
| 125 | - Error responses |
| 126 | |
| 127 | Format as markdown table or OpenAPI-compatible reference. |
| 128 | |
| 129 | #### Step 5 — Report |
| 130 | |
| 131 | Present generated docs to user with summary: |
| 132 | - Files generated: [list] |
| 133 | - Coverage: [what's documented vs what exists] |
| 134 | - Gaps: [code areas without docs — suggest next steps] |
| 135 | |
| 136 | ### Update Mode |
| 137 | |
| 138 | #### Step 1 — Detect Changes |
| 139 | |
| 140 | Read `git diff` since last docs update (tracked via git log on doc files or `.rune/docs-sync.json`). |
| 141 | |
| 142 | Identify: |
| 143 | - New files/modules → need new doc sections |
| 144 | - Changed functions/routes → need doc updates |
| 145 | - Deleted code → need doc removal |
| 146 | - New configuration → need config doc update |
| 147 | |
| 148 | #### Step 2 — Update Affected Sections |
| 149 | |
| 150 | For each changed area: |
| 151 | 1. Read the changed code |
| 152 | 2. Find corresponding doc section |
| 153 | 3. Update doc to match current code |
| 154 | 4. If doc section doesn't exist → create it |
| 155 | 5. If code was deleted → remove or mark as deprecated in docs |
| 156 | |
| 157 | <HARD-GATE> |
| 158 | Never silently remove doc content. If code was deleted, mark the doc section as "Removed in [commit]" or ask user before deleting the doc section. |
| 159 | </HARD-GATE> |
| 160 | |
| 161 | #### Step 3 — Generat |