use-shadcn — Claude Code rule: what it does, how to install
This rule for Claude Code, Codex, and Cursor guides agents to reuse shadcn/ui components. When building UI, it directs them to look for existing project components first.
AGPL-3.0 ★ 1,120 updated 2026-11-16
.cursor/rules/use-shadcn.mdcWhat use-shadcn does
The rule tells an agent to look for reusable project components before creating new UI elements. It covers common primitives such as buttons, dialogs, inputs, selects, tooltips, and cards.
The agent checks src/components/ui/ and src/components/ for existing components. If the project lacks one but shadcn/ui offers it, the rule points to npx shadcn@latest add <component> for adding it. Existing primitives should not be rebuilt from scratch.
What it helps with
- find existing UI components in a project
- reuse a shadcn/ui button or dialog
- add an available shadcn/ui component to a project
Example prompts for the agent
- Build a settings dialog using components already in the project.
- Create a form with the existing input and select components.
- Check whether the project has a card component for this section.
How to install use-shadcn
Manually: put the files in place
.cursor/rules/use-shadcn.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/use-shadcn.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/use-shadcn.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/use-shadcn.mdManually: put the files in place
.clinerules/use-shadcn.mdStep by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules
Questions about use-shadcn
How do I install use-shadcn in Claude Code?
Add the rule file at .claude/rules/use-shadcn.md.
What does use-shadcn do?
It directs agents to search for reusable UI components in the project before making new ones. When a needed component is missing, it points to the shadcn/ui add command.
Which folders does use-shadcn check?
It directs the agent to look in src/components/ui/ and src/components/.