shadcn/ui Best Practices

February 20, 2026 ยท View on GitHub

License: MIT Skills

shadcn/ui done right. Local component ownership, cn() class merging, React Hook Form + Zod forms, CSS variable theming, cva variants, Radix primitives, accessible patterns, and the npx shadcn CLI workflow.

AI coding assistants import from @shadcn/ui, use template literals for conditional classes, build forms without React Hook Form, hardcode colors, and skip the CLI. This plugin anchors your agent to the copy-paste ownership model shadcn/ui is built on.

Install

Cursor / Claude Code / Windsurf

npx skills add ofershap/shadcn-best-practices

Or copy skills/ into your .cursor/skills/ or .claude/skills/ directory.

What's Included

TypeNameDescription
Skillshadcn-best-practices12 rules for component ownership, cn(), forms, theming, cva, accessibility, and more
Rulebest-practicesAlways-on behavioral rule that enforces shadcn/ui patterns
Command/auditScan your codebase for shadcn/ui anti-patterns

What Agents Get Wrong

What the agent writesWhat shadcn/ui actually uses
import { Button } from "@shadcn/ui"import { Button } from "@/components/ui/button"
Template literals for conditional classescn() utility from @/lib/utils
Manual form validationReact Hook Form + Zod with <Form> components
Hardcoded color valuesCSS variables (--primary, --background)
Complex conditional class logiccva (class-variance-authority) for variants
npm install @shadcn/uinpx shadcn@latest add button via CLI

If this helped your workflow, a star helps others find it.

Author

Made by ofershap

LinkedIn GitHub

License

MIT