Skip to main content
Design/component-specStableUpdated

Component Spec

Spec a design system component with variants, states, and accessibility. Use when a new or existing UI component needs a specification designers and engineers can build from consistently.

Use this when you need to document a new or existing UI component for a design system: its variants, states, behavior rules, accessibility requirements, and usage guidelines. You walk away with one spec that opens with a component README (purpose, when to use by variant, what the consumer provides, rules, props) and that designers and engineers can build from consistently. It specs one component; documenting a whole existing system is a different job.

Related skills: Follows /style-guide, which sets the foundational tokens and shares the component README shape. Feed accessibility requirements from /accessibility-audit. Use /interaction-pattern-library for cross-component interaction consistency.

You provide

  • {{component_name}}: what the component is called in the design system, as engineers will reference it in code.
  • {{purpose}}: the problem it solves, and when to use it instead of the alternatives.
  • {{visual_reference}}: a Figma link, a screenshot, or a description of the component.
  • {{existing_implementation}} (optional): the current version, if there is one, and what is wrong with it or missing.
  • {{design_tokens}} (optional): the team's token system (colors, spacing, typography). If there is none yet, found it with /style-guide first.

Process

The full output template, one block per step, is in reference/spec-template.md.

Step 1: Gather inputs

Ask for every item in ## You provide. If {{existing_implementation}} exists, read it: props are copied from its types, never paraphrased (readme-shape.md).

Step 2: Write the README head and define the anatomy

Open the spec with the component README in the shape from /style-guide, adopted in docs/design-system-comparison-2026-10.md: purpose, category, when to use by variant, the consumer provides, rules, props. Then break {{component_name}} into its constituent parts: each part, whether it is required, and what it is and where it appears. Template in reference/spec-template.md.

Step 3: Define variants

For each variant, say when to use it and how it differs visually (for example primary, secondary, destructive, ghost or tertiary). Use {{design_tokens}} names for the visual differences. Template in reference/spec-template.md.

Step 4: Define states

Give each state its visual treatment and its behavior: default, hover, focus, active or pressed, disabled, and loading, error and success where they apply. The focus indicator meets 3:1 contrast; disabled is skipped in tab order; error connects to its message via aria-describedby. Template in reference/spec-template.md.

Step 5: Accessibility specification

Specify role, keyboard operation, focus management, what a screen reader announces, color independence, target size (minimum 24x24px per WCAG 2.5.8, 44x44px recommended for touch) and reduced-motion behavior. Take requirements from /accessibility-audit when one exists. Template in reference/spec-template.md.

Step 6: Usage guidelines

Write the Do / Don't table, the content guidelines for label, helper and error text, and when to use this component versus its alternatives.

Step 7: Review

Present the spec and ask:

  • Does this cover all the variants your team needs?
  • Are there states or interactions I missed?
  • Does the accessibility spec match your team's standards?
  • Should I spec related components that pair with this one?

Output contract

Present the spec as formatted text in the conversation, following reference/spec-template.md. For design system documentation, export it to Notion, Storybook, or the team's component docs.

  • The spec covers exactly one component; related components are separate specs, linked.
  • It opens with the component README: purpose, when to use by variant, the consumer provides, rules, props.
  • Props are copied from the code's types when an implementation exists.
  • Every interactive component lists at minimum default, hover, focus, active and disabled, plus loading, error and success where they apply.
  • The accessibility section states keyboard behavior, screen reader behavior and ARIA requirements.
  • Specific Figma frames, tokens or code snippets are referenced where they exist.
  • Names follow the codebase's naming convention, not marketing names.
  • Prose follows knowledge/voice-tone-guide.md: no em-dashes, no hedging, no filler.

Ruled out

  • Never blend two components in one spec, such as a Button with an IconButton. Write separate specs and link them.
  • Never ship a spec without an accessibility section; accessibility is not optional.
  • Never use marketing names for the component or its parts.
  • Never paraphrase props when the code's types exist.
  • Never describe in words what a specific Figma frame, token or code snippet could show.

Not covered

  • Founding the tokens and visual foundations: use /style-guide.
  • Documenting a whole design system that already exists in code: use /design-system-extract.
  • Assessing an existing design system: use /design-system-audit.
  • Auditing a product's accessibility: use /accessibility-audit.
  • Interaction consistency across components: use /interaction-pattern-library.
  • Handing designs to engineering: use /design-handoff.

Example Output

None yet from a real run. examples.md is an illustration generated for the site on 2026-06-04 (commit a7d0d749), not a past run; its InlineAlert spec for a "Meridian Health" portal is not from real work.

Run this now

0/4000

One tool, one hard lesson. Only when there is something worth sending.

Occasional emails. Unsubscribe any time.