|
| 1 | +--- |
| 2 | +name: update-user-docs |
| 3 | +description: Auto-update user-facing documentation when a feature or behavior change ships. Run when dev invokes manually so they can add the doc to a PR ready-for-review. Optionally pass a PR number for an already-merged PR. |
| 4 | +metadata: |
| 5 | + argument-hint: "[PR number]" |
| 6 | +--- |
| 7 | + |
| 8 | +# Update Docs |
| 9 | + |
| 10 | +Auto-update user-facing documentation when a feature or behavior change ships. |
| 11 | +If `$ARGUMENTS` is provided, treat it as a GitHub PR number. Use `gh pr view $ARGUMENTS` to get the PR diff, changed files, and description. Use this instead of the current branch context. |
| 12 | + |
| 13 | +If no argument is provided, use the current branch's diff against main, commit messages, and any linked Linear ticket to determine what changed. |
| 14 | + |
| 15 | +## When to Run |
| 16 | + |
| 17 | +On demand. Two modes: |
| 18 | + |
| 19 | +- **Current branch** — Run while on a feature branch that's ready for PR or review. |
| 20 | +- **Merged PR** — Pass a PR number to generate docs for an already-merged PR that's missing documentation. |
| 21 | + |
| 22 | +## Step 1: Gather Context |
| 23 | + |
| 24 | +### If running for the current branch |
| 25 | + |
| 26 | +Collect information from three sources: |
| 27 | + |
| 28 | +1. **Changed files** — Run `git diff main...HEAD --name-only` to identify what changed. Use file paths to determine the affected platform (see [scope-detection.md](references/scope-detection.md) for mapping). |
| 29 | +2. **Commit messages** — Run `git log main...HEAD --oneline` for a summary of what was done. |
| 30 | +3. **Linear ticket** — If a Linear ticket is linked (branch name or PR description), pull the title, description, and acceptance criteria for additional context. Use Linear MCP if available. If it's not available, prompt the dev to install Linear MCP using these instructions: https://linear.app/docs/mcp |
| 31 | + |
| 32 | +### If running for a merged PR |
| 33 | + |
| 34 | +Use the PR number to gather context via `gh`: |
| 35 | + |
| 36 | +1. **PR details** — Run `gh pr view <PR_NUMBER>` to get the title, description, and linked issues. |
| 37 | +2. **Changed files** — Run `gh pr diff <PR_NUMBER> --name-only` to identify what changed. Use file paths to determine the affected platform. |
| 38 | +3. **Linear ticket** — If a Linear ticket is referenced in the PR title, branch name, or description, pull additional context from it. |
| 39 | + |
| 40 | +## Step 2: Determine If Docs Are Needed |
| 41 | + |
| 42 | +Apply the scope detection heuristic. See [scope-detection.md](references/scope-detection.md) for the full yes/no lists and file path → platform mapping. |
| 43 | + |
| 44 | +If no docs update is needed, inform the dev and stop. |
| 45 | + |
| 46 | +## Step 3: New Page vs Update Existing |
| 47 | + |
| 48 | +1. Search existing documentation for content related to the change. See [doc-conventions.md](references/doc-conventions.md) for file locations. |
| 49 | +2. **Ask the dev:** "I found these existing pages that might be related: [list]. Should I update one of these, or create a new page?" |
| 50 | +3. Defaults: |
| 51 | + - Completely new feature with no existing coverage → new page |
| 52 | + - Extending or modifying an already-documented feature → update existing page |
| 53 | + |
| 54 | +## Step 4: Write or Update the Doc |
| 55 | + |
| 56 | +Follow the formatting rules in [doc-conventions.md](references/doc-conventions.md) (frontmatter, filenames, screenshot placeholders, cross-link integrity, side observations). |
| 57 | + |
| 58 | +If a **new page** is created, register it in navigation. See [navigation-mapping.md](references/navigation-mapping.md) for `docMap.ts` and `navigation.ts` patterns and examples. |
| 59 | + |
| 60 | +## Step 5: Verification |
| 61 | + |
| 62 | +1. Present the draft changes to the dev for review. |
| 63 | +2. List any screenshot placeholders that need filling. |
| 64 | +3. Flag any broken cross-links or stale content observed. |
| 65 | +4. **Leave all changes as unstaged modifications** — do not commit. The dev reviews and commits themselves. |
0 commit comments