/21st:21st-aifrom 21st
Generates and iterates on UI drafts from the terminal using 21st AI: sketch variants from a prompt, preview in browser, edit with natural language, and pull final code into the project.
Ships in 21st. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
21st AI is a fast UI-drafting board. Mental model: draft it here, then finish
it — sketch a few variants from a prompt, preview them, refine the one you like
with plain-English edits, and pull its code into the repo. The whole loop runs
from the 21st CLI (or the matching MCP tools), so you never leave the editor.
Sketch mode produces self-contained HTML + Tailwind drafts (fast, no build). The recommended handoff is the copy-prompt: a spec that tells you to rebuild the design in the target project's real stack — not paste raw HTML verbatim.
Same credential as the rest of the CLI: 21st login (saved token) or a
21st_sk_ key via --api-key / TWENTYFIRST_TOKEN. 21st usage (MCP:
get_usage) shows the account tier, aiGenerationEnabled, and remaining free
daily component-code retrieval quota. It does not report the AI credit balance.
(See the 21st-cli-use skill for the full auth notes.)
Before generating or iterating, check MCP get_usage.aiGenerationEnabled or
the 21st AI generation line from 21st usage. CLI 1.17.1 also supports
21st usage --json. Proceed only when AI is explicitly enabled; missing or
unknown status does not grant access. A base Builder
subscription does not enable AI. When it is false, use search →
get_component and adapt the code with the user's own agent. Do not attempt
generate or iterate_generation, including through the CLI as a fallback.
# 1) Sketch — generate variants ("takes") from a prompt. Opens the preview in
# the browser and prints the projectId.
21st generate "a pricing section with 3 tiers and a monthly/annual toggle"
# 2) List the takes (1-based numbers + whether each has rendered yet).
21st generation <projectId>
# 3) Edit ONE take in place with a natural-language change (PAID — see Metering).
21st iterate <projectId> "make it enterprise-flavored, add an annual toggle" --take 3
# 4) Grab the code to bring into the project (FREE).
21st take <projectId> --take 3 # paste-ready copy-prompt (recommended)
21st take <projectId> --take 3 --code # raw self-contained HTML instead
Open the preview URL (printed by generate, and returned by iterate) in the
editor's built-in browser to watch the variants render and update in place.
--take N to act on.--code prints the raw HTML. Both FREE and unlimited.The same loop is exposed as MCP tools for MCP hosts (Cursor, Claude Desktop,
Claude Code): generate (with mode: "sketch"), get_generation,
iterate_generation and get_take. iterate_generation also returns the
freshly-edited html + copyPrompt, so you can grab the code without a second
call. Wire up the server with 21st init --client <name> --write.
The MCP tool list depends on the account: generate and iterate_generation
are listed only when AI is enabled. get_generation and get_take remain
available for reading existing drafts. After enabling AI, refresh the client's
tool list or reconnect the MCP server. If a cached tool call returns
ai_subscription_required, stop generation attempts and use the component
search and retrieval workflow above.
generation / the "Take N" label in
the preview. --take must be a whole number ≥ 1 (a bad value errors rather
than silently editing take 1).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub 21st-dev/claude-code-plugin --plugin 21st7 skills in this plugin
/21st-cli-useSearch, 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-design-syncLook at the current project's design (its shadcn / Tailwind CSS variables and color tokens) and publish it to the 21st.dev community as a shareable theme, using `21st publish-theme`. Use when the user says "publish my theme", "share our design as a 21st theme", "sync my design to 21st", "turn my globals.css into a theme", "залей наш дизайн темой", "опубликуй тему". This is the 21st equivalent of design-sync: it reads the project's design tokens and syncs them into the public theme library./21st-registryPublish your own work to 21st.dev and manage it from the terminal with the `21st` CLI (`@21st-dev/cli`): publish a React component to a team library, publish a CSS theme or a template listing, edit / unpublish / delete your published items, list and reopen existing component work, and read/replace your public profile page (bento board). Triggers when the user says "publish/share/upload this to 21st", "залей в наш регистр", "опубликуй компонент/тему/темплейт", "share with team", "make this reusable", "unpublish/edit/delete my component", "change its visibility", "find/open my old component or draft", "найди/открой мой старый компонент или драфт", "add this to my 21st profile/bento", "update my profile page", "обнови мой профиль на 21st", "добавь блок в бенто", "add controls/knobs to my demo", "сделай демо с контролами". For finding and installing existing items use `21st-cli-use`; for turning a project's design tokens into a theme use `21st-design-sync`.Other plugins' skills for the same job