21st Design Sync

21st-dev/skill/skills/21st-design-sync

作者 21st-dev15c7436c41dc無授權條款12 個星標收錄於 2026年10月9日更新於 2026年10月9日儲存庫4 週前更新

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

僅含說明Design & Creative
AI 產生的概覽

讀取專案的 shadcn/Tailwind 設計權杖,並將其以公開主題形式發佈到 21st.dev。

功能
此技能會找出專案的 shadcn/Tailwind CSS 自訂屬性,通常位於 globals.css 或 index.css 檔案中,並整理出一份同時包含 :root 與 .dark 權杖區塊的獨立主題檔案。若專案缺少深色變體,它會先產生一個再發佈。接著它會為主題命名並加上標籤,透過 21st CLI 發佈到 21st.dev 公開主題庫,並回傳主題的線上網址。
適用情境
當使用者想把專案現有的設計以 21st.dev 主題分享或發佈時使用,例如使用者說「發佈我的主題」或「把設計同步到 21st」。它不適用於發佈元件,也不適用於把元件庫同步到 Claude Design 專案。
執行需求
需要 @21st-dev/cli 套件(指令為 21st),可透過 npx 執行,並需要一組以 21st_sk_ 開頭的 21st.dev API 金鑰,透過 --api-key 或 TWENTYFIRST_TOKEN / API_KEY_21ST 環境變數提供。需要連線到 21st.dev 的網路存取。此技能未附帶指令碼,僅為操作說明。

21st Design Sync — publish your project's design as a theme

Take the design a project already ships (its light + dark CSS variables) and publish it to the public 21st.dev theme library so anyone can preview, bookmark, and apply it. Under the hood this is one CLI call: 21st publish-theme <file.css> --name "…".

Pre-flight (always)

  1. Auth needs a real API key. publish-theme is a management endpoint: it accepts a 21st_sk_… key only, not a 21st login session token. Get one at https://21st.dev/mcp (or https://21st.dev/settings/api-keys) and pass it via --api-key 21st_sk_… or the TWENTYFIRST_TOKEN / API_KEY_21ST env var. If the user has no key, point them there — don't try to mint one.
  2. The CLI is the unified @21st-dev/cli (bin 21st). Use npx @21st-dev/cli if it isn't installed.
  3. Publishing is public and outward-facing. A published theme is immediately is_public in the community library (there is no unlisted/private option for themes). Confirm with the user before publishing.

Step 1 — Find the project's design tokens

Locate the file that defines the shadcn/Tailwind theme variables. Check, in order:

  • app/globals.css, src/app/globals.css
  • src/index.css, styles/globals.css, app/styles/globals.css

You're looking for a :root { … } block of CSS custom properties (--background, --foreground, --card, --primary, --secondary, --muted, --accent, --destructive, --border, --input, --ring, the --chart-* / --sidebar-* tokens, --radius) and a matching .dark { … } block. Values may be hsl(...), oklch(...), hex, or raw channels — keep them exactly as the project wrote them.

Tailwind v4 projects usually keep the same :root / .dark blocks plus an @theme inline mapping; you only need the :root and .dark token values, not the @theme mapping.

Step 2 — Assemble a valid theme CSS file

The publish endpoint parses --name: value; pairs out of a :root { … } block and a .dark { … } block, and requires both to be non-empty. So the file you publish must contain both.

  • Copy the project's :root and .dark blocks into a standalone file (e.g. project-theme.css). Nothing else is required.
  • If the project has only a light :root and no .dark (or an empty one), generate a dark variant before publishing — don't ship a theme with an empty dark mode. Reuse the add-dark-mode / oklch-skill approach: invert lightness while preserving hue/chroma so the dark set stays on-brand. Keep the same token names.
  • Keep the token names shadcn-standard so the theme previews correctly on the card and applies cleanly for others.

Minimal shape:

css
:root {  --background: 0 0% 100%;  --foreground: 240 10% 4%;  --primary: 240 6% 10%;  /* …the rest of the project's light tokens… */  --radius: 0.5rem;}.dark {  --background: 240 10% 4%;  --foreground: 0 0% 98%;  --primary: 0 0% 98%;  /* …the rest of the project's dark tokens… */}

Step 3 — Name & tag it

  • Name (required, ≤ 50 chars): infer from the project — the product/brand name from package.json, the repo, or the site title. Ask the user if it's ambiguous.
  • Tags (optional): a few descriptors that match how people browse themes, e.g. dark, minimal, neutral, vibrant, saas. Pass comma-separated.

Step 4 — Publish

bash
21st publish-theme ./project-theme.css \  --name "Acme" \  --tags dark,minimal \  --api-key 21st_sk_…            # or set TWENTYFIRST_TOKEN

The command prints the live theme URL (https://21st.dev/community/themes/<slug>). Share it with the user.

Updating vs re-publishing

  • Each publish-theme creates a NEW theme (there's no upsert-by-slug like components have). Running it twice = two themes in the library.
  • To change name/tags/visibility on an existing theme, edit it in place: 21st edit <theme-id> --type theme [--name "…"] [--tags a,b].
  • To change the colors, publish a fresh file and remove the old one: 21st delete <theme-id> --type theme --yes (soft-unpublish, reversible).

When NOT to use this

  • Syncing a component library to a Claude Design project → that's the built-in /design-sync skill, a different destination.
  • Publishing a component (not a color theme) → use 21st-registry.

來源與署名

來源:21st-dev/skill位於skills/21st-design-sync提交15c7436

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架

更多來自 21st-dev/skill 的技能

21st Ui Review

21st-dev

審查現有 UI 的無障礙、響應式與設計系統缺陷,並提供安全的確定性修正。

Design & Creative124 週前更新

21st Ui Explore

21st-dev

Explore and compare multiple meaningfully different UI directions grounded in the current project's design system and 21st inspiration. Use when the user wants options, variants, concepts, a redesign direction, visual experimentation, or is unsure how a new interface should look. Trigger for requests such as "show me three directions", "explore alternatives", "what could this page look like", or "generate variants". Do not use for a straightforward implementation with an already-selected direction.

待分類124 週前更新

21st Ui Build

21st-dev

Build or substantially change production UI using the current project's design context, existing components, and grounded 21st inspiration. Use when implementing a page, section, component, responsive redesign, or visual polish in an existing web project. Trigger for requests such as "build this UI", "implement this screen", "make this page production-ready", or "use 21st to create the interface". Use 21st-ui-explore first when the visual direction is intentionally undecided, and 21st-ui-review for critique-only work.

待分類124 週前更新

21st Registry

21st-dev

Publish 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`.

待分類124 週前更新

21st Cli Use

21st-dev

指導使用 21st CLI 從 21st.dev 目錄搜尋、安裝與拉取 React/shadcn 元件、主題與範本。

Software Development124 週前更新

21st Ai

21st-dev

Generate and iterate on UI with 21st AI from the terminal via the `21st` CLI (`@21st-dev/cli`): sketch a UI from a prompt, preview the variants in the browser, edit any variant in place with a natural-language change, and pull the final code into the project. Use whenever the user wants to BUILD / SKETCH new UI ("sketch a pricing page", "generate a hero with 21st", "make me a <X> section"), ITERATE on a generated draft ("edit the third variant", "add a toggle to that take"), or GRAB the code of a draft ("pull that variant's code", "сгенери UI на 21st", "поправь третий вариант", "забери код того наброска"). For finding/installing existing components use the `21st-cli-use` skill; to publish your own, `21st-registry`.

待分類124 週前更新