mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
Closes DOCS-1381 ## Problem The `edit-the-docs` skill describes a page edit as one continuous pass and has no notion of output. No commits, no branches, no PRs. It ends at edited files in the working tree. That leaves a reviewer one diff that mixes reworded prose, moved sections, and corrected claims, where a move can't be told from a rewrite. ## Solution - **Split the edit by change type:** style, structure, technical revision, and additions. Style runs before structure, so the structure diff reads as pure moves against already-clean prose. - **Ship one PR, one change type per commit.** A stack of PRs is an ask, not a default. When the edit both rewrites prose and moves sections and runs over roughly 150 changed lines, the skill says how large the diff is and offers the split. The requester decides, and no answer means one PR. A stack buys clean per-type diffs, and it costs a reviewer the whole-edit view, since no PR page shows it. - **State the scope boundary once.** The edit is exactly the buckets that have content. A dropped bucket is beyond the edit, and a later request for that change type is a new request. Additions stay author-driven, which keeps a mid-edit request from reopening an earlier commit. - **Scope the technical pass with a wrong-outcome test.** A claim changes only when leaving it would hand the reader an error, a different result than the page promises, or a fact that isn't true. An external best-practices rule doesn't clear that gate on its own, and a missing safeguard is an absence, so it goes to additions. Without the test, a verification pass becomes a rewrite. - **Add `reference/stacked-prs.md`** for the `gh stack` commands, branch naming, restack auditing, and the one command that diffs a whole stack at once. ### What driving the skill on a real page changed Running it end to end on a 684-line guide, then shipping the result, corrected five things a read-through didn't: - **The anchor gate grepped the wrong scope.** It said `apps/docs/content`. Five of the seven inbound anchors to that page lived outside it, in Studio components and `apps/www`, and those are the matches that break a Docs button in the product. The gate is now repo-wide and is step 1 of the structure pass, because moving a section preserves its slug and only renaming breaks it. That's what makes an aggressive regroup safe. - **Grouping sections by subject doesn't work.** On a page about tables every section is about tables, so subject grouping produces one task-named bucket that collects the background too. Classification is now by what the reader is doing, and the skill carries the outline that page settled on. - **Snippet testing finds claims, it doesn't just confirm them.** One example re-created a table an earlier example had made, which stopped that block and left a third example referencing a table nothing ever created. Every fence was individually correct; the sequence was not. So the rule is to run every fence in document order, because that order is what the reader pastes. - **Restacking silently drops upper-branch edits.** The conflict presents as new structure versus old content being re-added, and resolving toward the structure takes the edit with it. `stacked-prs.md` says to audit each branch with a grep per expected change rather than reading the diff. - **`build:guides-markdown` dirties a tracked file.** It writes `apps/docs/public/markdown/manifest.json`, which the repo commits as `[]`. Without a note the artifact lands in the next commit. ## Manual testing 1. Open `.agents/skills/edit-the-docs/SKILL.md` and read Phase 0. You can tell whether to ship one PR or offer a stack, and what to say when offering it, without opening the reference file. 2. Read the PR 3 section. The wrong-outcome test, the external-rule tiebreaker, and the absences line together tell you where a best-practices violation goes. 3. Run `npx prettier --check .agents/skills/edit-the-docs apps/docs/CONTRIBUTING.md`. Reports all matched files use Prettier code style. 4. Run `cat .claude/skills/edit-the-docs/reference/stacked-prs.md`. The branch table resolves through the `.claude/skills` symlink and shows `4+` as a pattern. 5. Run `git diff master -- .agents/skills/write-the-docs/SKILL.md`. Reports no changes, so nothing in `write-the-docs` routes a drafter into this workflow. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Documentation** - Updated guidance for editing existing documentation through distinct style, structure, technical, and additions phases. - Added work-sizing, scope, validation, confirmation, and handoff rules for stacked pull requests. - Documented support for multiple topic-based additions branches and their merge order. - Clarified when to use drafting versus editing workflows, including when a draft becomes a restructure. - Improved guidance for validating code examples, checking repository-wide references, handling generated artifacts, and updating pull request titles. - Updated contributor guidance and related documentation references. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
75 lines
5.0 KiB
Markdown
75 lines
5.0 KiB
Markdown
# Stacked PRs for a page edit
|
|
|
|
Mechanics for shipping the [`edit-the-docs`](../SKILL.md) buckets as a stack. **A stack is the exception, and the requester approves it.** Phase 0 covers when to offer one. This file covers how to build and submit it once they agree.
|
|
|
|
## Branch names
|
|
|
|
One branch per change type, bottom to top:
|
|
|
|
| PR | Branch |
|
|
| --- | ---------------------------- |
|
|
| 1 | `docs/<page>-style` |
|
|
| 2 | `docs/<page>-structure` |
|
|
| 3 | `docs/<page>-technical` |
|
|
| 4+ | `docs/<page>-<what-it-adds>` |
|
|
|
|
The first three names are fixed, because there's one of each. **Additions get one branch per topic, named for the content it adds:** `docs/tables-rls` and `docs/tables-datatypes`, not `docs/tables-additions-1` and `-2`. Use `docs/<page>-additions` when a single branch carries all of them.
|
|
|
|
**Create only the branches whose buckets have content.** Two branches is the common shape once an edit clears the gate. `gh stack init` takes however many you pass it.
|
|
|
|
**Use a category prefix and a short second segment.** Don't prefix a branch with an author name, even when a tracker suggests that format.
|
|
|
|
**Get every name right before you submit.** Renaming a branch that already has an open PR closes the PR rather than retargeting it, and a closed PR whose head ref is gone can't be reopened. Recovering costs the PR number and its CI history.
|
|
|
|
## Build the stack with gh stack
|
|
|
|
Never chain `gh pr create --base <previous-branch>`. That produces correct base branches but no GitHub stack. There's no stack number and no stack UI, so reviewers see several unrelated-looking PRs instead of one series.
|
|
|
|
1. `gh stack init <bottom> <middle> <top>` adopts existing branches, bottom to top. This is local only and makes no remote change.
|
|
2. `gh stack view` confirms the structure and shows the mapped PR for each branch.
|
|
3. `gh stack submit --auto` pushes and registers the stack on GitHub. Use `--auto` in a non-interactive session, where the editor can't open. New PRs are created as drafts unless you pass `--open`.
|
|
|
|
**Check the titles after submitting.** `submit` can title a PR from its branch name rather than its commit subject. Fix any that came out wrong with `gh pr edit <pr> --title`.
|
|
|
|
**Safe to re-run on PRs that already exist.** `submit` reports each one "up to date" and reuses it, so PR numbers, descriptions, and creation timestamps survive.
|
|
|
|
**Draft state doesn't reliably survive.** `--open` marks existing PRs ready for review, not just new ones, and a resubmit has been observed taking drafts out of draft without it. Check the draft state of every PR after submitting, and set it back with `gh pr ready --undo` if it moved.
|
|
|
|
**Other commands.** `gh stack link <pr> <pr> <pr>` registers the GitHub stack without local tracking. `gh stack unstack` removes a stack. The extension is `github/gh-stack`.
|
|
|
|
## Reading the stack as a whole
|
|
|
|
No PR page shows the whole edit, so a reviewer who wants it in one view needs the command:
|
|
|
|
```bash
|
|
git diff master...<top-branch> -- <path>
|
|
```
|
|
|
|
`gh stack view` lists the branches in order, so it gives you the top one. Put the command in the bottom PR's body. Without it the reviewer reconstructs the edit branch by branch, and that cost is why Phase 0 defaults to a single PR.
|
|
|
|
## Restacking after a change low in the stack
|
|
|
|
`gh stack rebase` replays every branch above the one you changed. Where a lower branch moved content that an upper branch also edited, git raises a conflict whose two sides are "the new structure" and "the old content being re-added". Resolving toward the new structure is usually right, and it silently drops the upper branch's edit along with the stale copy.
|
|
|
|
**Assume that happened. Audit rather than read the diff.** Before pushing, grep each branch for a marker of every change it is supposed to carry:
|
|
|
|
```bash
|
|
git show <branch>:<path> | grep -c '<marker>'
|
|
```
|
|
|
|
One marker per change, checked against the count you expect. A restructure large enough to conflict is large enough that reading the diff will not catch a missing paragraph.
|
|
|
|
Restore anything missing as a new commit on the branch that owns it, then rebase again. Don't fold it into a neighboring branch to avoid a second rebase; that breaks the one-change-type-per-PR rule the stack exists for.
|
|
|
|
## Merge order
|
|
|
|
Merge bottom-up: `master`, then PR 1, then PR 2, then PR 3, then each additions branch in stack order. This is the model [`review-the-docs`](../../review-the-docs/SKILL.md) uses to review a stack, so the authoring and review sides share one vocabulary.
|
|
|
|
## PR bodies
|
|
|
|
Each body states which change type the PR carries and what it leaves to the PRs above it. That tells a reviewer the diff is narrow on purpose. Reworded prose isn't missing from the structure PR, it already landed below.
|
|
|
|
Carry forward anything you flagged while working: inferred claims from PR 3, gaps you named but didn't fill, and stale values you couldn't verify. Those belong in the description, not in the MDX.
|
|
|
|
For general PR-body mechanics, see [`create-pull-request`](https://github.com/supabase/docs-agent-skills/blob/main/.claude/skills/create-pull-request/SKILL.md).
|