Skill library

Agent skill Frontend

Building Components

Build or refine reusable components for a web interface.

  • UI components
  • Accessibility
  • Design systems

Install the skill

Installation method

Run the command from your project root with Node.js and npm.

npx skills@latest add vercel/components.build --skill building-components --agent claude-code --yes

Check this file in your project.claude/skills/building-components/SKILL.md

Other ways to install
  • Choose an assistant interactively

    npx skills@latest add vercel/components.build --skill building-components

    Select your assistant and choose the project installation scope.

    Official instructions

The tested Skills CLI 1.10.0 requires Node.js 22.20 or later. Use an existing React project with a local preview. The official reference uses @radix-ui/react-use-controllable-state, verified locally at 1.3.0 with React 19.2.0.

View operation manual

What this skill helps with

  • Build or refine reusable components for a web interface.

Good for

  • Component implementation
Skill name
building-components
Scenario
Build a stepper with controlled and uncontrolled state
Deliverable
A stepper with documented state props and observable behavior in both caller modes.
Skill name
building-components

Define a styling task with a visible result

A request with an unclear outcome

Create internal state and sync it from props on every render.

Duplicating ownership makes it unclear which value controls output and when the callback should fire.

A workflow with observable results

  1. Define the API and state owner
  2. Build both modes with native controls
  3. Verify native activation and state ownership

Building Components operation manual

Define a small public component contract, then test which caller owns each displayed state.

Replace the bracketed details with your own project and target.

  1. Define the API and state owner

    Decide which props set a default, control the value or report a change.

    Prompt · Step 1
    Use building-components with [React stepper requirement]. Read references/state.mdx and list the consumer-facing props for controlled and uncontrolled modes. Decide a default and a change callback, which primitive owns the native button and published state attributes, and how the local preview demonstrates each caller. Check for an existing controllable-state helper or show any dependency addition for approval.
  2. Build both modes with native controls

    Tie the displayed count to one state owner at a time.

    Prompt · Step 2
    Use building-components to implement [approved stepper API]. Let value control the display when supplied and defaultValue seed local state otherwise. Invoke onValueChange on an increment request, use a named native button and expose data-state only for a documented styling purpose. Add two local examples showing the two ownership models.
  3. Verify native activation and state ownership

    Exercise the local value and the controlled callback independently.

    • The uncontrolled example updates from its default.
    • The controlled example emits a request while its displayed value remains owned by the parent.
    Prompt · Step 3
    Use building-components to verify [local stepper examples] using real keyboard activation and a pointer click. For the uncontrolled example confirm the default and its update. For controlled mode confirm the callback receives the next value, and that the displayed number follows the parent even when the parent declines the update. Record the props examples and observed callbacks.

Find the relevant rule

Point the assistant to the installed Skill and a specific issue.

The controlled value jumps unexpectedlyReference
Command or reference
references/state.mdx
Examples
Test with a parent that ignores the request and verify the rendered value follows its prop.
A style selector depends on internal class namesReference
Command or reference
references/data-attributes.mdx
Examples
Expose a small documented data-state contract where a consumer needs it.

Building Components troubleshooting

Do I need a registry or npm package to try it?

A local React preview can demonstrate the API and evidence. Distribution has separate guidance in the publisher reference when your project needs it.