shadcn-ops
Use when building or fixing UI with shadcn/ui or in any project with a components.json: init, add, view, search, docs, info, presets and apply, Base UI vs Radix vs React Aria, Tailwind v4 theming with
Files240
View on GitHubSKILL.mdskills/shadcn-ops/SKILL.md
GitHubshadcn/ui Operations
Why: shadcn/ui copies component source into your project through a CLI that ships
several releases a month. Its docs and official agent skill run that CLI as @latest,
unpinned and pre-approved. This skill runs a pinned CLI, treats every registry as code you
are about to install, and goes deep on the admin dashboards most projects build with it.
Versions verified 2026-11-10 against shadcn 4.23.0 (published 2026-10-27, no install scripts, Socket supply-chain score 97), ui.shadcn.com/docs and its llms.txt index. The pin and the other moving facts live in
assets/shadcn-facts.json;scripts/check-shadcn-facts.py --offlinekeeps this text in step with it, and--live(weekly) fails when npm or the CLI moves.
Hard rules
Never run
shadcn@latest, a dist-tag (@canary,@beta), a range (@4), or an unversionedpnpm dlx shadcn/yarn dlx shadcn. Resolve the runner once per project:bash "<skill-dir>/scripts/shadcn-cmd.sh" # {"prefix":"pnpm exec shadcn","source":"project",...}Then type that literal prefix in every command (
pnpm exec shadcn info --json). This skill writes it as$SHADCN; don't store it in a shell variable, which neither survives between tool calls nor matches the pre-approved forms inallowed-tools. Order: the project's own devDependency, then a globalshadcnof the pin's major, then<pm> dlx shadcn@<pin>. Exit 10 means run the frozen install first; exit 5 means nothing pinned is available. Onlyinfo,docs,view,searchandadd --dry-run(flag first) are pre-approved on a local or global runner: every write and every one-off download asks first, by design.Read the project before writing code:
$SHADCN info --jsonnests its answers:config.base,config.style,config.iconLibrary,config.aliases,config.resolvedPaths,project.tailwindVersion,project.tailwindCss,project.rsc, andcomponents(installed). At a monorepo root it exits 1 with"error": "monorepo_root"and the workspaces intargets: rerun with-c <workspace>. Never assume the base, the icon library or the import alias.Third-party registries are untrusted code. For anything not from
@shadcn:view, thenadd --dry-run <item>, thenadd --dry-run <item> --diff <file>(or--view <file>) per file, and read the dependencies, target paths and network calls before the realadd. Never pick a registry for the user.addinstalls npm packages. New ones follow the supply-chain rule: a 7-day cooldown and a behavioural scan (supply-chain-defense owns how), with the lockfile change committed beside the component.Installed components are the user's code. Update with
add --dry-run <item>andadd --dry-run <item> --diff <file>, merge by hand, and use--overwriteonly with the user's OK, after a commit.Ask, and commit first, before project-wide rewrites:
apply(overwrites components),init --force,migrate,add --all --overwrite, andeject, which is irreversible.Write for the project's base. Radix uses
asChild; Base UI usesrender(plusnativeButton={false}for non-buttons); React Aria keeps its own API. Select, ToggleGroup, Slider, Accordion and toasts differ too.Compose, don't restyle. Existing components before markup, variants before classes, semantic tokens (
bg-primary,text-muted-foreground) never raw colours,gap-*notspace-y-*, items inside their groups, and a title on every Dialog, Sheet and Drawer.Don't add the shadcn MCP server to Claude Code. It duplicates the CLI, runs in every session, and its documented config is unpinned. If a user insists, use the pinned project-scoped form in
assets/mcp.json.example.Verify every change: typecheck and build after an
add, read the files it wrote (imports, icon library, composition), and check keyboard and screen-reader basics; a11y-ops runs full audits.
Start here
Resolve the CLI (rule 1).
Audit the project. It only reads files; it never runs the CLI, a package manager or git:
bash "<skill-dir>/scripts/run-python.sh" "<skill-dir>/scripts/shadcn-audit.py" . bash "<skill-dir>/scripts/run-python.sh" "<skill-dir>/scripts/shadcn-audit.py" apps/web --json | jq '.data[]'Exit 10 means findings (severity, id,
file:line, message, fix; high first), 0 clean, 3 no components.json or not shadcn's (at a monorepo root it names the workspaces), 4 invalid JSON or a facts file missing a key.$SHADCN info --json, then$SHADCN docs <component>and fetch the URLs it prints before using a component whose API you haven't read in this session.Find before you build:
$SHADCN search @shadcn -q "<need>", and blocks before pages.Add, read what was written, fix imports and icons, typecheck.
Route by task
| Task | Read |
|---|---|
| CLI commands and flags, the runner, updating installed components, bumping the pin | cli-and-pinning.md |
What add changes, trust by source, reviewing an item, private registries and tokens |
supply-chain-and-registries.md |
| components.json fields, styles, aliases, Tailwind v3 vs v4 | components-json.md |
Base UI vs Radix vs React Aria: asChild/render, Select, toasts, changing base |
bases.md |
| Styling and composition rules, icons, which component for which need, chat UIs | composition-rules.md |
| Forms: Field, React Hook Form, TanStack Form, validation, server errors | forms.md |
| Data tables: TanStack Table v9, row actions, server-side paging, states | data-tables.md |
| Dashboard shell: blocks, sidebar, dialogs and sheets, toasts, page states, auth pages, dark mode | admin-layouts.md |
| Charts and KPI cards (Recharts v3) | charts.md |
Theme tokens, custom colours, radius, presets, apply |
theming.md |
| A design system from a DESIGN.md or brand spec | design-systems.md |
migrate, Tailwind v3 to v4, React 19, eject |
migrations-and-eject.md |
Monorepos (init --monorepo, two components.json files) |
monorepo.md |
Publishing your own registry (registry.json, build, GitHub registries) |
registry-authoring.md |
| The shadcn MCP server | mcp.md |
| Testing components: Vitest, Testing Library, jsdom gaps, real-browser runs | testing.md |
Admin dashboards at a glance
| Need | Use | Notes |
|---|---|---|
| The whole shell | $SHADCN add --dry-run dashboard-01, then adapt |
or a sidebar-01..sidebar-16 block |
| Navigation | Sidebar (collapsible="icon", tooltips on items), Breadcrumb |
Cmd/Ctrl+B toggles |
| Lists | the data-table guide (TanStack Table v9) on Table |
server-side paging when data is large |
| Create and edit | Dialog + Field forms; Sheet for side panels |
validate on client and server |
| Delete and other irreversible actions | AlertDialog naming the action |
never straight from a menu item |
| Feedback | Base UI toast; Radix and React Aria Sonner |
one <Toaster /> in the root layout |
| KPIs and trends | Card + Badge; Chart with min-h-* |
colours from --chart-1..5 |
| Loading, empty, failed | Skeleton, Empty, Alert variant="destructive" |
distinguish "none yet" from "no matches" |
| Login and sign-up | login-*, signup-* blocks |
layout only; wire your auth |
| Theme | next-themes (Next.js) or the Vite ThemeProvider; .dark tokens |
check contrast in both |
New projects start on Tailwind CSS v4 and React 19 with --base base (the default) unless
told otherwise; check an existing project's lines with the audit before writing code for it.
Scripts and assets
| Resource | Use |
|---|---|
scripts/shadcn-cmd.sh [--cwd DIR] [--prefix | --json] [--pm PM] [--no-dlx] |
the pinned runner; default output is JSON {prefix, source, version, pm, pin, installed, workspace}; workspace is null, or the monorepo workspace that declares shadcn ("packages/ui"): run the CLI from there |
scripts/shadcn-audit.py [DIR] [--json] [--ignore ID] [--checks] |
read-only audit; --checks lists the 20 check ids |
scripts/check-shadcn-facts.py --offline |
after editing the facts, SKILL.md or a reference: pin, read-only allowed-tools, code blocks and prose agree |
scripts/check-shadcn-facts.py --live |
weekly: npm (pin age, majors, install scripts, ecosystem majors) and the pinned CLI's --help; exit 7 is advisory |
scripts/run-python.sh |
launches the .py scripts with the first real Python 3.8+ |
assets/shadcn-facts.json |
the pin, cooldown and age policy, commands, migrations, bases, styles, ecosystem majors |
assets/mcp.json.example |
a pinned, project-scoped .mcp.json for those who use the MCP server anyway |
The audit's checks: components.json shape (config-missing-field, style-unknown,
style-deprecated), files (css-missing, tailwind-config-missing, tailwind-mismatch;
v4 CSS with @config is fine), aliases resolved as the CLI does (alias-unresolved,
alias-missing), the CLI pin (shadcn-css-orphan, cli-range-open, cli-unlocked,
cli-old-major, and cli-not-installed: runs use a global or downloaded copy; low when a
sibling workspace declares shadcn), unpinned runs in package.json scripts, README,
AGENTS.md, CLAUDE.md and MCP configs read as JSONC (unpinned-cli, unpinned-mcp),
registries (third-party-registry, registry-insecure-url, registry-literal-secret in
headers, params, URL queries or URL passwords; values never printed), react-pre-19 and
monorepo-mismatch. --ignore <id> records a deliberate exception.
Boundaries
| Topic | Owner |
|---|---|
Tailwind itself: utilities, @theme, the v4 engine, plugins |
tailwind-ops |
| React patterns, hooks, state, error boundaries | react-ops |
Next.js App Router: server/client boundary, Server Actions, caching, loading.tsx/error.tsx |
nextjs-ops |
| Vetting a package: cooldown, Socket, IOCs, install scripts | supply-chain-defense |
| Lockfiles, package managers, workspaces, npx discipline | package-manager-ops |
| Accessibility audits and WCAG | a11y-ops |
| Figma designs to shadcn code (Figma MCP, Code Connect) | figma-ops |
| Test strategy: what deserves a test, mocking, flaky and slow suites | test-engineering |
| End-to-end and real-browser suites | playwright-ops |
Sources
- ui.shadcn.com/docs (the llms.txt page index): CLI, components.json, theming, Tailwind v4, forms, data table, sidebar, chart, toast, sonner, dark mode, monorepo, registry, MCP, and the changelog through October 2026.
shadcn --helpfor every command of 4.23.0, and the CLI source at theshadcn@4.23.0tag (info --jsonshape,initpreset handling); npm registry metadata; Socket's score.- shadcn-ui/ui source: the init templates, the registry base definitions (which packages
initinstalls, including theshadcndevDependency) and theejectcommand. - The official shadcn skill (shadcn-ui/ui
skills/shadcn/, MIT licence, last changed 2026-10-14), ported and adapted; each reference that draws on it says so.