Skip to main content
skill CX Codex

shadcn · pproenca — Claude Code skill: shadcn/ui rules for your agent

A skill with 58 shadcn/ui rules that tells your agent how to add components, build forms and keep accessibility intact.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add pproenca/dot-skills --skill shadcn -a claude-code
Open on GitHub

What shadcn does

The skill packs community practices for shadcn/ui into 58 rules across 10 categories, ordered by impact. Your agent picks them up when you write, review or refactor components built on Radix and Tailwind. The CRITICAL categories come first: CLI and project setup, component architecture, accessibility preservation.

Each rule has its own reference file, so the agent can pull just the one it needs: setup-components-json, arch-use-asChild-for-custom-triggers, ally-preserve-aria-attributes, form-use-zod-for-schema-validation, data-virtualize-large-lists. Forms with React Hook Form and Zod validation get a category of their own, same for data tables on TanStack Table, theming with CSS variables and dark mode. Performance and state management sit at the bottom of the priority list.

This skill does not replace shadcn/ui itself. It sets boundaries for generated code. If your TypeScript path aliases don't match components.json, the setup rules will fight your project layout, so fix the config first.

What it helps with

  • add components through the CLI instead of copy-pasting from docs
  • wire up a form with React Hook Form and Zod validation
  • set up dark mode through CSS variables
  • virtualize a list with a hundred-plus rows
  • check a component for ARIA attributes and focus handling

Example prompts for the agent

  • add a shadcn Dialog and keep accessibility intact
  • refactor this form to React Hook Form and Zod
  • why does focus break in my shadcn modal?

How to install shadcn

1Skills CLI (Vercel)

npx skills add pproenca/dot-skills --skill shadcn -a claude-code

2Manually: put the files in place

~/.claude/skills/shadcn/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/shadcn/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about shadcn

How do I install the shadcn skill in Claude?

Run npx skills add pproenca/dot-skills --skill shadcn -a claude-code. The skill file lands at ~/.claude/skills/shadcn/SKILL.md.

What does the shadcn skill do?

It hands your agent a rule set for shadcn/ui: project setup, component architecture, accessibility, styling, forms, data display, composition and performance.

Does it only cover Radix and Tailwind?

The rules are written around Radix primitives, Tailwind styling, React Hook Form with Zod and TanStack Table — those are the tools the categories target.

Source text

SKILL.md · MIT
---
name: shadcn
description: shadcn/ui component library best practices and patterns (formerly shadcn-ui). This skill should be used when writing, reviewing, or refactoring shadcn/ui components to ensure proper architecture, accessibility, and performance. Triggers on tasks involving Radix primitives, Tailwind styling, form validation with React Hook Form, data tables, theming, or component composition patterns.
---

# shadcn/ui Community Best Practices

Comprehensive best practices guide for shadcn/ui applications, maintained by the shadcn/ui community. Contains 58 rules across 10 categories, prioritized by impact to guide automated refactoring and code generation.

## When to Apply

Reference these guidelines when:
- Installing and configuring shadcn/ui in a project
- Writing new shadcn/ui components or composing primitives
- Implementing forms with React Hook Form and Zod validation
- Building data tables or handling large dataset displays
- Customizing themes or adding dark mode support
- Reviewing code for accessibility compliance

## Rule Categories by Priority

| Priority | Category | Impact | Prefix |
|----------|----------|--------|--------|
| 1 | CLI & Project Setup | CRITICAL | `setup-` |
| 2 | Component Architecture | CRITICAL | `arch-` |
| 3 | Accessibility Preservation | CRITICAL | `ally-` |
| 4 | Styling & Theming | HIGH | `style-` |
| 5 | Form Patterns | HIGH | `form-` |
| 6 | Data Display | MEDIUM-HIGH | `data-` |
| 7 | Layout & Navigation | MEDIUM | `layout-` |
| 8 | Component Composition | MEDIUM | `comp-` |
| 9 | Performance Optimization | MEDIUM | `perf-` |
| 10 | State Management | LOW-MEDIUM | `state-` |

## Quick Reference

### 1. CLI & Project Setup (CRITICAL)

- [`setup-components-json`](references/setup-components-json.md) - Configure components.json before adding components
- [`setup-path-aliases`](references/setup-path-aliases.md) - Configure TypeScript path aliases to match components.json
- [`setup-cn-utility`](references/setup-cn-utility.md) - Create the cn utility before using components
- [`setup-use-cli-not-copy`](references/setup-use-cli-not-copy.md) - Use CLI to add components instead of copy-paste
- [`setup-css-variables-theme`](references/setup-css-variables-theme.md) - Enable CSS variables for consistent theming
- [`setup-rsc-configuration`](references/setup-rsc-configuration.md) - Set RSC flag based on framework support

### 2. Component Architecture (CRITICAL)

- [`arch-use-asChild-for-custom-triggers`](references/arch-use-asChild-for-custom-triggers.md) - Use asChild prop for custom trigger elements
- [`arch-preserve-radix-primitive-structure`](references/arch-preserve-radix-primitive-structure.md) - Maintain Radix compound component hierarchy
- [`arch-extend-variants-with-cva`](references/arch-extend-variants-with-cva.md) - Use Class Variance Authority for type-safe variants
- [`arch-use-cn-for-class-merging`](references/arch-use-cn-for-class-merging.md) - Use cn() utility for safe Tailwind class merging
- [`arch-forward-refs-for-composable-components`](references/arch-forward-refs-for-composable-components.md) - Forward refs for form and focus integration
- [`arch-isolate-component-variants`](references/arch-isolate-component-variants.md) - Separate base styles from variant-specific styles

### 3. Accessibility Preservation (CRITICAL)

- [`ally-preserve-aria-attributes`](references/ally-preserve-aria-attributes.md) - Keep Radix ARIA attributes intact
- [`ally-provide-sr-only-labels`](references/ally-provide-sr-only-labels.md) - Add screen reader labels for icon buttons
- [`ally-maintain-focus-management`](references/ally-maintain-focus-management.md) - Preserve focus trapping in modals
- [`ally-preserve-keyboard-navigation`](references/ally-preserve-keyboard-navigation.md) - Keep WAI-ARIA keyboard patterns
- [`ally-ensure-color-contrast`](references/ally-ensure-color-contrast.md) - Maintain WCAG color contrast ratios
- [`ally-dialog-title-required`](references/ally-dialog-title-required.md) - Always include DialogTitle for screen readers
- [`ally-form-field-labels`](references/ally-form-field-labels.md) - Associate labels with form controls
- [`ally-aria-invalid-errors`](references/ally-aria-invalid-errors.md) - Use aria-invalid for form error states
- [`ally-checkbox-label-association`](references/ally-checkbox-label-association.md) - Wrap Checkbox with Label for click target
- [`ally-focus-visible-styles`](references/ally-focus-visible-styles.md) - Preserve focus visible styles for keyboard navigation

### 4. Styling & Theming (HIGH)

- [`style-use-css-variables-for-theming`](references/style-use-css-variables-for-theming.md) - Use CSS variables for theme colors
- [`style-avoid-important-overrides`](references/style-avoid-important-overrides.md) - Never use !important for style overrides
- [`style-use-tailwind-theme-extend`](references/style-use-tailwind-theme-extend.md) - Extend Tailwind theme for design tokens
- [`style-consistent-spacing-scale`](references/style-consistent-spacing-scale.md) - Use consistent Tailwind spacing scale
- [`style-responsive-design-patterns`](references/style-responsive-design-patterns.md) - Apply mobile-first responsive design
- [`style-dark-mode-support`](references/style-dark-mode-support.md) - Support dark mode with CSS variables

### 5. Form Patterns (HIGH)

- [`form-use-react-hook-form-integration`](references/form-use-react-hook-form-integration.md) - Integrate with React Hook Form
- [`form-use-zod-for-schema-validation`](references/form-use-zod-for-schema-validation.md) - Use Zod for type-safe validation
- [`form-show-validation-errors-correctly`](references/form-show-validation-errors-correctly.md) - Show errors at appropriate times
- [`form-handle-async-validation`](references/form-handle-async-validation.md) - Debounce async validation calls
- [`form-reset-form-state-correctly`](references/form-reset-form-state-correctly.md) - Reset form state after submission

### 6. Data Display (MEDIUM-HIGH)

- [`data-use-tanstack-table-for-complex-tables`](references/data-use-tanstack-table-for-complex-tables.md) - Use TanStack Table for sorting/filtering
- [`data-virtualize-large-lists`](references/data-virtualize-large-lists.md) - Virtualize lists with 100+ items
- [`data-use-skeleton-loading-states`](references/data-use-skeleton-loading-states.md) - Use Skeleton for loading states
- [`data-paginate-server-side`](references/data-paginate-server-side.md) - Paginate large datasets server-side
- [`data-empty-states-with-guidance`](references/data-empty-states-with-guidance.md) - Provide actionable empty states

### 7. Layout & Navigation (MEDIUM)

- [`layout-sidebar-provider`](references/layout-sidebar-provider.md) - Wrap layout with SidebarProvider
- [`layout-sidebar-collapsible`](references/layout-sidebar-collapsible.md) - Configure sidebar collapsible behavior
- [`layout-sidebar-groups`](references/layout-sidebar-groups.md) - Organize sidebar navigation with groups
- [`layout-sheet-mobile-nav`](references/layout-sheet-mobile-nav.md) - Use Sheet for mobile navigation overlay
- [`layout-breadcrumb-navigation`](references/layout-breadcrumb-navigation.md) - Implement breadcrumbs for deep navigation

### 8. Component Composition (MEDIUM)

- [`comp-compose-with-compound-components`](references/comp-compose-with-compound-components.md) - Use compound component patterns
- [`comp-use-drawer-for-mobile-modals`](references/comp-use-drawer-for-mobile-modals.md) - Use Drawer on mobile devices
- [`comp-combine-command-with-popover`](references/comp-combine-command-with-popover.md) - Create searchable selects with Command
- [`comp-nest-dialogs-correctly`](references/comp-nest-dialogs-correctly.md) - Manage nested dialog focus correctly
- [`comp-create-reusable-form-fields`](references/comp-create-reusable-form-fields.md) - Extract reusable form field components
- [`comp-use-slot-pattern-for-flexibility`](references/comp-use-slot-pattern-for-flexibility.md) - Use slot pattern for flexible content

### 9. Performance Optimization (MEDIUM)

- [`perf-lazy-load-heavy-components`](references/perf-lazy-load-heavy-components.md) - Lazy load components over 50KB
- [`perf-memoize-expensive-renders`](references/perf-memoize-expensive-renders.md) - Memoize list items and expensive components
- [`perf-optimize-icon-imports`](references/perf-optimize-icon-imports.md) - Use direct imports for Lucide icons
- [`perf-avoid-unnecessary-rerenders-in-forms`](references/perf-avoid-unnecessary-rerenders-in-forms.md) - Isolate form field watching
- [`perf-debounce-search-inputs`](references/perf-debounce-search-inputs.md) - Debounce search and filter inputs

### 10. State Management (LOW-MEDIUM)

- [`state-prefer-uncontrolled-for-simple-inputs`](references/state-prefer-uncontrolled-for-simple-inputs.md) - Use uncontrolled for simple forms
- [`state-lift-state-to-appropriate-level`](references/state-lift-state-to-appropriate-level.md) - Lift state to lowest common ancestor
- [`state-use-controlled-dialog-state`](references/state-use-controlled-dialog-state.md) - Control dialogs for programmatic access
- [`state-colocate-state-with-components`](references/state-colocate-state-with-components.md) - Keep state close to where it's used

## How to Use

Read individual reference files for detailed explanations and code examples:

- [Section definitions](references/_sections.md) - Category structure and impact levels
- [Rule template](assets/templates/_template.md) - Template for adding new rules

## Full Compiled Document

For a single-file reference containing all rules, see [AGENTS.md](AGENTS.md).

## Reference Files

| File | Description |
|------|-------------|
| [AGENTS.md](AGENTS.md) | Complete compiled guide with all rules |
| [references/_sections.md](references/_sections.md) | Category definitions and ordering |
| [assets/templates/_template.md](assets/templates/_template.md) | Template for new rules |
| [metadata.json](metadata.json) | Version and reference information |

© pproenca · MIT · pproenca/dot-skills

Similar skills

Everything for Frontend and UI →

shadcn by other authors comes first.

shadcn shadcn-ui A skill that keeps your agent on the rails with shadcn/ui: adds components, searches registries, fixes markup and builds a design system from your spec. CX Codex +1 123,300installs shadcn typeui.sh Gives the agent a shadcn/ui-style design system: tokens, typography, component states and accessibility criteria. CX Codex +1 2,500installs shadcn official Vercel Labs This skill guides Codex through adding shadcn/ui components and configuring themes. Use it when building a React interface with Tailwind CSS. CX Codex GP ChatGPT 72installs shadcn pedronauck Guides AI agents through shadcn/ui and Radix UI best practices. Prevents broken themes and keeps component accessibility intact. CX Codex +1 369installs shadcn PyModel A skill that hands your agent a rulebook for shadcn/ui: component architecture, accessibility, theming, forms and tables. Useful whenever it writes or edits React UI. CX Codex +1 458installs shadcn-ui existential-birds Teaches your agent how to build shadcn/ui components: Radix primitives, Tailwind, CVA variants and data-slot. CX Codex +1 351installs fluid-functionalism mickadesign A skill for building React UIs on the shadcn/ui @fluid registry: springs instead of durations, a hover highlight that glides to the cursor, weight changes that hold layout. CX Codex +1 603installs shadcn-component-review mattbx Reviews finished components and layouts against shadcn patterns: spacing, semantic tokens, primitive composition, and the project's chosen visual style. CX Codex +1 635installs shadcn-layouts jwynia Teaches the agent the CSS models behind shadcn and Tailwind layouts, so height, scroll and flex/grid problems get fixed instead of guessed at. CX Codex +1 457installs shadcn-svelte huntabyte A skill for working with shadcn-svelte: adding components, building interfaces, fixing styles, and debugging projects. Use it if you're building UI with shadcn-svelte on Svelte or planning to start. CX Codex +1 6,700installs tanstack-start-shadcn-tailwind official github A Copilot instruction file that pins the stack to TanStack Start, Shadcn/ui and Tailwind CSS, with Zod validating every external payload. ★ 40,418repo stars

From the same set46

clean-code A skill that feeds the agent 48 rules on naming, functions, errors and tests, drawn from Robert C. Martin's book with modern fixes. Useful during reviews and refactors. CX Codex +1 842installs terminal-ui A skill with 42 rules for TypeScript terminal interfaces: rendering, keyboard input, prompts. Useful when you build a CLI on Ink or Clack. CX Codex +1 836installs typescript-refactor A skill with 47 rules for refactoring TypeScript and React/TSX: type architecture, narrowing, generics, and modern TS 6.0 / React 19 features. CX Codex +1 788installs react-refactor Architectural refactoring skill with 40 rules for React codebases. Guides component decomposition, custom hook design, and module boundaries. CX Codex +1 776installs chrome-extension-ui A rule set for Chrome extension interfaces: when to use a popup versus a side panel, how to keep navigation keyboard-accessible, how to handle loading and errors. CX Codex +1 719installs chrome-extension A skill with 67 rules for Chrome Extensions on Manifest V3. Useful when you write a service worker, a content script, or migrate off MV2. CX Codex +1 717installs shell A skill with 49 rules for bash and POSIX sh: quoting, strict mode, error handling. Useful whenever the agent writes or reviews a script. CX Codex +1 692installs refactor A skill with 43 refactoring rules drawn from Martin Fowler's catalog and Clean Code. Useful when you want the agent to restructure code by a fixed set of rules instead of guessing. CX Codex +1 641installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor