Files
Miranda LimonczenkoandClaude Opus 5 c7534b9e29 docs: document the stacked PRs workflow in edit-the-docs (#50018)
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>
2026-09-11 14:26:34 -07:00
..