Skip to main content
rule CX Codex

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

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/use-shadcn.mdc
Open on GitHub

What 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.mdc

Frontmatter: description, globs, alwaysApply

Step 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/.

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set25

The whole set →
english-only The english-only Claude Code rule sets English as the language for interface copy and labels. It applies across project files. CX Codex +1 ★ 1,120repo stars server-actions This Claude Code rule guides the choice between Server Actions and API routes for reading or changing data. It applies when an agent writes server-side application logic. CX Codex +1 ★ 1,120repo stars input-label The input-label Claude Code rule sets how fields get their captions through the Input component. It applies to *.tsx files and disallows a separate caption above the field. CX Codex +1 ★ 1,120repo stars supabase-typed-mutations The supabase-typed-mutations Claude Code rule adds Database types to Supabase insert, update, and upsert calls. It applies while an agent works with these mutations. CX Codex +1 ★ 1,120repo stars one-component-per-file The one-component-per-file Claude Code rule keeps each React component in its own file. It applies to *.tsx files. CX Codex +1 ★ 1,120repo stars realtime This Claude Code rule sets the pattern for Supabase Realtime subscriptions. It directs component code to useRealtimeSubscription instead of calling supabase.channel() directly. CX Codex +1 ★ 1,120repo stars dialog-trigger-pattern The dialog-trigger-pattern Claude Code rule defines how dialog components receive their trigger. It applies to .tsx files. CX Codex +1 ★ 1,120repo stars ai-sdk This Claude Code rule covers structured data generation with the Vercel AI SDK. It applies to TypeScript and TSX files. CX Codex +1 ★ 1,120repo stars

Project sponsors

Companies that keep this analytics open