shadcn

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

Updated Sep 5, 2026
One-click install
npx skills add https://github.com/pohlai88/afenda-xforge-v5 --skill shadcn-pohlai88
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: shadcn
Source: https://github.com/pohlai88/afenda-xforge-v5/tree/main/.agents/skills/shadcn
Command: npx skills add https://github.com/pohlai88/afenda-xforge-v5 --skill shadcn-pohlai88

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Working with shadcn/ui requires knowing the correct CLI commands, component composition rules, and project-specific configuration (base vs radix, Tailwind version, icon library). This Skill eliminates guesswork by injecting live project context and enforcing correct patterns for forms, styling, icons, chat UI, and preset management. ## Core Features & Use Cases - Component lifecycle management: Search registries, preview with dry-run/diff, add components, and smart-merge upstream updates while preserving local changes. - Enforced composition and styling rules: FieldGroup-based forms, semantic color tokens, gap-* spacing, data-icon attributes, and accessibility requirements like DialogTitle and AvatarFallback. - Preset and theme workflows: Init projects with named presets or codes, apply/merge/skip preset switches, and customize themes via CSS variables. - Use Case: A developer asks to build a settings form in a Next.js shadcn project; the Skill reads the project config, fetches component docs, and generates code using FieldGroup, ToggleGroup, and proper validation attributes. ## Quick Start Ask the assistant to add a shadcn dialog component to your project and build a profile edit form using it.

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 component names, using your project's package runner (npx, pnpm dlx, or bunx). Check installed components first with npx shadcn@latest info, and preview changes with --dry-run or --diff before writing files.

How do I update shadcn components without losing my local changes?▼

Use 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 per file while preserving local modifications, 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 between the two. Check the base field via npx shadcn@latest info.

How do I apply or switch shadcn presets in an existing project?▼

Use npx shadcn@latest apply <code> to overwrite with a new preset, or init --preset <code> --force --no-reinstall to update only config and CSS. For partial updates, use apply with --only theme,font. Never decode preset codes manually; pass them directly to the CLI.

Why should I avoid space-y-* and raw colors in shadcn/ui code?▼

The shadcn styling rules require flex with gap-* instead of space-x-*/space-y-*, and semantic tokens like bg-primary or text-muted-foreground instead of raw colors like bg-blue-500. Semantic tokens handle dark mode automatically through CSS variables.

Can I use community registries with the shadcn CLI?▼

Yes, the CLI supports namespaced registries like @magicui, GitHub sources as owner/repo/item, and direct URLs. After adding third-party components, verify imports match your project's aliases and icon library, since registry items may use default paths.