shadcn

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

4|Updated Jul 13, 2024
One-click install
npx skills add https://github.com/PunGrumpy/og-tester --skill shadcn-pungrumpy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: shadcn
Source: https://github.com/PunGrumpy/og-tester/tree/main/.agents/skills/shadcn
Command: npx skills add https://github.com/PunGrumpy/og-tester --skill shadcn-pungrumpy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building UI with shadcn/ui requires knowing the correct component APIs, composition rules, and CLI workflows, which differ between base and radix primitives and across presets. This Skill provides the project context, enforced styling rules, and CLI commands needed to add, update, debug, and compose shadcn/ui components correctly. ## Core Features & Use Cases - Component Management: Search registries, add components, preview changes with dry-run and diff, and smart-merge upstream updates while preserving local modifications. - Enforced Code Rules: Applies critical rules for forms (FieldGroup/Field), styling (semantic tokens, gap spacing), composition (Groups, Titles, AvatarFallback), icons (data-icon), and chat primitives (MessageScroller, Bubble, Attachment, Marker). - Preset & Theme Workflows: Initialize projects with named presets or preset codes, switch presets via overwrite/partial/merge/skip strategies, and customize themes through CSS variables. - Use Case: When asked to build a settings form in a Next.js project, the Skill reads the project context via npx shadcn@latest info, fetches component docs, and generates code using FieldGroup, ToggleGroup, and proper validation attributes instead of raw divs and manual state. ## Quick Start Ask the assistant to add a shadcn/ui component or build a UI pattern, for example: add a login form block to my project using the shadcn CLI.

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, such as npx shadcn@latest add button card dialog. Use the package runner matching your project, like pnpm dlx or bunx, and check installed components first with npx shadcn@latest info.

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

How do I apply or switch a shadcn preset code?

Pass the preset code directly to npx shadcn@latest apply <code> for existing projects or npx shadcn@latest init --preset <code> for new ones. Never decode preset codes manually; use preset decode, preset url, or preset resolve commands to inspect them.

Can I use third-party or GitHub registries with shadcn?

Yes, you can add items from namespaced registries like @magicui or public GitHub repos using owner/repo/item addresses. After adding third-party components, verify the added files and fix hardcoded import paths to match your project's aliases.

Why should I not use space-y or raw colors in shadcn components?

The skill enforces gap-* utilities 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 ensures dark mode works without manual overrides.