---
name: strongtie-docs
description: "Document a @strongtie/design-system component across its four surfaces: wrapper JSDoc, a Storybook story, an MDX page, and a registry example. Use when: (1) Documenting a new component, (2) Updating existing component documentation, (3) Adding a Storybook story."
---

# Component Documentation Skill

Publish a `@strongtie/design-system` component's documentation so it appears everywhere the design system surfaces it — the generated API docs, Storybook, the docs site, and the registry preview — from one coherent description.

## When to use this skill

Reach for it when a component exists and now needs its public documentation: JSDoc on the wrapper, a story under `stories/components/`, an MDX page under `apps/docs/content/docs/components/`, and a registry example under `apps/docs/registry/`. The through-line is that you are describing an already-authored component for consumers, not changing its behavior.

## When NOT to use this skill

If the component or its variants do not exist yet, author them first with `strongtie-component` — documenting a component you are still designing means rewriting the docs when the API shifts. If you are writing the test suite, that is `strongtie-test`. And this skill is about the library's own components; it does not cover documenting a consuming app.

## The four surfaces, and why one description feeds them all

A component is documented in four places, and they are not independent — they should all trace back to the same description so the API docs, Storybook, the docs site, and the registry preview never disagree. Read the Button as the reference for all four; mirroring it is faster and more correct than assembling the shape from memory:

| Surface | Live example |
|---------|--------------|
| Wrapper JSDoc | `packages/design-system/src/components/button.tsx` |
| Storybook story | `packages/design-system/stories/components/button.stories.tsx` |
| MDX page | `apps/docs/content/docs/components/button.mdx` |
| Registry example | `apps/docs/registry/example/button-default.tsx` |
| Registry entry | `apps/docs/registry/registry-examples.ts` |

## The conventions that actually carry weight

**The wrapper JSDoc is the source description, not a nicety — it is generated into the docs.** The block comment on the wrapper (`packages/design-system/src/components/button.tsx`) is read by the docs build to produce the component's API page, so a thin or missing JSDoc yields a thin or missing doc with no other symptom. Write it on the **wrapper**, never the base primitive, because the wrapper is the public surface; lead with a one-sentence "what it is," then a paragraph on when to use it, then `@example` blocks for the common cases (including `asChild` where the component supports it). Keep that lead sentence in sync with the MDX frontmatter `description` so the two surfaces tell the same story.

**The story's `argTypes` are the interactive prop docs — fill the `table` summaries or the controls lie.** The Storybook story (`packages/design-system/stories/components/button.stories.tsx`) declares each prop's `control`, `options`, and a `table` with a `type.summary` and `defaultValue.summary`. Those summaries are what Storybook's autodocs render as the props table; omit them and the control still works but the documented type is blank, so a reader sees a knob with no idea what it accepts. Give every meaningful prop an `argType` with its `table` filled, then add a named story per visual axis (Default, Sizes, Variants, Disabled, AsChild, Loading) so each variant is demonstrated, not just described.

**Every `<ComponentPreview name="..." />` in the MDX must resolve to a registry entry — the name is a live lookup, not a label.** The MDX page (`apps/docs/content/docs/components/button.mdx`) embeds previews by name, and each name is resolved through `apps/docs/registry/registry-examples.ts` to an example file. Reference a name with no matching registry entry and the preview renders nothing (or breaks the build); the three artifacts — MDX name, registry entry, and example file — move together or not at all. When you add an example to the MDX, add its registry entry and its `apps/docs/registry/example/<name>.tsx` file in the same change.

## The workflow

Work the four surfaces in dependency order so nothing references a thing that does not exist yet:

1. **JSDoc** on the wrapper in `packages/design-system/src/components/`.
2. **Story** in `packages/design-system/stories/components/` — `argTypes` with filled `table` summaries, one named story per visual axis.
3. **MDX page** in `apps/docs/content/docs/components/` — description matching the JSDoc, a props table, and `<ComponentPreview>` for each example.
4. **Registry example(s)** in `apps/docs/registry/example/`, then their entries in `apps/docs/registry/registry-examples.ts`.

The MDX and registry boilerplate — full page template, example-component template, and registry-entry shape — lives in `references/mdx-and-registry.md`; copy from there and fill in, rather than reconstructing it here.

## Related skills

`strongtie-component` authors the component these docs describe (and owns its JSDoc-on-the-wrapper rule). `strongtie-test` proves it behaves. For the completeness checklist of what a component's test suite should cover, see `strongtie-test`'s `references/test-patterns.md`.
