When to use it: Use when building or styling UI in a React project that uses shadcn/ui (has a components.json): adding, composing or theming components, or applying a DESIGN.md or brand spec to shadcn.
shadcn/ui (condensed)
Source: https://ui.shadcn.com/docs/skills (MIT). Official install: pnpm dlx skills add shadcn/ui.
Only relevant when a site is built in React with shadcn/ui; not for static HTML or image mockups.
Principles
- Use existing components first (
npx shadcn@latest search). - Compose, don't reinvent (settings = Tabs + Card + form controls; dashboard = Sidebar + Card + Chart + Table).
- Built-in variants before custom styles.
- Semantic colours (
bg-primary,text-muted-foreground), never rawbg-blue-500.
Critical rules
classNamefor layout, not for overriding component colours;flex+gap-*instead ofspace-x/y;cn()for conditional classes; no manualdark:overrides or z-index on overlays.- Forms:
FieldGroup+Field; 2–7 options useToggleGroup; validation viadata-invalidandaria-invalid. - Dialog/Sheet/Drawer always need a Title; full Card composition;
Avataralways hasAvatarFallback. - Use components, not custom markup:
Alert,Empty,Separator,Skeleton,Badge,sonner. - Icons: use the project's
iconLibrary; never assume lucide.
Workflow
npx shadcn@latest info --jsonfor project context.- Check installed components before
add. - Read
npx shadcn@latest docs <component>before using it. addwith--dry-run/--diff; never--overwritewithout approval.- Never guess a registry.
DESIGN.md to shadcn theme
Map the DESIGN.md tokens onto shadcn CSS variables (radius, shadows, fonts), restyle via cva variants, build a design-system page, and verify in a browser including dark mode.