Agent SkillsNeverSight/learn-skills.dev › 21st-design-sync

21st-design-sync

GitHub

将项目的 shadcn/Tailwind CSS 设计令牌发布到 21st.dev 公共主题库。需验证 API 密钥,定位 globals.css 中的 :root 和 .dark 块,若无深色模式则自动生成,最后通过 CLI 工具发布为公开可共享的主题。

data/skills-md/21st-dev/skill/21st-design-sync/SKILL.md NeverSight/learn-skills.dev

触发场景

用户要求发布或同步设计为主题 包含 'publish my theme', 'share our design as a 21st theme', 'sync my design to 21st' 等指令

安装

npx skills add NeverSight/learn-skills.dev --skill 21st-design-sync -g -y
更多选项

非标准路径

npx skills add https://github.com/NeverSight/learn-skills.dev/tree/main/data/skills-md/21st-dev/skill/21st-design-sync -g -y

不安装直接使用

npx skills use NeverSight/learn-skills.dev@21st-design-sync

指定 Agent (Claude Code)

npx skills add NeverSight/learn-skills.dev --skill 21st-design-sync -a claude-code -g -y

安装 repo 全部 skill

npx skills add NeverSight/learn-skills.dev --all -g -y

预览 repo 内 skill

npx skills add NeverSight/learn-skills.dev --list

SKILL.md

Frontmatter
{
    "name": "21st-design-sync",
    "description": "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."
}

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:

: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

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.

版本历史

  • c3c0a1e 当前 2026-07-23 07:38

同 Skill 集合

data/skills-md/00prabalk00/claude-skills/knowledge-base-gap-finder/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-agile/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-auth/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-issues/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-project-management/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-projects/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-safe/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-search/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-spaces/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-transitions/SKILL.md
data/skills-md/0731coderlee-sudo/wechat-publisher/wechat-publisher/SKILL.md
data/skills-md/0froq/skills/conventionalcommits/SKILL.md
data/skills-md/0froq/skills/nuxt/SKILL.md
data/skills-md/0froq/skills/oq/SKILL.md
data/skills-md/0froq/skills/pinia/SKILL.md
data/skills-md/0froq/skills/pnpm/SKILL.md
data/skills-md/0froq/skills/slidev/SKILL.md
data/skills-md/0froq/skills/tsdown/SKILL.md
data/skills-md/0froq/skills/turborepo/SKILL.md
data/skills-md/0froq/skills/unocss/SKILL.md
data/skills-md/0froq/skills/vitepress/SKILL.md
data/skills-md/0froq/skills/vitest/SKILL.md
data/skills-md/0froq/skills/vue-best-practices/SKILL.md
data/skills-md/0froq/skills/vue-router-best-practices/SKILL.md
data/skills-md/0froq/skills/vue-testing-best-practices/SKILL.md
data/skills-md/0froq/skills/vue/SKILL.md
data/skills-md/0froq/skills/vueuse-functions/SKILL.md
data/skills-md/0froq/skills/web-design-guidelines/SKILL.md
data/skills-md/0juano/agent-skills/bondterminal-x402/SKILL.md
data/skills-md/0juano/agent-skills/edgeone-pages-deploy/SKILL.md
data/skills-md/0juano/agent-skills/ley-ar/SKILL.md
data/skills-md/0juano/agent-skills/ticktick/SKILL.md
data/skills-md/0juano/agent-skills/x-image-cards/SKILL.md
data/skills-md/0juano/x-image-cards/x-image-cards/SKILL.md
data/skills-md/0x0funky/agent-sprite-forge/generate2dsprite/SKILL.md
data/skills-md/0x2e/superpowers/brainstorming/SKILL.md
data/skills-md/0x2e/superpowers/dispatching-parallel-agents/SKILL.md
data/skills-md/0x2e/superpowers/executing-plans/SKILL.md
data/skills-md/0x2e/superpowers/finishing-a-development-branch/SKILL.md
data/skills-md/0x2e/superpowers/receiving-code-review/SKILL.md
data/skills-md/0x2e/superpowers/requesting-code-review/SKILL.md
data/skills-md/0x2e/superpowers/subagent-driven-development/SKILL.md
data/skills-md/0x2e/superpowers/systematic-debugging/SKILL.md
data/skills-md/0x2e/superpowers/test-driven-development/SKILL.md
data/skills-md/0x2e/superpowers/using-git-worktrees/SKILL.md
data/skills-md/0x2e/superpowers/using-superpowers/SKILL.md
data/skills-md/0x2e/superpowers/verification-before-completion/SKILL.md
data/skills-md/0x2e/superpowers/writing-plans/SKILL.md
data/skills-md/0x2e/superpowers/writing-skills/SKILL.md
data/skills-md/0x70626a/monad-wingman/monad-wingman/SKILL.md

元信息

文件数
0
版本
c3c0a1e
Hash
65cc94c8
收录时间
2026-07-23 07:38

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-29 14:47
浙ICP备14020137号-1 $访客地图$