Skill library

Agent skill Frontend

shadcn/ui

Find, install, style and compose shadcn/ui components using the project’s existing presets and design tokens.

  • React
  • UI components
  • Component registry

Install the skill

Installation method

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

npx skills@latest add shadcn-ui/ui --skill shadcn --agent claude-code --yes

Check this file in your project.claude/skills/shadcn/SKILL.md

Other ways to install
  • Choose an assistant interactively

    npx skills@latest add shadcn-ui/ui --skill shadcn

    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. Open an app that already has a components.json file. Run shadcn CLI commands from that app with its package runner.

View operation manual

What this skill helps with

  • Read the project’s component configuration and registry settings.
  • Choose components and blocks that suit the page.
  • Compose and style components with the project’s established patterns.

Good for

  • Building a hero from a component registry
  • Styling forms and navigation
Project context
Base library, aliases, presets, and installed components
Components
Registry items installed as source files in your project
Theming
Existing semantic CSS tokens and component variants
Change preview
Dry runs for additions and diffs for local components
Skill name
shadcn
Repository
shadcn-ui/ui

Start with the project’s components

A request without project context

Use shadcn to build a settings page and add whatever you need.

The project configuration tells the assistant which base, aliases, and existing components it can use.

A scoped request

  1. Name the target route, then inspect its components.json and the UI components already present.
  2. Find documentation for the detected base and preview any missing registry items.
  3. Compose the UI with project tokens and verify keyboard behavior and states.

Operation manual

Start from your shadcn/ui project configuration. Use the skill to compose a settings form or review an update to a customized component.

Use a display name field and a notifications switch. Keep the project’s existing theme, validation, and save behavior.

  1. Find the project’s shadcn configuration

    Locate the settings route, read the nearest components.json, and inspect the components that are already installed.

    • Check the primitive library, aliases, CSS path, and npm or other package runner for the target app.
    • In a monorepo, run the context command from the app that owns the settings route.
    Prompt · Step 1
    Use the installed shadcn skill for [settings route or file]. Ask me for the target if it is unclear. Locate the app that owns this route and read its components.json and package configuration. If needed, run npx shadcn@latest info --json from that app using its package runner.
    
    Identify the primitive library, import aliases, global CSS path, and installed UI components. Find the current form, validation, and save handler. List what we can reuse and what is missing, and show me the project findings before adding files.
    npx shadcn@latest info --json
  2. Check documentation and preview missing components

    Resolve component docs for the actual project base. Preview a registry addition only when a required component is missing.

    • Use the official shadcn/ui registry for this example. Read the URLs returned by the docs command for the detected base.
    • If Field is missing, use the dry run to see the files and dependencies it would add. If a local component already satisfies the need, reuse it.
    Prompt · Step 2
    Use the shadcn skill and the project findings for [settings route or file]. Reuse the available components. Use the official shadcn/ui registry for any required missing component.
    
    Run npx shadcn@latest docs field input button switch with the project's package runner and read the returned documentation for the detected base. If Field is missing, run npx shadcn@latest add field --dry-run to review the proposed files and dependencies. Use the same preview approach for any other required missing component.
    
    Add only the components needed for the approved form and keep existing component customizations. Report what you reused, what you added, and any proposed changes that require review.
    npx shadcn@latest docs field input button switch
    npx shadcn@latest add field --dry-run
  3. Compose the form with visible labels and errors

    Use the installed Field primitives to group controls and make validation understandable.

    • Associate the display name input and notifications switch with their own labels.
    • Use data-invalid on the Field and aria-invalid on the invalid control. Associate the error message with the control.
    • Keep the project’s semantic theme tokens, component variants, and save behavior.
    Prompt · Step 3
    Use the shadcn skill to implement the agreed form on [settings route or file]. Follow the detected project's component APIs and existing form state. Use FieldGroup and Field to arrange a display name Input and a notifications Switch. Associate each control with an appropriate FieldLabel.
    
    Connect existing validation to FieldError. Set data-invalid on the affected Field and aria-invalid on its control, and associate the error text with that control using aria-describedby. Reuse the existing save handler, semantic tokens, and button variant. Keep the form responsive and preserve entered values after a failed save.
  4. Test the form in the actual app

    Walk through editing, validation, and saving by keyboard and at a narrow viewport.

    • Use Tab to reach each control and use the keyboard to toggle notifications.
    • Submit an invalid display name and check that the error is visible and associated with its field.
    • Save a valid change and check the successful state and persisted value. Exercise a failed save when possible.
    • Check narrow layouts and each theme supported by the app.
    Prompt · Step 4
    Use the shadcn skill to verify the form at [settings route]. Check the edited files against the detected configuration and the component documentation. Test keyboard focus order, control labels, the notification switch, invalid input, successful save, and failure recovery. Check a narrow viewport and the themes this app supports.
    
    Verify that aliases, component variants, and semantic colors follow the project. Use this project's existing tests and browser tools where available. Report the changed files, checks that passed, and any interactions that still need verification.

Look up a component or project setting

Use the command with the package runner for your project and check its output before changing files.

Check which base and aliases the project usesinfo --json
Command or reference
npx shadcn@latest info --json
Examples
Read the returned config and installed component list.
Find the correct examples for the form componentsdocs
Command or reference
npx shadcn@latest docs field input button switch
Examples
Open the docs URLs returned for the project’s base.
Check which files a missing Field would add--dry-run
Command or reference
npx shadcn@latest add field --dry-run
Examples
Review planned changes before adding the component.
Compare an existing Button with the registry--diff
Command or reference
npx shadcn@latest add button --diff
Examples
Identify local variants before deciding what to merge.

Troubleshooting and FAQ

Does installing the skill also install UI components?

Installing the skill gives the assistant usage instructions. Use the shadcn CLI to add individual missing components to your app.

Why do the props in an example differ from my locally installed component?

Check the primitive library and the component source in your project. Follow the docs for that base and account for any local customizations.

Why does the form look different from the rest of my app?

Confirm that the form imports your project’s components and uses their existing variants. Use the configured CSS file and semantic tokens to keep supported themes consistent.