shadcn

Manages shadcn/ui components via CLI for adding, searching, styling, and composing React UI.

Updated Aug 2, 2026
One-click install
npx skills add https://github.com/leonardoacosta/skills --skill shadcn-leonardoacosta
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: shadcn
Source: https://github.com/leonardoacosta/skills/tree/main/web-frontend-kit/skills/shadcn
Command: npx skills add https://github.com/leonardoacosta/skills --skill shadcn-leonardoacosta

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working with shadcn/ui requires knowing the correct CLI commands, registry conventions, composition rules, and project-specific configuration (aliases, icon library, base vs radix primitives). This Skill eliminates guesswork by injecting live project context and enforcing correct component usage patterns, preventing common mistakes like hardcoded imports, missing accessibility titles, or wrong icon packages. ## Core Features & Use Cases - CLI-driven component management: Add, search, view, diff, and update components from official and community registries using npx shadcn@latest, with dry-run and smart-merge workflows that preserve local customizations. - Composition and styling rules: Enforces correct patterns for forms (FieldGroup/Field), overlays (Dialog with DialogTitle), icons (data-icon attribute), and Tailwind styling (semantic tokens, gap-* spacing, cn() utility). - Preset and theme management: Initialize projects with named presets or preset codes, switch presets safely (reinstall, merge, or skip), and customize themes via CSS variables for Tailwind v3 and v4. - Use Case: When asked to build a settings form in a Next.js project, the Skill reads the project context, fetches component docs, and generates code using FieldGroup, ToggleGroup, and proper validation attributes matching the project's radix or base primitive library. ## Quick Start Ask the agent to add a shadcn/ui component such as a dialog or build a settings form using shadcn/ui in the current project.

Frequently Asked Questions about shadcn

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add shadcn/ui components to my project?

Run npx shadcn@latest add followed by the component names, using your project's package runner (npx, pnpm dlx, or bunx). Check installed components first with npx shadcn@latest info, and use --dry-run or --diff to preview changes before writing files.

How do I update shadcn components without losing my customizations?

Use the smart merge workflow: run npx shadcn@latest add <component> --dry-run to see affected files, then --diff <file> to compare upstream changes against your local version. Apply upstream updates manually where local changes exist, and never use --overwrite without explicit approval.

What is the difference between base and radix in shadcn/ui?

The base field in components.json determines the primitive library, which changes component APIs. Radix uses asChild for composition while base uses render; Select, ToggleGroup, Slider, and Accordion also have different props and value types between the two. Check the base field via npx shadcn@latest info.

Why do community registry components have wrong imports after adding them?

Third-party registries like @magicui often hardcode @/components/ui paths that may not match your project's actual aliases, and the CLI only rewrites imports for its own first-party UI files. After adding, check non-UI files and rewrite imports to match your project's aliases and configured icon library.

How do I switch shadcn presets safely?

Run npx shadcn@latest init --preset <code> --force inside your project directory, choosing reinstall (overwrite all components), merge (smart-merge each component), or skip (config and CSS only). The CLI preserves your current base automatically inside the project; in a temp directory you must pass --base explicitly.