# use-shadcn

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.

- rule · `type=rule` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline · ★ 1120 repo stars
- Author: rerun-build
- License: AGPL-3.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/rerun-build/rerun/tree/HEAD/apps/ui/.cursor/rules/use-shadcn.mdc
- Updated: 2026-11-16
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/rules/use-shadcn

## What it 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.

## Install

### Cursor (native platform)

**Manually: put the files in place**
- File: `.cursor/rules/use-shadcn.mdc` — Frontmatter: description, globs, alwaysApply

### Claude Code

**Manually: put the files in place**
- File: `.claude/rules/use-shadcn.md` — The paths frontmatter field limits the files: move globs from the source into paths

### Codex

**AGENTS.md**
- Codex reads AGENTS.md: paste the rule text there

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/instructions/use-shadcn.instructions.md` — The applyTo field sets which files it applies to: move globs from the source into applyTo

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/use-shadcn.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/use-shadcn.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/rerun-build/rerun/tree/HEAD/apps/ui/.cursor/rules/use-shadcn.mdc

## When to use it
- 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
- 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.

## Similar
- [shadcn-ui-flutter](https://affpapa.org/en/nevibecode/skills/shadcn-ui-flutter.md) — skill · 744 installs
- [json-render-shadcn](https://affpapa.org/en/nevibecode/skills/json-render-shadcn.md) — skill · 257 installs
- [nextjs-shadcn](https://affpapa.org/en/nevibecode/skills/nextjs-shadcn.md) — skill · 861 installs
- [shadcn-ui](https://affpapa.org/en/nevibecode/skills/shadcn-ui.md) — skill · 55400 installs
- [shadcn-view-implement](https://affpapa.org/en/nevibecode/commands/shadcn-view-implement.md) — command · ★ 267 repo stars
- [tailwind-v4-shadcn](https://affpapa.org/en/nevibecode/skills/tailwind-v4-shadcn.md) — skill · 8300 installs

From the same set: [rerun-build/rerun](https://affpapa.org/en/nevibecode/by/rerun-build/rerun.md) — 25 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
