|
| 1 | +# /write-docs |
| 2 | + |
| 3 | +Create a new documentation PR from a docs-request triaged issue. Writes |
| 4 | +MDX guide pages, `.ai/wheels/` references, or `CLAUDE.md` updates as |
| 5 | +appropriate, then opens a draft PR against `develop`. This stage is the |
| 6 | +docs-path counterpart to propose-fix — it bypasses the TDD invariant |
| 7 | +since docs-only PRs have nothing to spec. |
| 8 | + |
| 9 | +## Rails |
| 10 | + |
| 11 | +Read `.claude/commands/_shared-rails.md` first. Highlights for this command: |
| 12 | + |
| 13 | +- Use `gh` for GitHub state, full `git` for **your branch only** (the |
| 14 | + caller workflow has created `docs/bot-<issue>-<slug>` for you and you |
| 15 | + are checked out on it). |
| 16 | +- **Filesystem writes are scoped to doc paths only**: |
| 17 | + `web/sites/guides/**`, `.ai/wheels/**`, `CLAUDE.md`, `CHANGELOG.md`. |
| 18 | + **Do NOT modify any file under `vendor/wheels/**`, `app/**`, |
| 19 | + `tests/**`, `vendor/wheels/tests/**`, `.github/**`, `cli/**`, or |
| 20 | + `config/**`** — this is a docs-only stage. The TDD gate skips this |
| 21 | + branch class precisely because docs PRs don't need specs. |
| 22 | +- Output is **one draft PR** against `develop` plus one comment on the |
| 23 | + issue. |
| 24 | + |
| 25 | +## Args |
| 26 | + |
| 27 | +- `<issue-number>` — the docs-request issue to write docs for |
| 28 | + |
| 29 | +## Steps |
| 30 | + |
| 31 | +1. **Idempotency check.** Read existing comments on the issue via |
| 32 | + `gh issue view <issue-number> --json comments`. If any comment |
| 33 | + contains `<!-- wheels-bot:write-docs:<issue-number> -->` or |
| 34 | + `<!-- wheels-bot:docs-held:<issue-number> -->`, exit silently — docs |
| 35 | + have already been written or the safety net already held them. |
| 36 | + |
| 37 | +2. **Read the authoritative context.** |
| 38 | + - The triage comment (marker `wheels-bot:triage:<issue-number>`) — |
| 39 | + gives you the docs scope and confidence assessment. |
| 40 | + - The issue body — original wording on what's needed. |
| 41 | + - Any human follow-up comments — they may refine the scope. |
| 42 | + |
| 43 | + If no triage comment exists, exit with a comment explaining no triage |
| 44 | + was found. |
| 45 | + |
| 46 | +3. **Read the supporting context.** |
| 47 | + - `CLAUDE.md` § "Commit Message Conventions" — type `docs`, allowed |
| 48 | + scopes (`docs`, `web/guides`, `web/landing`, `web/blog`, etc.). |
| 49 | + - `web/sites/guides/src/content/docs/v4-0-0-snapshot/` — browse the |
| 50 | + existing structure to find the right place for the new content. |
| 51 | + - One or two existing pages in the same area for style/depth |
| 52 | + reference. Match existing tone (no emoji unless the surrounding |
| 53 | + pages use them). |
| 54 | + |
| 55 | +4. **Auto-downgrade safety net.** Before writing anything, check whether |
| 56 | + the work would: |
| 57 | + - Touch more than ~5 files (signals over-broad scope) |
| 58 | + - Require creating a new top-level section (vs. extending existing) |
| 59 | + - Demand significant code-reading to write accurately (signals the |
| 60 | + issue is really `framework-design`, not `docs-request`) |
| 61 | + - Need real screenshots that the bot cannot produce (these become |
| 62 | + placeholders; see step 6) |
| 63 | + |
| 64 | + If the scope feels too big to write cleanly, **stop**. Post a comment |
| 65 | + on the issue: |
| 66 | + |
| 67 | + ``` |
| 68 | + ## Wheels Bot — Docs work on hold for human review |
| 69 | +
|
| 70 | + The proposed docs scope is larger than this stage handles cleanly |
| 71 | + (<one-line reason>). A human should plan the structure before the |
| 72 | + bot writes content. |
| 73 | +
|
| 74 | + <!-- wheels-bot:docs-held:<issue-number> --> |
| 75 | + ``` |
| 76 | + |
| 77 | + Then exit. |
| 78 | + |
| 79 | +5. **Decide what to write.** Based on the triage scope and the issue body, |
| 80 | + pick targets: |
| 81 | + |
| 82 | + - **MDX guide page(s)** under |
| 83 | + `web/sites/guides/src/content/docs/v4-0-0-snapshot/`. If the issue |
| 84 | + is about a feature or subsystem, look for the right `<area>/` |
| 85 | + (e.g. `working-with-wheels/`, `digging-deeper/`, |
| 86 | + `command-line-tools/`). Add to an existing page where possible; |
| 87 | + create a new page only when no existing page covers the area. |
| 88 | + - **`.ai/wheels/<layer>/`** — only if the docs change documents a |
| 89 | + pattern or convention an AI agent should know about. Most user- |
| 90 | + facing docs do NOT need a corresponding `.ai/` update. |
| 91 | + - **`CLAUDE.md`** — only if the change is about a top-level convention |
| 92 | + or critical anti-pattern. Most docs PRs do NOT touch `CLAUDE.md`. |
| 93 | + |
| 94 | +6. **Write conservatively.** |
| 95 | + - Read the existing page (if extending) before editing. |
| 96 | + - Match the existing style: heading depth, code-fence language tags, |
| 97 | + prose tone. |
| 98 | + - **For features that benefit from screenshots:** insert a placeholder |
| 99 | + comment in the MDX where the screenshot belongs: |
| 100 | + |
| 101 | + ```mdx |
| 102 | + {/* screenshot: short description of what to capture, e.g. |
| 103 | + "Debug Panel — Packages tab showing both installed and |
| 104 | + available-from-registry tables" */} |
| 105 | + ``` |
| 106 | + |
| 107 | + The bot cannot capture screenshots itself (no headless browser |
| 108 | + available in the runner). The PR description (step 8) will list |
| 109 | + these placeholders so a human can capture and replace them. |
| 110 | + - Add a `CHANGELOG.md` `[Unreleased]` entry. One line, present |
| 111 | + tense, no PR number. |
| 112 | + |
| 113 | +7. **Stage and commit.** |
| 114 | + |
| 115 | + Conventional commit. Type `docs`. Scope from the allowlist: |
| 116 | + - `web/guides` for changes under `web/sites/guides/src/content/docs/` |
| 117 | + - `docs` for `.ai/wheels/` changes |
| 118 | + - no scope for `CLAUDE.md` or mixed paths |
| 119 | + Subject ≤ 100 chars, sentence-case. |
| 120 | + |
| 121 | + Examples: |
| 122 | + - `docs(web/guides): add Debug Panel guide outlining each feature` |
| 123 | + - `docs(web/guides): document scope on findOne nested includes` |
| 124 | + |
| 125 | + ```bash |
| 126 | + git add <files> |
| 127 | + git commit -m "<message>" |
| 128 | + ``` |
| 129 | + |
| 130 | + The caller workflow handles the actual `git push` — just commit |
| 131 | + cleanly. Do **not** use `--amend` or `--force`. |
| 132 | + |
| 133 | +8. **Open the draft PR.** Use `gh pr create --draft --base develop`. The |
| 134 | + PR body must: |
| 135 | + |
| 136 | + - Open with one paragraph naming what was added/changed and why. |
| 137 | + - Include `Fixes #<issue-number>`. |
| 138 | + - **List screenshot placeholders** if any were inserted. Format: |
| 139 | + |
| 140 | + ```markdown |
| 141 | + ## Screenshots needed |
| 142 | + |
| 143 | + This docs PR includes screenshot-placeholder markers that a human |
| 144 | + reviewer can replace with captured images: |
| 145 | + |
| 146 | + - `<file>:line` — `<description from the placeholder>` |
| 147 | + - ... |
| 148 | + |
| 149 | + The bot cannot run the app or capture images — these are |
| 150 | + intentional gaps for a human follow-up. |
| 151 | + ``` |
| 152 | + |
| 153 | + - End with the marker `<!-- wheels-bot:write-docs:<issue-number> -->`. |
| 154 | + |
| 155 | +9. **Self-check before opening.** Do NOT open the PR if any check fails: |
| 156 | + - [ ] No files changed outside doc paths (`web/sites/guides/`, |
| 157 | + `.ai/wheels/`, `CLAUDE.md`, `CHANGELOG.md`) |
| 158 | + - [ ] At least one doc file changed (don't open empty PRs) |
| 159 | + - [ ] Commit message is conventional and ≤ 100 chars |
| 160 | + - [ ] PR body includes `Fixes #<issue-number>` |
| 161 | + - [ ] PR body includes any screenshot-placeholder list |
| 162 | + - [ ] PR is created with `--draft` |
| 163 | + - [ ] Marker is present in PR body |
| 164 | + |
| 165 | + If any check fails: do not open the PR. Comment "no docs proposed" |
| 166 | + on the issue and exit non-zero. |
| 167 | + |
| 168 | +10. **Comment back on the issue** with a link to the PR: |
| 169 | + |
| 170 | + ``` |
| 171 | + ## Wheels Bot — Docs proposed |
| 172 | + |
| 173 | + Draft PR: <link> |
| 174 | + |
| 175 | + Pages updated: <list> |
| 176 | + Screenshots needed: <count, or "none"> |
| 177 | + |
| 178 | + A human review is required before merge. Reviewer A and Reviewer B |
| 179 | + will weigh in shortly. |
| 180 | + |
| 181 | + <!-- wheels-bot:write-docs:<issue-number> --> |
| 182 | + ``` |
| 183 | + |
| 184 | + Then exit. |
0 commit comments