Skip to content

ADR-030 — Spec renderers: generated component pages and a Figma parity check

Date: 2026-11-10 Status: accepted Amended: 2026-11-19

Context

ADR-027 split each component’s contract into <Name>.metadata.json (how to use it) and <Name>.spec.json (how to build it). Both files gate code review and steer the agents, but no human-facing page shows them. The docs site (ADR-022) publishes only the reference pages and ADRs, and Storybook Autodocs covers the API, not usage guidance, anatomy or tokens per part. On the Figma side, all checks run through /figma-cli or MCP snapshots; nothing tells a designer, inside Figma, that a component set no longer matches the code contract.

The plan (.claude/handoff/2026-11-05-spec-renderers.handoff.md) proposes two deterministic renderers over one shared input: generated component pages on the docs site (Part A) and a Figma plugin that checks parity and then draws spec sheets (Part B). It left twelve decisions open. This ADR records them.

Decision

One shared bundle, built, not committed. npm run spec:bundle writes specs.bundle.json: every spec with its metadata, resolved token values, Figma variable names and a per-component hash. It is derived and deterministic, so the docs build and the plugin build regenerate it; nothing reads it from the repo. The build fails when a styles token path doesn’t resolve. Committing it would add a staleness gate for no reader.

Part A: dynamic StarlightPage routes, three sub-pages behind link tabs. One apps/docs/src/pages/components/[name]/[...tab].astro (see the Phase A1 amendment) renders Usage (bare URL), Spec and Accessibility from the bundle. Tabs are links with aria-current="page", M3-style, so each sub-page has its own URL, table of contents and search entry. Rejected: a custom content-collection loader (awkward for three pages per component), Starlight <Tabs> on one page (no URL per tab, hidden headings in the TOC), and a single long page. No Figma columns on the web pages; those belong on the Figma sheets. No generated markdown is committed, and the pages sit outside docs-check and /docs-sync because they are rebuilt from the spec.

Anatomy parts are marked in rendered HTML with data-part. Each anatomy[].name appears as data-part="<name>" on its element: the code equivalent of ADR-023’s rule that part names equal Figma layer names, and the same pattern as Ark UI / Zag.js (data-part) and shadcn/ui (data-slot). Bare-text parts such as Button’s Label are wrapped in an element. A render test renders each component and fails when a declared part is missing; a static grep of index.tsx was rejected because it can’t tell whether the part actually renders. Optional parts are switched on by a new optional spec field (working name anatomyProps) holding the props that render every part; the render test, the anatomy overlay and the plugin all read it from the bundle. A dedicated Storybook story was rejected because it would make the test and the docs depend on story files.

Anatomy diagram: live component with an SVG overlay, leaning, confirmed or replaced by the Phase A2 spike. The docs site renders the real component with @astrojs/react and draws numbered markers from data-part positions. If CardVertical’s 21 markers don’t read clearly, it falls back to a Mermaid tree plus top-level markers; the spike records which ships.

Per-component decisions live in the spec. Two optional spec.json fields: decisions[] ({ decision, reason?, adr? }) and ruledOut[] ({ option, reason, source? }). spec:validate checks that every adr resolves to a file in docs/decisions/. They are backfilled by hand with TODOs, read by the docs (Spec → “Why it’s built this way”) and by /review-component, and kept out of /component-scaffold’s context (ADR-013). No dates; git history has them. This keeps small per-component choices out of the ADR set, which stays small.

Part B: a flag-only Figma parity plugin.

  • Workspace: apps/figma-parity, a consumer like apps/showcase; nothing imports it.
  • Working name: “Figma parity”. It’s named after the check, not the sheets.
  • Rules: token-binding, prop-coverage, part-names, stale-sheet.
  • v1 never writes to the published library’s components. Fixes go through /figma-cli and the fidelity decision path. A per-finding “bind to spec token” action is a v2 candidate.
  • Spec sheets: drawn on a dedicated Specs page that links back to each component set, not next to the sets, so the published library layout is untouched. Each sheet frame carries setPluginData('specSheet', …), so regenerating replaces it instead of duplicating it.
  • Results: exported as .claude/figma-parity.json, a frozen snapshot next to the others. sense.js reads it, and npm run status warns when the capture is older than the last spec change.

Consequences

  • The public docs can’t drift from the component: they are rendered from the file every check reads. The cost is that usage guidance must be written as structured data in metadata, not as prose on a page.
  • data-part becomes an implementation convention every component must follow, enforced by the render test. Adding a part to anatomy[] without marking it in code fails CI.
  • ADR-027 is amended, and the spec schema changes, when anatomyProps, decisions[] and ruledOut[] land, together with a line in packages/components/AGENTS.md. That amendment ships with the schema change, not before.
  • docs-build.yml gains spec files and the bundle script as triggers.
  • Figma drift becomes visible in npm run status and agent context without CI ever calling Figma. The cost is that the snapshot is only as fresh as the last manual plugin run, hence the staleness warning.
  • The plugin is loaded by hand in Figma desktop; no agent or CI can run it. Plugin API access on the current plan (local variables, boundVariables, componentPropertyDefinitions) is verified in Phase B0 before plugin code merges. If it isn’t available, Part B is amended or dropped here.
  • This ADR is amended when Part B starts, rather than superseded by a separate ADR.

Amendment (2026-11-10) — The examples field is a list of props or patterns

The schema step renamed the working field anatomyProps to anatomyExamples and changed its shape: a list of entries, each either root props or a metadata usage.patterns name. A single set of props can’t render CardVertical’s parts, because they are written in JSX, and it can’t show parts that exclude each other (Favorite or Menu in one Action slot). The field is specified in the ADR-027 amendment of the same date. Two parts no example can render are left to the render-test step: CardVertical’s MenuPanel (opens on interaction) and TextField’s Placeholder (a pseudo-element).

The backfill doesn’t use TODO placeholders, as the Decision section implies: a TODO string fails spec:validate. Button and CardVertical were backfilled first; the other specs carry no decisions or ruledOut until someone writes them, and their docs pages show “none recorded”.

Amendment (2026-11-10) — data-part markers on Button and CardVertical

The convention from the Decision section, as built.

  • Marker placement. Each part’s element sets data-part="<anatomy name>" before {...rest}. When a part is built on another library component, the outer name wins on the shared element: CardVertical’s Favorite is a Button whose <button> reads data-part="Favorite", not "Root".
  • Parts inside a nested component. An outer component can’t mark them, so they keep the inner component’s own marker. The spec says which marker that is with builtOnPart: FavoriteGlyph is found as [data-part=Favorite] [data-part=Icon]. A Figma nested instance works the same way: its layers keep the inner component’s names. A Button prop that renamed its internal markers was rejected because it adds API surface for one consumer.
  • Parts no example can render. They carry notRendered with a reason. The test skips them, and the docs overlay will list them as not shown. CardVertical’s MenuPanel is the first case: DropdownMenu renders nothing until opened, and CardVertical.a11y.test.tsx already covers it open. Putting a click into the example was rejected, because it can’t cover TextField’s Placeholder pseudo-element, so an exemption would still be needed.
  • Pattern examples render through stories. A metadata pattern tree is notation, not code. A { "pattern": "overflow-menu" } example renders the story named after the pattern in PascalCase (OverflowMenu). CardVertical’s WithFavorite and WithMenu stories were renamed FavoriteSaved and OverflowMenu. A story field on metadata patterns was rejected because /layout-generation would read it 27 times per run.
  • Button’s label. It is now a plain <span data-part="Label">, rendered only when children are present, so no empty flex item adds a gap.
  • Test and CI. npm run anatomy:test (packages/components/src/anatomy.test.tsx, run in components-check.yml) renders each spec’s examples and fails on any part with no marker. With three markers removed on purpose, it reported exactly the five expected parts, including both glyphs. The ADR-019 screenshot check passed at 0.000% for all 54 shots.
  • Scope. Only specs with anatomyExamples are tested. That’s Button and CardVertical today; Phase A3 extends it to all 27.

Amendment (2026-11-10) — Phase A1 pages as built

Button and CardVertical have Usage, Spec and Accessibility pages, as tables and text only.

  • Route file. [name]/[...tab].astro, not [[tab]].astro: Astro has no double-bracket optional segment, and a rest parameter left undefined gives the bare Usage URL.
  • Sidebar highlight. Starlight marks a sidebar link current only on an exact path match, so /spec/ and /accessibility/ highlighted nothing. A Starlight route middleware (apps/docs/src/route-data.ts) marks the component’s Usage link current on all three routes. A sidebar entry per tab was rejected: it would triple the Components group, and the tab bar already links the sub-pages.
  • Bundle loading. The pages import dist/specs.bundle.json as a JSON module. Reading it with fs from import.meta.url broke once Vite bundled the page into dist/. ADR links resolve through the docs content collection, so a decisions[].adr value with no published ADR renders as plain text.
  • A11y tier in the bundle. Each component carries a11y: { tier, test, backlog }, derived with the same isInteractive rule a11y-coverage.js uses, so the Accessibility page states the tier the gate enforces instead of re-deriving it.
  • Builds. docs:build and docs:serve run spec:bundle first. docs-build.yml builds tokens and also triggers on spec, metadata, token source and bundle-script changes.
  • Which components. A list of two in apps/docs/components.mjs; Phase A3 removes the filter.

Amendment (2026-11-10) — Phase A2 spike: the overlay ships, with a depth fallback

The live overlay from decision 3 ships. @astrojs/react renders each anatomyExamples entry from component source inside Starlight, and a script measures every data-part element (the lookup anatomy.test.tsx uses) and draws numbered markers in an SVG over it. The examples pick up Starlight’s data-theme, which is the attribute the token CSS keys on, so they follow the site’s light/dark switch with no extra wiring.

  • Depth fallback. All 21 markers on CardVertical did not read: the Meta row badges covered “12 Hours”, “Certified” and “Completed”, and colliding badges were pushed off their parts. An anatomy three or more levels deep now marks only its top two levels (CardVertical: Root, Media, Progress, Body) on the first example, and a Mermaid tree (astro-mermaid, already installed) shows every part. Shallower anatomies keep the full overlay on every example (Button: 4 parts). Marker numbers are the anatomy table’s row numbers, so the table is the legend. Gutter markers with leader lines were considered and not built: more layout code for a case the tree already covers.
  • Library CSS. The package’s built index.css carries a global reset (* { margin: 0; padding: 0 }, body styles) that would restyle the site. The pages import component source (CSS Modules) and tokens.css only; the reset is re-applied inside .ds-example.
  • Pattern examples. Rendered from the story’s args on meta.component, without Storybook’s runtime; story decorators are skipped.
  • Fonts. Component pages load the brand fonts through frontmatter head, as Storybook’s preview-head.html does; other pages don’t.

Amendment (2026-11-11) — Phase A2: live examples, patterns and states

Usage and Spec render the real component from its stories, with one renderer (apps/docs/src/components/stories.tsx) shared by the live examples and the anatomy overlay.

  • Stories by name. The Usage example is the Default story; a pattern is its PascalCase export in <Name>.patterns.stories.tsx; a state is its PascalCase export in <Name>.stories.tsx (rest → Default). A missing story shows “No <Export> story” rather than a substitute. CardVertical’s favorite-pressed has no FavoritePressed story, so it shows that gap.
  • Render path. meta.args then the story’s args, through the story’s render (else meta.render, else meta.component), wrapped in the story’s decorators then meta’s, as Storybook orders them. This replaces the spike’s “decorators are skipped”: pattern stories use decorators for width (CardVertical’s 280px), and without them a card stretched to the column. Global decorators (theme, brand) stay skipped; Starlight’s data-theme drives the tokens.
  • Interaction states are not forced. Hover, press, focus and open are pseudo-classes or internal state. Forcing them means rewriting the component CSS at runtime (the storybook-addon-pseudo-states approach). The spec’s trigger strings don’t say which element the pseudo-class is on, so a rewrite would also fire on other elements: CardVertical’s card hover and action hover would show together, and the global :focus-visible rule would ring every element in the frame. The table marks them “Not forced”, and the live examples are interactive.

Amendment (2026-11-11) — Phase A3: anatomy as an overview plus detail images

The A2 anatomy (markers on the parts, the depth fallback, a Mermaid tree and the anatomy table as the legend) was too long and too granular to read. Phase A3 replaces it with the M3 card-guidelines layout: number the main parts, not every element.

  • What gets numbered is authored, not derived. No depth rule picks M3’s set: Body (a wrapper) and Thumbnail (the same box as Media) sit at depth 1–2 but aren’t parts a reader looks for. Each anatomyExamples entry may list mark (the parts it numbers) and focus (a part to crop to, shown at its real size, never magnified, so the detail matches the design). Unfocused entries are the overview (1, 2, 3, in anatomy order); a focus entry numbers the focus part’s descendants as <n>.1, <n>.2, so a detail image ties back to the overview. Entries with the same focus share one figure (CardVertical’s Action: Favorite and Menu side by side). A single example without mark numbers every part (Button). Glyphs, labels and MenuPanel stay in the spec and in anatomy:test; they just aren’t drawn. Schema and checks: ADR-027 amendment of the same date.
  • Callouts in the gutters, each leader one straight line. Overview badges sit in a left or right gutter (wide parts on the left, where their content starts) with a horizontal hairline, so a badge may only move within its part’s vertical extent; within those ranges badges are pushed at least 10px apart, and a part that can’t fit on its side moves to the other. Detail images and components too short for a stack of side badges (Button) put the badges below their parts with vertical hairlines, under the same rule. No angled or stepped leaders. The outermost part gets a dashed outline only when it has no visible edge of its own (CardVertical’s Root yes, Button’s Root no). Badges keep the site accent colour. Positions are measured again once web fonts load, since a font swap moves parts without resizing the frame.
  • Centred. Each example and its legend sit in the middle of the box; the legend uses the caption’s type size.
  • Props table: prop, type, default, options. The Concept column and each option’s useWhen are dropped (the Part props table also leaves out Type); a prop with options shows Type enum rather than its TypeScript alias (CardVerticalSize, ButtonVariant); a slot prop typed ReactElement<…Props> shows Type element and the parts it accepts as options (CardVertical action: CardVertical.Favorite, CardVertical.Menu); options are bare values that wrap in the cell, with even spacing and every cell centred vertically (global rules in custom.css: scoped page styles lost to Starlight’s table and code rules on the dev server, where the stylesheet order differs). The useWhen text stays on the Usage page’s Variants section. Part props (spec keys <Part>.<prop>, ADR-027) move to their own “Composition props” table, grouped by <Name>.<Part> and collapsed by default (fewer readers compose from parts), so a part’s prop isn’t read as a prop of the preset.
  • No “Generated from” hash in the header. The per-component hash stays in specs.bundle.json (for Part B’s stale-sheet); on the page it was noise to a reader.
  • Legend and caption. Inside each box, under the diagram: number and part name only, in a short row; hovering a legend item or a badge highlights the part. Outside the box, a caption in the style of the rendered states says what the figure shows: the overview’s pattern and variant (favorite-saved pattern · size lg, from the pattern story’s args or the example props, falling back to each usage variant default), and for a detail its focus part (Meta · detail of 6). The anatomy table and the Mermaid tree are removed for now. Element, role, presence and builtOn props aren’t shown on the page in the meantime; they’re still in the spec.
  • CardVertical’s overview example is the favorite-saved pattern, the only example that renders Action, and its FavoriteSaved story gained progress: 40 so Progress shows too. Meta detail uses the props example (certified, progress 100), the one that renders all three meta items.
  • Iteration on one page. A3 refines the template on CardVertical in place (no v2 route); Button shares the renderer and is checked once at the end.
  • Token usage gets its own Tokens tab, between Spec and Accessibility (/components/<name>/tokens/). The table is the longest section and is read for a different task (tracing a token) than the rest of Spec, so on Spec it pushed Why and Parity far down and was hard to find. Its intro links back to the Spec anatomy diagram for the part numbers.
  • States as captioned tiles, no table. Each state with a story renders as a tile captioned with its kind and name only (Lifecycle: completed); a state whose story is missing is a dashed tile naming the missing export, so the gap stays visible. Interaction states are listed in one line under the grid (not forced, as before), with each trigger as a tooltip. State trigger (except as the interaction tooltip) and notes are no longer shown on the page; they stay in the spec.

Amendment (2026-11-12) — named callouts and a variant-led Usage page

  • Anatomy callouts carry part names, not numbers. The numbered legend under each box is removed; a badge names its part directly and hovering it still highlights the part. Side gutters widen to the longest name. A detail’s caption reads Meta · detail. The Tokens tab groups by part name with no number badges.
  • Bottom-gutter callouts alternate bottom and top, left to right, so neighbouring names don’t crowd one row (Button: Root and Label below, Icon and TrailingIcon above). A single marked part keeps the bottom gutter only.
  • Usage opens with one section per variant axis (variant → Variants, size → Sizing, shape → Shape), in place of Example and the Variants tables: the component once per option, built from the Default story’s args with that prop changed, each named by a badge under it with no leader (it labels the whole sample, not a part), then the Option / Use when table. No caption under the box: the table marks the default. A sample honours the spec constraints it triggers (drops ignore props, fills require props: aria-label with the option name, others with the first option the story’s controls offer), so Button’s shape renders icon-only. A component with no variant axes keeps the single Example.

Amendment (2026-11-12) — Placement, Accessibility guide and the “When to use it” rule

  • “When to use it” appears only for a family of lookalikes. A family is a set of components that share a shape but not a role (ADR-009 rule 2), so the reader’s first question is “this one or its sibling?”: Surfaces (Card, CardVertical, CardHorizontal, Box), Layout (Stack, Inline), Type (Text, Heading), Labels (Badge, Chip), Choice inputs (Select, Checkbox, TextField), Media (Image, Avatar, VideoFrame). The section opens with “Choose between …”, linking the siblings, then lists useWhen. A component whose name states its role (Button, Icon, Divider, ProgressBar…) skips it: its useWhen lines repeat what the variant sections and Composition Do / Don’ts already show. The list is authored in apps/docs/components.mjs (FAMILIES), not derived: mutual notFor references would also pair Button with TextLink, which aren’t lookalikes.
  • Placement (prototype, Button and CardVertical). A component with a file in apps/docs/src/placement/ shows Do / Don’t boxes, under a Composition heading, in place of Patterns, Not for, the composition rules, Prop rules and Related components. Each Do renders a usage pattern’s story; each Don’t renders a sample built in the placement file and names the notFor or composition entry it illustrates. Captions are written for readers in the placement file, at most 120 characters (the page throws past that); the longer usage.json text stays agent-facing. Verdict bars and labels use the feedback success / error tokens; boxes side by side share one canvas height.
  • Accessibility guide (prototype, Button and CardVertical). A component with a file in apps/docs/src/accessibility/ shows Use cases (what people using assistive technology must be able to do), Reading order, and Keyboard and focus, in place of Role and ARIA, the key-by-key table, Focus and Testing; the full contract stays in the spec’s accessibility block and the a11y test. Reading order renders a sample with the anatomy’s badges and leaders, each badge an ordinal of reading (DOM) order, over a Reading order / Code / Announcement table read from the rendered elements (dom-accessibility-api computes role and name; ids show as the variables the source passes, {titleId}; aria-hidden children show as empty tags), so it can’t drift from the code. The announcement approximates name, role, state; screen readers word it differently. Keyboard and focus gives one or two sentences and the sample with the shared ring (ADR-028) forced on. Marks may pin a badge to one gutter (side) when neighbours on one line would crowd it; the anatomy layout honours it.
  • Tokens tab: only Root starts expanded. Every other part’s group loads collapsed.
  • Anatomy callouts sit further out, in --sl-color-accent-high. Side leaders are 36px and top/bottom gutters 64px; badges, leaders and their end dots use accent-high (replacing “Badges keep the site accent colour” above), with leader and dot at 80% opacity as one group. A top or bottom badge may spill past a narrow stage into the example box, so a badge wider than its component (Button’s TrailingIcon) still centres on its part.
  • Detail figures fill their row. Figures side by side take equal columns across the full width (wrapping below 16rem), their boxes stretch to one height, and each diagram is centred in its box. A detail crops to the focus part’s height but only the width its labelled parts span, so a full-width part with its content on one side (Meta) still shows centred.
  • Figure captions are tags. Anatomy and state captions are a row of tags, no separators: a category for readers (Pattern, Detail, the state kind as Lifecycle, Content, App data) as a plain outlined tag, and identifiers as code chips — pattern and part names, state names, and prop values in JSX form (size="lg"). This replaces favorite-saved pattern · size lg, Meta · detail and Lifecycle: completed above. State tiles show lifecycle, content and app-data states only (rest is the Usage example); the interaction-state line is removed.

Amendment (2026-11-16) — overlays render as a static picture, in place

Dialog is the first published overlay. Its stories open on mount with showModal(), so on a docs page every live example took the top layer on load: the page dimmed and went inert, focus moved into a demo, and the anatomy figure sat under a dialog with its callouts pointing at nothing.

  • Staged components. STAGED in apps/docs/src/components/stories.tsx lists the components whose stories would take over the page, with the args that render them in place (Dialog: { nonModal: true }). StoryRender applies them on every surface (anatomy, examples, patterns, states, placement), so the open dialog sits in the page flow. Pattern stories pass nonModal through from their args; Storybook leaves it unset, so they stay modal there.
  • Static, not interactive. A staged story renders inside an inert wrapper: it can’t be clicked, hovered or focused, the overlay’s own focus() on open does nothing, and it is out of the accessibility tree. The story’s own trigger is hidden while the overlay is open. The real behaviour stays in Storybook.
  • The stage: the window only. An open staged overlay is centred in its box on the plain canvas, with no backdrop: the pages are a reference for how the window looks, not a demo of the modal. A closed-state tile shows only the trigger. A pattern or state tile with the overlay open takes a full row, since the overlay keeps its own width.
  • Anatomy leaders never cross text or a control. The top/bottom callout layout (short components, detail images) keeps alternating its badges between the two gutters unless a leader would cross a text run or a control (button, input, icon, image) outside its own part. Dialog’s did: Description through Cancel, Actions through Description. Then each part takes the gutter nearer its edge (Actions and Root at the bottom, Title, Header and Close at the top), and its leader runs only through clear columns. Obstacles are clipped to the visible figure, and slivers under 4px are ignored. Button and CardVertical have no crossings, so their figures are unchanged.
  • Without JavaScript, a staged example shows only its story’s trigger: the dialog opens in an effect.
  • Rejected: an “Open as modal” trigger that mounted a fresh, real modal next to each example, and a scrim behind modal stories (both built, then dropped by the developer: the reference pages need the window only); forcing the stories closed (the page would show only a trigger); patching HTMLDialogElement.prototype.showModal on the docs page (it would hide the override from the stories, which are the source).

Amendment (2026-11-18) — Four tabs, a Decisions tab grouped by topic, and page rules

Dialog, the first page without variant axes, a placement file or an accessibility file, came out two to three times longer than Button and CardVertical (Spec tab about 1,770 words against 550), with “None recorded” sections and every decision listed word for word. The template is settled before the rest of the batch is published. Decided here, built in the docs-page-ia handoff steps 3–4, and refined the same day after the developer’s review of the Dialog page (step 4.6): Ruled out left the Decisions tab, which had become as long as the page it replaced.

  • Four tabs: Usage · Spec · Accessibility · Decisions. Usage (designers and PMs): the opening section, When to use it, Do / Don’t. Spec (engineers and designers drawing it): Anatomy, States (when it adds something, R7), Props, Tokens. Accessibility: Use cases, Reading order, Keyboard and focus. Decisions (reviewers and maintainers): featured decisions filtered by topic (ADR-027 amendment 2026-11-18) under “Why it’s built this way”. Ruled-out options stay in spec.json only, reached through the page’s “Spec source” link. Design–code parity is built but hidden on every page for now (OMIT_EVERYWHERE); figma.divergences stays in the spec for reviewers and the Figma moments. The Tokens tab becomes a section of Spec, as in Material 3; moving tokens to Airtable was rejected, since Airtable is private governance and the table is generated at no cost.
  • A decision log is a deliberate feature. Polaris, MUI, Carbon and Material 3 don’t publish per-component decisions; GOV.UK’s “Research on this component” is the nearest precedent (recalled, not re-checked).
  • Page rules, which /document-component will apply:
    • R1. The opening section is named by the variant axis (AXIS_TITLES). With no axis but optional slots, it is “Content” (Dialog: title only, with actions). “Modal vs non-modal” is out, because staged overlays look the same either way (R8).
    • R2. Every published page has a placement file. Each Do is a pattern story, at most 4, paired with a Don’t that can be drawn, chosen from notFor, then limits, then a drawable donts entry. Behavioural don’ts never become boxes.
    • R3. Captions are 120 characters at most. A Do starts with a verb; a Don’t names the mistake, then the consequence.
    • R4. Prop rules enforced only by type are not rendered.
    • R5. Every published page has an accessibility file: at most 4 use cases, and labeling and keyboard advice of one or two sentences each. ARIA attributes, the key table and the test tier stay in spec.json.
    • R6. The Decisions tab shows only the decisions marked featured, at most 8 per component, in their short, reader-facing form: a Decision / Why table with no intro, one topic at a time, chosen by pills (the first topic starts selected; no “All” view, so the tab opens short). The pills are radios filtered by CSS, so the tab works without a script. The full list and the ruled-out options stay in <Name>.spec.json, linked as “Spec source” in the page header. Every entry stays in the spec, because agents read them all. Other tabs may link a one-line “Why?” to a filtered view instead of repeating the reason. Rejected: merging or deleting entries to shorten the page (loses agent context), a collapsed “All decisions” list (the link is enough for the few readers who want it), and Ruled out on the tab (it doubled the tab’s length for readers who rarely need it).
    • R7. No “None recorded” on reader pages: a section with no data is left out, and so is a tab (Decisions, with nothing shown). A section with data may also be left out when it adds little to that component’s page (OMIT_SECTIONS in apps/docs/components.mjs; Dialog’s States repeat Content and modality, R8), or on every page (OMIT_EVERYWHERE; Design–code parity for now).
    • R8. Overlays render staged (amendment 2026-11-16), so no figure may depend on modality.

Amendment (2026-11-18) — /document-component, the tenth agentic moment

The page rules above are applied by a developer-triggered command, /document-component <Name> (.claude/commands/document-component.md), written from what worked on the Dialog page (docs-page-ia handoff, step 5.1). It is agentic moment 10 in CLAUDE.md.

  • What it does. It builds one component’s page from the committed usage.json and spec.json: the placement and accessibility files, page config in apps/docs/components.mjs (CONTENT_OPTIONS, FEATURED_PATTERNS, OMIT_SECTIONS, PUBLISHED), and the featured decisions. It proposes the page plan before writing files, gates on spec:validate and docs:build, and opens a PR on document/<kebab-name> after the developer has reviewed the built page in light and dark and at 375px.
  • What it doesn’t. It does not author usage.json or spec.json. Guidance found missing or wrong is reported for /extract-learnings or as an issue. The exception is a one-off, reword-only edit pass on decisions written before the reader-facing rule; it never deletes or merges an entry. No subagent: the page review is the review stage, as the figures are code and the gate catches broken sources.
  • Where the decision-writing rule lives (handoff D5). Where decisions are born: the decisions[] description in component.spec.schema.json, which agents read, and /extract-learnings, which routes review findings into spec.json; spec:validate enforces the mechanical part (ADR-027 amendment 2026-11-18). /document-component only runs the catch-up pass on older entries.
  • “Content” stays page config (R1, handoff D4). A component with no variant axis but optional content props opens with a Content section configured in CONTENT_OPTIONS; the options are not moved into usage.json. Rejected for now: a usage.json field for content options, a schema change that only Dialog would use. Revisit if a second component needs it.

Amendment (2026-11-19) — ruledOut[] as agent memory; scope closes at four pages

  • The reviewer reads ruledOut[] (decision 12’s follow-up). /review-component’s adversarial reviewer doesn’t propose a ruled-out option unless it has evidence the recorded reason no longer holds, and then marks the finding reproposes. A suggestion the developer rejects goes into the run’s rejected[], and /extract-learnings turns it into a ruledOut[] entry in the same reader-facing form as decisions. So a rejected idea is recorded once and not argued again.
  • Measured from here on. handoff:tidy copies rejectedCount and reproposedRuledOutCount into the run ledger. Earlier runs didn’t record them and stay without the fields, not 0. The before-count is small: the two adversarial reviews that ran on components that already had ruledOut[] (Dialog, CardVertical with CardHorizontal) raised 19 findings and none re-proposed a ruled-out option. A drop can’t show against 0, so the result to watch is whether reproposes and rejected[] get used at all.
  • Part A closes at four pages (developer, 2026-11-19): Button, CardVertical, Dialog and Accordion, as a proof of concept. The other 23 components are not documented; Select, DropdownMenu and TextField stay in PUBLISHED without a /document-component run. A3’s remaining-sections pass is deferred. Part B (the Figma parity plugin) is optional and tracked in its own handoff; decisions 5–8 and 11 stand for it if it starts.