Communitygithub.com

plugin87/design-tokens

生成、扩展或审计 DTCG 格式的设计令牌,采用三级架构(基础层 → 语义层 → 组件层)。适用于需要色板、字体比例、间距/阴影/圆角/动效令牌、多品牌主题,或验证令牌文件时。涵盖颜色、排版、间距、阴影、边框、断点、动效、渐变、不透明度、模糊、尺寸、状态、主题。

design-tokens 是什么?

该技能用于生成和维护符合 DTCG(`$type`/`$value`)格式的设计令牌,严格遵循项目的三级系统(基础层、语义层、组件层)。它帮助企业级设计系统实现原子化、可维护的令牌管理,支持多品牌和多密度主题。技能适用于所有主流 AI 平台(如 Claude Code、Cursor、Codex 等),需要通过读取项目的 `.claude/rules/tokens-and-color.md` 和 `.claude/rules/typography-and-spacing.md` 规则来获取生成令牌的约束(例如 4px 基础网格、Major Third 比例、OKLCH 调色板生成、深色模式在语义层处理)。它还会读取 `tokens/` 目录下的相关 JSON 文件(如 `colors.json`、`typography.json`、`spacing.json` 等)以匹配现有结构。令牌生成时,基础层仅含原始值(不在代码中直接使用),语义层提供用途别名,组件层限定于特定组件。对于新调色板,技能会生成 11 个 OKLCH 色阶,并利用 `a11y-audit` 技能或 `scripts/contrast.py` 验证 500 色阶在白色背景上的对比度 ≥ 4.5:1(文本),600 色阶的对比度 ≥ 3:1(UI)。最后,运行 `python3 scripts/validate_tokens.py` 进行 JSON 有效性和别名解析验证,确保输出符合 DTCG 标准且每个令牌保留 `$description`。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/plugin87/ux-ui-agent-skills/tree/main/.claude/skills/design-tokens

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

技能:设计令牌

按照项目三级系统生成和维护 DTCG($type/$value)令牌。

步骤

  1. 读取 .claude/rules/tokens-and-color.md → “令牌系统” + “颜色指南”以及 .claude/rules/typography-and-spacing.md 中的规则(4px 基础网格、Major Third 比例、OKLCH 调色板生成、深色模式在语义层处理)。
  2. 读取 tokens/ 中相关的现有文件,以匹配结构:colors.json、typography.json、spacing.json、shadows.json、borders.json、breakpoints.json、motion.json、gradients.json、opacity.json、blur.json、sizing.json、states.json、theming.json。
  3. 生成/扩展令牌:
    • 基础层 = 原始值(从不直接使用)。语义层 = 用途别名。组件层 = 组件作用域。
    • 新调色板:生成 11 个 OKLCH 色阶;验证 500 色阶在白色背景上的对比度 ≥ 4.5:1(文本),600 色阶的对比度 ≥ 3:1(UI),使用 a11y-audit 技能 / scripts/contrast.py。
    • 多品牌/密度 → theming.json。
  4. 验证:运行 python3 scripts/validate_tokens.py(JSON 有效性 + 别名解析)。

输出

DTCG JSON。每个令牌保留 $description。引用,绝不硬编码。

Individual skills in this repo

This repo contains 7 individual skills — each has its own dedicated page.

plugin87/governance

Govern how the design system evolves — SemVer for tokens/components, the contribution workflow, deprecation policy, and change communication. Use when the user wants to add/promote/deprecate a component or token, decide a version bump, set up a contribution process, or keep the system from fragmenting.

plugin87/image-to-code

Turn a reference image, screenshot, or mockup into token-driven, accessible code — infer the design system from the reference (palette, type scale, spacing, radius, layout archetype), map it to the 3-tier tokens, rebuild it, then verify with the kit's gates. Use when the user provides a design/screenshot and wants matching UI code.

plugin87/performance

Optimize UI performance against Core Web Vitals — LCP, INP, CLS — with loading/code-split strategy, layout-shift prevention, and animation performance rules. Use when the user wants to improve speed, fix jank or layout shift, hit Web Vitals budgets, or make a UI feel fast on low-end devices.

plugin87/prototype

Move an idea up the fidelity ladder (content-first → wireframe → low-fi → high-fi → code) with a validation plan at each level, plus user-journey mapping and usability-testing scripts. Use when the user wants to prototype, wireframe, map a user flow, or plan/run usability testing.

plugin87/redesign

Upgrade an existing website or app to premium quality without breaking functionality — audit the current design, identify generic/AI tells, then apply taste and system rules surgically. Use when the user wants to improve, modernize, polish, or "make better" an existing UI/codebase.

plugin87/token-build

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.

plugin87/ux-writing

Write or review UI copy — buttons, errors, empty states, microcopy, notifications, labels — using the voice & tone system (clear, concise, useful, human, honest) with the what→why→how error formula and inclusive-language rules. Use when the user needs interface copy, error messages, empty-state text, or a copy review.

相关技能