shadcn

Manages shadcn/ui components, presets, and registries through the official CLI.

13|3|Updated Aug 16, 2025
One-click install
npx skills add https://github.com/ttymayor/thu-course-frontend --skill shadcn-ttymayor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: shadcn
Source: https://github.com/ttymayor/thu-course-frontend/tree/main/.agents/skills/shadcn
Command: npx skills add https://github.com/ttymayor/thu-course-frontend --skill shadcn-ttymayor

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Working with shadcn/ui involves many CLI commands, registry formats, preset codes, and strict composition rules that are easy to get wrong. This Skill provides the correct workflows for adding, searching, updating, and styling components so generated UI code follows shadcn/ui conventions instead of hand-rolled markup. ## Core Features & Use Cases - Component Management: Add, search, view, and update components from official, namespaced, or GitHub registries using the shadcn CLI with dry-run and diff previews. - Preset & Theme Handling: Initialize projects with named presets or preset codes, apply or merge presets into existing projects, and customize themes via CSS variables. - Composition & Styling Rules: Enforce correct patterns for forms (FieldGroup/Field), chat UI (MessageScroller/Bubble), icons (data-icon), semantic colors, and Tailwind spacing. - Use Case: When building a settings page in a Next.js project, use this Skill to check installed components, fetch docs for Field and ToggleGroup, and generate a form that follows validation and styling rules. ## Quick Start Ask the assistant to add a shadcn/ui component such as a dialog or card to the current project and compose it following the project's preset and styling rules.

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 such as 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 search shadcn registries for components?

Use npx shadcn@latest search with an optional registry namespace like @shadcn or a GitHub owner/repo source, plus -q for a query and -t to filter by item type. Without arguments it searches every registry configured in components.json.

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, and components like Select, ToggleGroup, Slider, and Accordion have different props between the two.

How do I update a shadcn component without losing my changes?

Run npx shadcn@latest add <component> --dry-run to see affected files, then --diff <file> to compare upstream changes against your local version. Merge updates per file, preserving local modifications, and never use --overwrite without explicit approval.

Can I apply a shadcn preset to an existing project?

Yes, use npx shadcn@latest apply <code> in a project with components.json to overwrite preset-driven config, fonts, and CSS variables. Use --only theme,font for partial updates, or init --preset <code> --force --no-reinstall to keep existing components.

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

The styling rules require flex with gap-* instead of space-x-*/space-y-* and semantic tokens like bg-primary instead of raw colors like bg-blue-500. This keeps components consistent with the theme's CSS variables and dark mode behavior.