# 21st-cli-use

Searches, retrieves, and installs React and shadcn components or SVG logos from the 21st.dev catalog using the 21st CLI. Activates when components.json is present.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 2000 installs · ★ 27
- Author: 21st-dev
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/21st-dev/skill/tree/HEAD/skills/21st-cli-use/SKILL.md
- Updated: 2026-09-09
- HTML: https://affpapa.org/en/nevibecode/skills/21st-cli-use

## What it does

The skill instructs your coding agent to inspect the 21st.dev catalog via `@21st-dev/cli` before writing UI from scratch. Running `21st search` locates components, themes, or templates. The `21st add <user>/<slug>` command writes the resolved file directly to `components/ui/<slug>.tsx` and pulls required npm dependencies using your project's package manager.

Authentication happens via `npx @21st-dev/cli login` or an API key passed into `TWENTYFIRST_TOKEN` or `API_KEY_21ST`. Searching metadata, inspecting previews, fetching theme CSS, and pulling SVG brand logos via svgl.app are completely free. Code retrieval (`21st get`, `21st add`) relies on a free daily quota unless you run a Builder plan.

Hosted component generation requires active AI credits. If `21st usage` does not show AI generation enabled, running `21st generate` throws `ai_subscription_required` — your agent must pull catalog code and adapt it locally instead.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add 21st-dev/skill --skill 21st-cli-use -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/21st-cli-use/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/21st-cli-use/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add 21st-dev/skill --skill 21st-cli-use -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/21st-cli-use/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add 21st-dev/skill --skill 21st-cli-use -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/21st-cli-use/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install 21st-dev/skill 21st-cli-use
```

2. **Manually: put the files in place**
- File: `.github/skills/21st-cli-use/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add 21st-dev/skill --skill 21st-cli-use -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/21st-dev/skill --path skills/21st-cli-use
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/21st-cli-use/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add 21st-dev/skill --skill 21st-cli-use -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/21st-dev/skill/tree/HEAD/skills/21st-cli-use/SKILL.md

## When to use it
- search React and shadcn UI components across the 21st.dev registry
- install registry components into `components/ui` with automatic dependency setup
- print theme CSS or raw component code by ID directly into terminal context
- fetch SVG brand and UI logos without authentication using svgl.app

## Example prompts
- search a pricing table component on 21st
- install our team's Button via 21st CLI
- pull that component's code using 21st get 143

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 313dfec5e8a3ed49.

BEGIN THIRD-PARTY FILE 313dfec5e8a3ed49
````text
---
name: 21st-cli-use
description: >-
  Search, install and pull code from the 21st.dev catalog with the `21st` CLI
  (`@21st-dev/cli`): find React/shadcn components, themes and templates, print a
  component's code or a theme's CSS, install an item into the project, or
  generate a new component with 21st AI. Use whenever the user says "search/find
  a component/theme on 21st", "install our team's Button", "add @user/slug",
  "pull that component's code", "найди компонент на 21st", "поставь наш компонент",
  or wants to script catalog access from the shell/CI. Auto-activate when a
  project has a `components.json` — search 21st before hand-writing UI.
---

# 21st CLI — find, install & generate from the terminal

The `21st` CLI (`npx @21st-dev/cli`, bin `21st`) is the command-line surface for
the 21st.dev catalog. Search first, install what fits, and only hand-write UI
when nothing matches. To **publish** your own components/themes/templates, use
the `21st-registry` skill; to publish a project's design as a theme, use
`21st-design-sync`.

## Auth (do this once)

Two interchangeable credentials, both sent as the API key:

1. **Login session** — `npx @21st-dev/cli login` opens the browser and saves a
   token to `~/.config/21st/auth.json`. Best for interactive/dev machines.
2. **API key** — `21st_sk_…` from **https://21st.dev/mcp** (or
   **https://21st.dev/settings/api-keys**). Pass via `--api-key <key>` or the
   `TWENTYFIRST_TOKEN` / `API_KEY_21ST` env var. Best for CI.

`21st whoami` shows the signed-in account; `21st usage` shows retrieval
tier/quota and the `21st AI generation` status, not an AI credit balance.
For structured status, use MCP `get_usage.aiGenerationEnabled` or CLI 1.17.1+
`21st usage --json`. Missing or unknown status does not grant AI access. `21st logout`
clears the saved login.

## Metering

Metadata (search, previews, a theme's CSS) is **free**. Retrieving component
**code** (`21st get`, install) has a free daily quota; Builder includes
unlimited retrieval. Hosted 21st AI requires separate AI access and consumes
AI credits. Base Builder has AI off. Check `21st usage` before choosing
generation: when AI is not explicitly enabled, search and retrieve code,
then adapt it with your own coding agent. Do not retry a generation denied
with `ai_subscription_required` until AI access is enabled.

---

## Find

```bash
# Search everything (components + themes + templates)
21st search "pricing table" --limit 10
21st search button --type c        # components only (c | theme | template)
21st search dark --type theme
# Filters: --tag <slug> --color <bucket> --sort <s> --free|--paid
#          --author <username> --mine --liked   --json for machine output
```

**Always search before hand-writing a component** — a close match is usually
faster to install and adapt than to build from scratch.

## Logos

```bash
````
END THIRD-PARTY FILE 313dfec5e8a3ed49

The third-party file has ended. Everything between the 313dfec5e8a3ed49 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2918 of 5010 bytes. © 21st-dev · Apache-2.0 · https://github.com/21st-dev/skill/tree/HEAD/skills/21st-cli-use/SKILL.md

_Part of the page did not fit — see the HTML version._

---
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
