token-build
GitHub将 DTCG JSON 设计令牌转换为多平台前端及原生代码(CSS、Tailwind、JS、iOS/Android),并集成 CI 验证与对比度检查,确保主题文件同步。
Trigger Scenarios
Install
npx skills add plugin87/ux-ui-agent-skills --skill token-build -g -y
SKILL.md
Frontmatter
{
"name": "token-build",
"description": "Set up or run the token build pipeline — transform the DTCG tokens\/*.json (source of truth) into platform artifacts (CSS variables, Tailwind @theme, JS\/TS, iOS Asset Catalog, Android, Compose) with Style Dictionary \/ Tokens Studio \/ W3C DTCG export. Use when the user wants to generate platform theme files from tokens, wire token CI, or multi-platform token output."
}
Skill: Token Build
Step 0 — is the kit here? This skill reads files from the kit. Check once:
ls ${CLAUDE_SKILL_DIR}/../../../tokens >/dev/null 2>&1 && echo KIT_OK || echo KIT_MISSINGOnKIT_MISSINGonly the skill folders were installed, which is whatnpx skills adddoes. Say so plainly, point the user atnpx ux-ui-agent-skills initor the plugin install, and stop. Do not guess the contents of a file you could not open.
Turn the DTCG token source of truth into platform-ready outputs. Tokens are authored once; every platform output is generated.
Steps
- Read
${CLAUDE_SKILL_DIR}/../../../workflows/token-build.md(architecture, tool options, resolution rules, output targets, CI). - Pick the tool: Style Dictionary (multi-platform, the default), Tokens Studio (Figma-owned tokens — pairs with
figma-integration), W3C DTCG export, or a small custom script (model on${CLAUDE_SKILL_DIR}/../../../scripts/validate_tokens.py). - Honor the resolution rules: resolve aliases to final values per platform; expose semantic + component tokens (primitives stay internal); emit base + dark/brand/density overrides (
${CLAUDE_SKILL_DIR}/../../../tokens/theming.json) as deltas only; format by$type. - Generate the requested target(s): CSS
:rootvars, Tailwind v4@theme, typed JS/TS, iOS Asset Catalog +Color.DS/Spacing, Androidcolors.xml/Compose theme. - Wire CI: on
${CLAUDE_SKILL_DIR}/../../../tokens/*.jsonchange, run${CLAUDE_SKILL_DIR}/../../../scripts/validate_tokens.py, regenerate, fail if committed artifacts are stale; gate colors with${CLAUDE_SKILL_DIR}/../../../scripts/contrast.py.
Verification (definition of done)
python3 ${CLAUDE_SKILL_DIR}/../../../scripts/validate_tokens.pypasses (no unresolved aliases).- Regenerating produces no diff vs. committed artifacts.
- Dark/brand/density outputs contain only deltas, not full duplicates.
Version History
-
62092bd
Current 2026-10-19 09:20
增加安装路径可达性检测机制,修复插件在不同安装方式下无法正确引用资源的问题。
- 2ffb677 2026-08-28 12:00
- 93a7fbb 2026-07-25 07:41


