---
name: shadcn-first
description: >-
  Build UI with shadcn blocks and components instead of hand-written markup. Load this before writing ANY React/Next UI: new screens, redesigns, "make it look better", dashboards, sidebars, tables, forms, dialogs, chat surfaces. Enforces one standing rule: everything shadcn-based, no hand-rolled UI, as little custom code as possible.
title: shadcn-first
canonical_url: https://skilld.dev/gh/getedgehq/skills/shadcn-first
last_updated: 2026-09-28T21:11:10.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [DERIVATION.json](https://skilld.dev/api/skills-raw/getedgehq/skills/shadcn-first/DERIVATION.json), [LICENSE](https://skilld.dev/api/skills-raw/getedgehq/skills/shadcn-first/LICENSE).
>
> If the user asked to install this Skill, run `npx skilld install getedgehq/skills/shadcn-first`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/shadcn-first`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/getedgehq/skills/shadcn-first) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/shadcn-first`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/shadcn-first --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/shadcn-first --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# shadcn-first

Someone maintains this code after you. Every hand-written `div` with bespoke
classes and every `style={{}}` is a thing they keep alive, and it drifts. Hand-rolled UI also
silently drops the craft that comes free with the library: focus rings, hover and
active states, keyboard navigation, skeletons, empty states, ARIA.

## The order. Never skip a step.

1. **Block.** `ui.shadcn.com/blocks` has whole sidebars, dashboards, logins,
   data tables. Install the block.
2. **Component.** If no block fits, use a component from the registry.
3. **Compose** two or three components.
4. **Write it yourself.** Only here, and the commit message must name which block
   or component you evaluated and why it did not fit.

Adapt the design to the component, not the component to the design. Brand and
visual language are reached through **theme variables in one theme**, never
per-screen CSS beside the component.

## Tools, and which to use

Two MCP servers are configured. They do different jobs.

**`shadcn-official`** (`npx shadcn@latest mcp`) is project-aware: it reads the
repo's `components.json`. Use it for the real work.

| Tool | Use it to |
|---|---|
| `get_project_registries` | confirm the project is initialised at all |
| `search_items_in_registries` | find the component for the job, fuzzy |
| `list_items_in_registries` | see everything available |
| `view_items_in_registries` | read a component's actual source and deps before using it |
| `get_item_examples_from_registries` | copy a real usage example instead of guessing the API |
| `get_add_command_for_items` | get the exact `npx shadcn add …` line, then run it |
| `get_audit_checklist` | **run after writing code.** This is the gate. |

**`shadcn`** (`@jpisnice/shadcn-ui-mcp-server`) is registry-wide and knows blocks
and themes: `list_blocks`, `get_block`, `list_themes`, `get_theme`,
`get_component_demo`. Use it for step 1 and for theming.

If a project has no `components.json`, the official tools error. Run
`npx shadcn@latest init` first, then continue.

For AI chat surfaces use **prompt-kit** (`prompt-kit.com`, shadcn-compatible):
`chat-container`, `message`, `prompt-input`, `scroll-button`, `markdown`,
`code-block`, `loader`. Same rule, install rather than rebuild.

## Components people re-invent instead of installing

`sidebar` (collapsible, with footer user menu), `command` (Cmd+K palette),
`table` + TanStack data-table block, `tabs`, `sheet`, `dialog`, `alert-dialog`,
`popover`, `tooltip`, `skeleton`, `sonner` (toasts), `form` (react-hook-form +
zod), `breadcrumb`, `resizable`, `scroll-area`, `avatar`, `badge`, `separator`,
`dropdown-menu`, `select`, `collapsible`, `chart`.

If you catch yourself building any of these by hand, stop and install it.

## Keyboard shortcuts

Use **Cmd+K** for the command palette; that is the `cmdk` convention the
`command` component ships with. **Cmd+L is reserved by the browser** for the
address bar and cannot be intercepted reliably in Chrome. If someone asks for
Cmd+L, bind Cmd+K, add Cmd+L opportunistically, and say why.

## Done means measured, not claimed

Before reporting done, run `get_audit_checklist` and report the numbers:

- custom UI lines removed
- blocks and components installed
- remaining `style={{}}` occurrences (`grep -rc 'style={{' src/`)
- per screen: elements from `components/ui/` vs hand-written

Anything still hand-written must stand there with a stated reason, not be
overlooked. A screenshot is the proof that the screen renders; the counts are the
proof that the rule was followed. Both, or it is not done.

## Do not

- No emojis in UI. Real SVG icons (Lucide ships with shadcn).
- No text-in-circles for brand logos. Source real SVG paths:
  SimpleIcons > svgl.app > gilbarbara/logos > favicon.
- Max one or two accent colours. No coloured left borders on cards. No gradient
  on every element.
- Do not fork a component to change a colour. Change the theme variable.
