component-doc-page
Skill9 starsChanged 7 days agoMITView on GitHub
Create a full-quality documentation page for a design system component on the website. Use when asked to document a component on the website, add a component docs page, or create the website page for a component.
In this repository33 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- accessibility-auditSkill
- animation-jump-checkSkill
- api-consistencySkill
- chat-qualitySkill
- checkpointSkill
- component-consistency-auditSkill
- content-auditSkill
- dependency-advisorySkill
- design-qaSkill
- dogfoodSkill
- drift-auditSkill
- first-deploySkill
- landSkill
- link-rotSkill
- new-componentSkill
- new-pageSkill
- new-presetSkill
- new-templateSkill
- new-tokenSkill
- new-validatorSkill
- parkSkill
- pre-deploySkill
- release-postSkill
- releaseSkill
- responsive-sweepSkill
- security-auditSkill
- seo-auditSkill
- shipSkill
- super-shipSkill
- token-auditSkill
- token-renameSkill
- visual-reviewSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Create a full-quality documentation page for a design system component on the website.
- Distinctive: line 15
Use this skill when asked to document a component on the website, add a component page, or create docs for a component — phrases like …
- Distinctive: line 21
Gather requirements: if not already provided:
- Very specific: line 41
All copy on the page (tagline, intro, section labels) follows content-design.md — neutral, sentence case, no em dashes
- Very specific: line 42
Import the component through the package, never a relative path into src/: import { X } from "rift-ds/components/X/X" (recharts-backed …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
component-doc-page
Create a full-quality documentation page for a design system component on the website.
When invoked
Use this skill when asked to document a component on the website, add a component page, or create docs for a component — phrases like "document [X] on the website", "add a docs page for [X]", "create the website page for [X]".
This is a more thorough, component-specific version of new-page. The Button page is the quality benchmark for static variant grids; for components whose value is interaction or streaming state (the ai category), the chat-message page (website/src/app/components/chat-message/page.tsx) is the exemplar — a "use client" page with small stateful demos instead of a grid.
Instructions
- Gather requirements if not already provided:
- Component name (PascalCase)
- Figma node URL (optional — ask the owner, or omit if unknown)
- Storybook path (optional — format:
/?path=/docs/components-<slug>--docs)
- Read the source component
src/components/ComponentName/ComponentName.tsx:- Extract all props from the TypeScript interface (the entry in
website/src/data/component-api.generated.tshas them pre-parsed with types, defaults and descriptions — the source is still worth reading for behaviour) - Identify all variant enumerations (e.g.
variant,size,statusprops with union types) - Understand the component's states (default, hover, active, disabled, loading, etc.)
- Note the BEM class names used for each variant/state
- Extract all props from the TypeScript interface (the entry in
- Read the gold-standard reference:
website/src/app/components/button/page.tsx— study the variant showcase grid structure (rows = states, columns = variants), thepageHeaderblock,introSection, and howPageLinksis usedwebsite/src/app/components/button/page.module.css— CSS module structure
- Create
website/src/app/components/<component-slug>/page.tsx:- Mirror the Button page's layout shell exactly — same components, same nesting, same class names — and render
<ComponentsSidebar />with no props: it resolves the active entry from the pathname and its groups from the registry. Don't improvise structure. Mirror the structure, not deprecated APIs: if an existing page still uses a prop marked@deprecatedin the component source (thepriority→variantrename is the precedent), write the current prop name. - Invariants the exemplar can't teach:
subDisplayis a tagline for the component (e.g. Button's "The main action element") — not the word "Components"; the breadcrumb already shows the sectionintroBodyis a clear 1–2 sentence description of the component's purpose, inferred from its props and JSDoc if available- All copy on the page (tagline, intro, section labels) follows
content-design.md— neutral, sentence case, no em dashes - Import the component through the package, never a relative path into
src/:import { X } from "rift-ds/components/X/X"(recharts-backed charts come fromrift-ds/charts) — the website is an npm-workspace consumer of the published package's exports - Include
PageLinkswith whichever Figma/Storybook URLs were provided - End the page with
<ComponentInstallStrip slug="<component-slug>" />after the last section — the per-page install commands, rendered at the page floor across the content column's full width.scripts/validate-website-surfaces.mjsrequires the mount with the page's own slug and fails the build without it
- Variant showcase grid: render the component in every meaningful combination of its variants and states. For components with discrete variants × states (like Button), render a proper grid. For simpler components, render one example per meaningful state/variant.
- If the component has a
toneprop besidevariant(emphasis × colour, per CLAUDE.md's Component Anatomy), the grid's columns are the emphasis × tone cells the component actually draws, built from one cell list the way the Button page does. Skip combinations the component renders identically rather than showing a duplicate, and never demo a deprecated single-axis value. - If a demo renders h2 headings of its own (a heading-bearing component like SectionTitle, or Prose sample content), wrap that demo container in
data-anchor-ignore— the site-wide floating anchor rail reads every page's h2s, and demo headings are the demo's, not sections of the page. The discovery rules live in the doc block ofwebsite/src/components/FloatingAnchorNav/SiteAnchorRail.tsx.
- If the component has a
- Mirror the Button page's layout shell exactly — same components, same nesting, same class names — and render
- Create
website/src/app/components/<component-slug>/page.module.css:- Standard layout classes:
dsLayout,dsContent,pageHeader,pageTitle,subDisplay,introSection,introBody - Any additional classes needed for the variant showcase grid
- Page assembly follows design.md's Composition section (rhythm ladder, spacing ownership, one level of chrome, dividers last) — the exemplar shows the pattern, the spec owns the rules
- Prose is never width-capped. No
max-widthonintroBody, section body text, or any paragraph class — page text fills the content column, exactly as the Button page does. Amax-widthis only legitimate on a demo container (a box that holds a rendered component, e.g. a drawer or form-control mount) where the component itself needs a bounded stage. If you find yourself capping a paragraph "for readability", don't — the column width is the layout's decision, not the page's.scripts/validate-page-prose-width.mjsfails the build on a page rule that sets paragraph type and amax-width; text that belongs to a rendered demo is sanctioned in its table. - CSS custom properties only
- Mobile type and section rhythm collapse at the token layer, system-wide (
design.md's responsive spec owns the breakpoint) — do not add per-page@mediaoverrides for tokenized values; when the showcase grid genuinely needs a breakpoint, use a width fromsrc/tokens/breakpoints.ts(a content-driven one outside it needs ads-allow(breakpoint)directive above the query;scripts/validate-breakpoints.mjsenforces it)
- Standard layout classes:
Create
website/src/app/components/<component-slug>/layout.tsx— it is exactly this, with no description of its own:import { componentPageMetadata } from "@/config/navigation"; export const metadata = componentPageMetadata("<component-slug>"); export default function Layout({ children }: { children: React.ReactNode }) { return <>{children}</>; }Both the title and the description resolve from the component's entry in
src/components/registry.json(or, for the chat widget,src/chat/registry.json;website/src/data/component-pages.tsmerges the two) — that is the only place the one-line description lives, so do not pass one here.scripts/validate-page-titles.mjsrequires this exact call and fails the build otherwise; a slug with no registry entry fails the website build with a message naming the fix.- Do not touch
website/src/config/navigation.ts.componentsSidebarLinksis derived from the registry — there is no list to add to. Registering the component insrc/components/registry.json(with itslabel,sluganddescription; the chat widget's entry lives insrc/chat/registry.jsonand is merged in throughwebsite/src/data/component-pages.ts) is what puts it in the sidebar, and the sitemap, mega-nav and breadcrumbs follow from there. If the component is not yet registered, do that first; thenew-componentskill covers the entry's shape. - Add a preview entry to
website/src/components/ComponentPreviews/ComponentPreviews.tsx— the one surface still hand-maintained, because each entry holds a bespoke preview:- Add a
"component-slug": () => (...)entry to thepreviewsmap — use the real component (imported fromrift-ds) where it reads well at miniature size, as most entries do, or a small inline-styled mockup where it doesn't (see the accordion entry). An icon in a mockup sets--icon-sizeinline (style={{ ["--icon-size" as string]: "14px" }}), neverfontSize: the icon class sizes its box from that property, so a bare font size leaves a small glyph in a default-size box and the tile sits off-centre. The index's category section renders the entry throughComponentCardGrid, so there is no card to place by hand and no order to maintain.
- Add a
- Sitemap is automatic —
website/src/app/sitemap.tsderives its routes from the shared sidebar configs, which for components derive from the registry. Do not editsitemap.tsby hand.scripts/validate-website-surfaces.mjsbuild-enforces the showcase page, itsComponentInstallStripmount (step 4), the step-8 preview entry (in both directions — an entry whose key is not a registered slug fails too), and thedesign.mdspec section; the sidebar entry and its ordering are no longer checked because they can no longer drift. If the component has nodesign.mdspec section yet, add one before building — see thenew-componentskill's spec step for the expected shape.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

