--- name: authoring-docs description: Use when writing, editing, rewriting, or shortening any page on the docs site (docs/**/*.mdx), including cleanup passes on legacy pages, requests to make a page shorter, a page or entry under docs/reference/ (which has its own Next.js-style shape), and the docs page of a new integration, CI service, or migration guide (which needs the vendor's logo). metadata: internal: true --- # Authoring docs Readers skim. They read the headings, the first sentence of each section, the code blocks, and the tables, then leave. Write for that reader. Show the fast path first and fold everything else. Model pages: `docs/explore.mdx` and `docs/quickstart.mdx`. When in doubt, copy their shape. ## IMPORTANT: shorten every page **Run this pass on every page you write, edit, or rewrite, before you commit. Don't skip it for a new page or a small edit.** A first draft is always too long, and an edit that adds one paragraph often repeats a fact the page already has. On a reference page (`docs/reference/`) the pass is narrower: merge a fact said twice and keep each summary table to its minimum ([Summary tables](#summary-tables)), but cut no fact. A reference page is a lookup, so it stays complete. When the PR is about something other than docs, such as a flag rename that updates three pages, apply the cuts to the sections the change touches. List the cuts for the rest of each page as a follow-up. A whole-page restructure is its own PR, one page per PR. A page is too long when it says a fact twice, or when it is much longer than its sidebar neighbors for no reason. Measure first. Count source lines and prose words, and compare the page with its siblings: ````bash wc -l docs/integrations/*.mdx awk '/^```/{c=!c;next} !c' docs/integrations/smol.mdx | wc -w # prose, roughly ```` The word count is approximate. It misses indented fences and counts frontmatter and JSX, so compare counts only between versions of one page. List every section with its rough line count. Then sort each cut into one of three kinds, and work them in this order. 1. **Cut what the reader doesn't act on.** - How the code works inside, such as the order a provider boots machines. Keep the behavior a user sees, as one sentence where it matters. - An agent prompt that [Copy agent prompt](#copy-agent-prompt) says to skip. - Next cards the reader doesn't need next, down to the skeleton's minimum of two. Keep a guarantee the reader would otherwise doubt, even when it reads like "works as it does locally". Check whether another page says it can fail. `reference/web.mdx` says a provider without `downloads` fails, so a provider page keeps the line that downloads work. 2. **Merge what's said twice.** Each fact has one place. - A lede paragraph that previews a section becomes a link to it. - A "Before you start" whose items fit in two short sentences becomes a `Note` in the first task. Keep the section when its items need bullets, as in `docs/explore.mdx`. - A section that explains one option moves under the config that sets it. - A list and a table that describe the same fields become one table, with the details in its cells. - An options table row for an option with its own section links there. It doesn't describe the option again. - A list of limits or caveats copied from another page becomes a link to the page that owns it. 3. **Fold what only some readers need.** An optional path with its own install and example goes into an `Accordion`. The visible text keeps the rule every reader must follow. Write the target outline before you edit: the headings, and what each one holds. List moves that change other pages separately from the cuts on this page, and say if you recommend them. When the user asks how to shorten a page, show the plan before you edit. Group the items by kind. Give each item its rough savings in lines and one sentence of reason. End with the target outline and your recommendation. If an earlier pass of yours added the length, say so. Shortening adds claims. Check each new sentence: - **A caveat moves with its claim.** Cut "external state stays shared" from the lede, and "every retry starts from the same state" becomes a promise the code doesn't keep. - **A sentence that replaces three is a new claim.** Check it against `src/`. "`workers` sets how many machines run" was wrong: in `'attempt'` scope each worker slot runs a warm machine and a branch. - **A leftover fact gets a heading or gets cut.** Don't park it under the nearest heading, such as cleanup under "Options". The heading list must still lead to it. - **Every cut fact is cut on purpose.** Name each one, with its reason, in the PR body. - **Estimates run high.** Measure after the edit, with the same commands. Report the real line and word counts, before and after. ## Scope - Guides: every `docs/**/*.mdx` page except `docs/reference/`. That includes `docs/ci/`, `docs/integrations/`, and `docs/migrate/`. - Reference pages (`docs/reference/`) have their own shape: follow [Reference pages](#reference-pages), not the guide skeleton. The tone rules apply to both. - Not `skills/e2e/`. Agents read it start to finish, and the interactive components don't render there. - `unslop` still applies to every sentence. This skill adds structure and the guide-vs-reference boundary on top. Keep prose plain, human, and concrete. ## Guides vs. reference Keep user guides and API reference pages cleanly separated: - **Guides (every page outside `docs/reference/`)** teach a developer how to get something done and what behavior to expect. Don't bury readers in internal algorithms, byte caps, heuristic details, or `UPPER_SNAKE` error code lists. For accurate, non-duplicated facts, either move them to the matching `docs/reference/` page in the same PR and link there, or fold them into an `Accordion` when no reference page exists (or until a move lands). Delete only obsolete claims, repetition, and implementation steps users never act on. Diagnostic lookup tables (such as `step.cache.write` in `docs/cache.mdx`) stay where readers look them up. - **Reference (`docs/reference/`)** is the complete lookup: exact option types, defaults, limits, error codes, edge cases, and report fields live here. Guides and deep dives are the same kind of page. A walkthrough of one task (`docs/test-emails.mdx`) and an explainer of how something works (`docs/security.mdx`, `docs/self-healing.mdx`) both go in the one "Guides" group in `docs/docs.json`. Don't add a separate "Deep dive" group. ## Page skeleton ``` --- title: description: --- ## Before you start (prerequisites as bullets, if any) ## (one per task, in the order the reader does them) ## ## Next 2-4 next pages, one line each ``` - **Lede.** Define the thing in the first sentence. No "In this guide you will", no "e2e is a powerful". If the reader stops here, they still know what the page is about. - **Put the fast path first.** Before you write, ask what most readers of this page came to do: the default setup, the common command, the answer to the common question. Make that the first task section, unless an earlier task is a prerequisite. Fold the rare cases or move them down: edge cases, tuning, troubleshooting. - **Headings name a task or a question**: "Install the skill", "Start a bug bash", "What the agent does". The heading list alone is a usable table of contents. "Next" before the closing cards is the one exception. Don't use "Overview", "Introduction", "Details", or "More information". - **First sentence of each section carries the point.** The rest supports it. - **One idea per section.** If a section needs a sub-heading to hold together, it's two sections. The exception is a group of tasks under one path, like "Set up manually" in the quickstart: use one level of `###` for its tasks, never deeper. - **End with next steps**: a `CardGroup` of 2-4 cards. Each card has one line of description that says why to go there. - **Link to depth instead of repeating it**: "To read the full procedure, run `npx e2e guide bug-bash`." or "See [Starting your app](/web#starting-your-app)." ## Vendor logos The sidebar shows an icon on each group (`icon` on the group in `docs/docs.json`), never on a page. Don't set `icon:` in a page's frontmatter; `pnpm docs:check` fails on one. **A vendor page gets the vendor's logo on its cards.** A vendor page is every page under `docs/integrations/`, `docs/ci/`, and `docs/migrate/` except an `index.mdx`. Never use a Font Awesome icon for it, not even as a placeholder: - Put the logo at `docs/images/integrations/.svg`, in brand colors. Use it on every `` that links to the page. - Every vendor page also gets a card on its section's overview: `docs/integrations/index.mdx`, `docs/ci.mdx`, or `docs/migrate/index.mdx`. - A near-black mark needs a `filter: invert(1)` rule for dark mode in the site's styles, like Expo's and TestMu AI's. Say so in the PR. Take the logo from the vendor's own site or press kit, usually the favicon SVG for the mark. If you can't get a logo, stop and ask the user. Don't ship the page without one. `scripts/check-docs-logos.ts` (in `pnpm docs:check`) fails on a card without a logo or a vendor page with no overview card. ## Copy agent prompt Put a copyable prompt near the top when a coding agent can do the whole task from the page: setup, migration, a bug bash, wiring CI. Skip it when the page explains a concept, or the task is one command or one install and a config change. The import path is relative to the page. Use `./snippets/` for a top-level page and `../snippets/` for a page in `docs/ci/`, `docs/integrations/`, or `docs/migrate/`. ```mdx import { SetupPrompt } from './snippets/setup-prompt-card.jsx'; export const setupPrompt = `. Docs: \`https://e2e.com/docs/.md\` 1. 2. ...`; ``` - Link the page's `.md` URL so the agent can read the rest. - Numbered steps, one action each. Tell the agent when to stop and ask the user, for example to choose a model or to sign in. - End on a check the agent can run: "run the test and fix errors until it passes". - After the prompt, put the manual path under its own heading, such as "Set up manually". ## Showing less at one time Fold content that most readers don't need. Choose the component by the question the reader asks: | The reader... | Use | Example | | --- | --- | --- | | picks one of several paths (platform, provider, OS) | `Tabs` | Web / Mobile, Subscription / API key | | picks a package manager | `CodeGroup` with `npm`, `pnpm`, `bun` | every shell block that runs `npx` or `npm install`/`ci`, checked by `docs:check` | | follows an ordered setup | `Steps` | Quickstart "Run your first test" | | may want a full example or edge case | `Accordion` | "Example web config and test" | | may want a long procedure that isn't the point of the page | `ShowMore` | Bug bash "What the agent does" | | compares 3+ options with the same fields | table | plan -> login command | | must not miss a requirement | `Note`, at most one per section | Node.js version | | can lose data or leak a secret | `Warning` | unmasked video with a typed password | | wants to see the result | `Video` with a one-line caption | `init` recording | Rules: - The text that stays visible must make sense without the folded part. - Don't put the only copy of a required step inside an `Accordion` or `ShowMore`. - Don't nest tabs in tabs. An `Accordion` inside a `Tab` is fine. - Give a `ShowMore` a unique `id`. - Indent a bullet list inside an indented component at least as far as the component's tags, as the `` blocks in `docs/mobile.mdx` do. A closing tag indented as far as the text after a `- ` marker joins the last list item, even across a blank line, so the component never closes and the page doesn't compile as MDX. `pnpm docs:check` fails on it. - About one screen of visible content between two headings. If more, fold it, cut it, or split the section. ## Tone: plain developer English Write the way a helpful senior engineer explains something to a teammate: clear, direct, and natural. Avoid both marketing fluff and robotic spec-manual prose. Do: - **Write naturally.** Use contractions (`don't`, `it's`, `doesn't`, `you'll`) and natural phrasing (`once`, not `one time`; `otherwise`, not `Else`; `doesn't call a model`, not `makes no model calls`). - **Keep `"that"` when dropping it makes a reader backtrack.** Write "the tests that a filter skipped" instead of "the tests a filter left out". - **Vary sentence length.** Keep procedures crisp (one step per sentence), but let explanatory sentences breathe so paragraphs don't read like a staccato list of 10-word stubs. - **Use active voice and present tense**: "e2e downloads a browser", not "A browser will be downloaded." Say `e2e` instead of `the runner` in guides unless the distinction matters. - **Put the condition first**: "In CI, e2e ignores `reuseExisting`. Use port `0` instead." - **Keep paragraphs short** (1-3 sentences) and put the main point first. - **Stay consistent on terminology.** A step is a step, a run is a run. Don't rotate synonyms for variety. - **Prefer plain words**: | Write | Not | | --- | --- | | use | utilize, leverage | | make sure | ensure | | start, stop | initiate, terminate | | show | display | | check | inspect, verify (for a reader's action) | | about | approximately | | once | one time | | otherwise | else (in prose) | | to | in order to | | if, when | in the event that | | (cut) | simply, just, easily, seamlessly, powerful, load-bearing | Avoid: - **Implementation leaks in guides.** Don't dump internal algorithms, byte/line truncation thresholds, or heuristic rules into top-level guide prose. Move accurate facts to `docs/reference/` and link there, or fold them into an `Accordion` if the topic has no reference page. - **Error code dumps in guides.** Say what happens ("e2e stops with a config error") instead of sprinkling `UPPER_SNAKE` codes into every paragraph. Leave exact codes to `docs/reference/errors.mdx` and reference tables. - **Edge-case sections before the happy path.** At the section level, show the common workflow first and move rare edge cases down or into an `Accordion` or reference page. Within a sentence, still put the condition first and keep any caveat right beside its claim. - **Em dashes, en dashes, or spaced hyphens as dash substitutes.** Use periods, commas, or colons. Before and after: ``` Before: In order to ensure that your app is able to handle multiple explorers simultaneously, you'll want to either reuse an existing server or configure a dynamic port. After: Make sure your app can serve several explorers at once. Either start the app once with `reuseExisting: true`, or use port `0`. ``` ``` Before: A log of up to 40 lines inside 8 KiB is quoted whole; otherwise the quote keeps up to 20 lines from each end, with `[startup output omitted]` between them, and for a log past 8 KiB those lines come from its first and last 4 KiB. After: e2e quotes short logs in full and trims longer ones to the start and end. See the command reference for the exact truncation limits. ``` ## Rewriting a legacy page A cleanup is a rewrite of the shape, not a copy edit. Keep every fact, cut every repetition. 1. **List the facts.** Read the page and note every claim, option, default, and caveat. This is the content you must keep. 2. **Check the facts against `src/`.** Status prose drifts, as the Gotchas in `AGENTS.md` say. Fix or delete claims that no longer hold, including "not implemented yet" callouts. 3. **Find the reader's tasks.** Each task becomes a heading, in the order the reader does them. Facts that serve no task go to a reference page or a card link, or are cut. When the tasks don't depend on each other, put the fast path first. 4. **Write the lede and headings first.** Read them alone. If they don't explain the page, fix them before writing the body. 5. **Fold.** Apply the component table. Long examples go into an `Accordion`, alternatives into `Tabs`, background procedures into `ShowMore`. 6. **Apply the tone rules** sentence by sentence, then run `unslop`. 7. **Add a copy agent prompt** if an agent can now do the whole task and [Copy agent prompt](#copy-agent-prompt) doesn't say to skip it. 8. **Keep URLs and anchors stable.** When you rename a heading, update every link to its anchor. Search for `/#` across `docs/`, `skills/`, `README.md`, and `packages/*/src`. Also search the page itself for `](#)` and `href="#"`. If a page moves, add a redirect in `docs/docs.json`. 9. **Shorten.** A page in the right shape can still say things twice. Run the pass in [IMPORTANT: shorten every page](#important-shorten-every-page). 10. **Compare.** The new page is shorter on screen. Every fact from step 1 is still on it, folded, or linked, or it was cut on purpose and the PR body names it with the reason. One page per PR. The reviewer compares old and new side by side. ## Reference pages Pages under `docs/reference/` follow the Next.js API reference shape (`nextjs.org/docs/app/api-reference`). A reader looks a member up in a table at the top and finds its details one click down. Model pages: `docs/reference/app.mdx` (one group) and `docs/reference/screen.mdx` (several groups). ```` --- --- ```ts title="tests/.e2e.ts" ``` ## Reference ### (only when the page has more than one group) | Method | Returns | (summary table, one row per entry, linked) #### (### on a one-group page) ## (explanatory sections, after Reference) ## Types ## Examples ## Related ```` ### Headings - The first `##` after the lede is always `## Reference`, on every page. Never Members, Methods, Entry points, or Overview there. Groups under it name what they hold: Queries, Options, Hooks, Commands. - The site gives `##` to `####` an anchor and a line in "On this page". `#####` gets neither. So entries are `###` on a one-group page and `####` on a page with several groups. - An entry's sub-part that lands at `#####` and is linked from anywhere gets `` on the line before it. `node scripts/check-docs-anchors.ts` counts that id. - Explanatory sections (rules, behavior, budgets, setup, installing) come after `## Reference` as `##`, then `## Types`, `## Examples`, `## Related`. - Heading text that anything links to keeps its exact words. Slugs drop backticks and turn dots into hyphens (`agent.act` is `#agent-act`); a backticked camelCase name stays one word (`renderMarkdownReport` is `#rendermarkdownreport`). ### Summary tables Each group opens with one table, one row per entry. Keep it to the minimum: | Kind | Columns | | --- | --- | | methods, members, functions, fixtures | `Name \| Returns` | | options and fields | `Option \| Type \| Default` | | commands, tools, hooks, matchers, reporters | `Name \| Description` | - The first column is the name, linked to its entry. - No Example column. The lede and every entry show one. - A default is a bare value, `-`, or at most four words (`0`, `1` in CI). A description is at most six words. - No cell over about 40 characters, no sentences, no explanations in parentheses. Detail goes in the entry. - A data table that is the only home of its facts (environment variables, error codes, a capability matrix) is not a summary table. It keeps its columns. ### Entries - First sentence: what it is or what it does. - A short example. Show a default as a code comment: `// default: 5000`. - Accepted values as a list or a table. Errors as a `| Throws | When |` table. - At most one ``. `` only for data loss or a leaked secret. - TypeScript declarations show signatures and types only, with no JSDoc, in the entry or under `## Types`. A default, limit, unit, or error goes in the entry's prose or tables, stated once. - No Version History section; nothing reliable feeds it. ### Keep every fact - A rewrite or a trim keeps every option, default, error code, limit, and caveat. When you shorten a table cell, the fact must already be in the entry, or you add it there. - Add no claim the old page or the source (`packages/*/src`) does not make. Check a default or a "Throws" condition in the source before you write it. ## Translations `docs//.mdx` translates `docs/.mdx`: `docs/ja/` is Japanese, `docs/zh/` Simplified Chinese, `docs/cs/` Czech, `docs/es/` Spanish, `docs/pt/` Brazilian Portuguese, `docs/hi/` Hindi, `docs/fr/` French, `docs/pl/` Polish, `docs/id/` Indonesian, and `docs/uk/` Ukrainian. Each language's README ([`docs/ja/README.md`](../../../docs/ja/README.md), [`docs/zh/README.md`](../../../docs/zh/README.md), [`docs/cs/README.md`](../../../docs/cs/README.md), [`docs/es/README.md`](../../../docs/es/README.md), [`docs/pt/README.md`](../../../docs/pt/README.md), [`docs/hi/README.md`](../../../docs/hi/README.md), [`docs/fr/README.md`](../../../docs/fr/README.md), [`docs/pl/README.md`](../../../docs/pl/README.md), [`docs/id/README.md`](../../../docs/id/README.md), [`docs/uk/README.md`](../../../docs/uk/README.md)) has its rules, style, and glossary. Translations are best effort. English is the source of truth and every change keeps it current; translations can lag behind, and no contributor is expected to update a language they don't speak. - An English change needs no translated change: not prose, not a heading, ``, ``, or `id`, not a new page, and not a new tab or group in `docs.json`. The site serves the stale translation, falls back to the English page where none exists, and to the English label where `docs//navigation.json` has none. - Moving or deleting an English page moves or deletes its translations too, and renaming an anchor fixes the `#anchor` links to it in the translations. Neither needs the language, and `pnpm docs:check` fails on a translation with no English page or a link whose English target is gone. - When you do edit a translation, follow its README and bring it in line with the English page: the same outline (the site gives a translated page the English page's heading, tab, and accordion ids by position, and gives one whose outline differs ids of its own, so its `#anchor` links and the language switcher miss until it is back in line) and the same code blocks. `pnpm docs:check` (`scripts/check-docs-translations.ts`) warns, without failing, on every page and label that is behind. - After you apply a review suggestion on wrapped prose, reread the whole paragraph against the English page. `pnpm docs:check` catches only a leftover repeated tail, not a deleted sentence. ## Before you commit - [ ] On a reference page: the first `##` is `## Reference`, every summary table follows [Summary tables](#summary-tables), and no linked anchor was lost. - [ ] **IMPORTANT:** the shortening pass ran on this page (on a reference page, its narrower form: duplicates merged, no fact cut). It was measured against its neighbors before and after, and every new or merged sentence was checked against `src/`. - [ ] Reading only the headings and first sentences explains the page. - [ ] The lede defines the thing in its first sentence. - [ ] The first task section is the fast path most readers came for, unless an earlier task is a prerequisite. Rare cases are folded or come later. - [ ] No section shows much more than one screen without folding. - [ ] Every shell block that runs `npx` or `npm install`/`ci` is a `CodeGroup` of npm, pnpm, bun. - [ ] A bullet list inside an indented component is indented at least as far as its tags ([Showing less at one time](#showing-less-at-one-time)), and `pnpm docs:check` passes: it compiles every page as standard MDX. - [ ] Code blocks are real or clearly fragments. A full example lives in `docs/examples/`, has an entry in `EXAMPLES` in `scripts/check-docs-examples.ts`, and typechecks with `pnpm --filter @e2e-dev/docs typecheck`. - [ ] Status claims checked against `src/`. - [ ] No `icon:` in the frontmatter. - [ ] A vendor page (`docs/integrations/`, `docs/ci/`, `docs/migrate/`) has the vendor's logo on every card that links to it ([Vendor logos](#vendor-logos)) and a card on its section's overview. - [ ] Links and anchors resolve. Moved pages have redirects. - [ ] A moved or deleted English page took its translations in every `docs//` folder with it ([Translations](#translations)). - [ ] `pnpm docs:check` passes.