---
name: design-system-component-build
description: Use this skill when building or scaffolding a UI component in code from a Figma design that must follow the Acme design system. Triggers on "build the X component from Figma", "scaffold this component", "code up this design", "turn this Figma frame into a component", or any request to implement a component that should match both a Figma design and our documented system conventions.
---

# Building design system components from Figma + docs

You implement components by combining two sources of truth, plus your real code:
- **Figma MCP** — the visual design: structure, layout, spacing, sizing, variants, and bound variables/tokens for the selected frame.
- **zeroheight MCP** — the system rules: naming conventions, prop/API patterns, documented states and variants, accessibility requirements, and existing related components.
- **Your code** — the `[insert npm package name]` package and component-library repo already open in your environment is the source of truth for code language, component APIs, props, and types. Read it directly.

Always consult all three.

## Workflow

### 1. Read the design
- Pull the selected component's structure, layout, spacing, sizing, states, and variants from the Figma MCP.
- Identify which Figma variables/tokens are bound to which properties. Record them.

### 2. Read the rules
- Query zeroheight for this component or the closest documented pattern. Check whether it already exists under any name BEFORE building something new — if it does, tell the user and stop.
- Pull the documented naming convention, prop/API conventions, required states, and accessibility requirements.
- Pull any documented composition or do/don't guidance.

### 3. Reconcile conflicts
- If a Figma value is a raw literal (hex, px) but the docs specify a token, use the documented token.
- If a Figma variant has no documented equivalent, surface it and ask before inventing a prop for it.
- If the docs require a state (e.g. disabled, loading) that isn't in the Figma frame, implement it per the docs and flag that it wasn't in the design.

### 4. Match the codebase
- Inspect existing components in the `[insert npm package name]` package and repo. Mirror their file structure, export pattern, styling approach, and prop-typing style.
- Reuse existing primitives and tokens rather than introducing new ones.

### 5. Scaffold
Default deliverables (adjust to repo conventions):
- The component file with a typed props interface.
- All documented variants and states.
- Tokens wired via the documented theme/token API — no hardcoded values.
- Accessibility attributes per the docs (roles, labels, keyboard handling).
- A story file and a test stub matching existing patterns, if the repo uses them.
- Index/barrel export updated.

### 6. Report
At the end, summarise:
- Which Figma node and which zeroheight pages you used.
- Any conflicts you reconciled and how.
- Anything undocumented or missing that needs a human decision.
- A reminder that the new component still needs to be documented in zeroheight (the MCP is read-only).

## Things you must not do
- Do not invent props, variants, or tokens absent from both sources.
- Do not hardcode values that exist as tokens.
- Do not write back to zeroheight or Figma — both MCPs are read-only.
- Do not duplicate an existing component; check first.
- Do not claim the component is production-ready — scaffolds require human review and real tests. Suggest tweaks and changes that the user might have to do themselves.