Token导航 LogoToken导航

Agent Skill · 前端设计

design-tokens(设计代币)

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

design-tokens 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为只读;许可证为 MIT,第三方扫描有提醒项,按安装量在前端设计类的 10,216 个 Skill 里排第 3,191。

总安装 1,505周安装 64GitHub Stars 12下载 527核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:design-tokens(设计代币)
来源仓库:https://github.com/ilikescience/design-tokens-skill
仓库路径:skills/design-tokens
安装命令:
npx skills add https://github.com/ilikescience/design-tokens-skill --skill design-tokens
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/ilikescience/design-tokens-skill --skill design-tokens

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

遵循 DTCG 社区标准处理颜色、尺寸与组件相关的令牌。提供 jq、JSONata 等工具链支持,兼容 Figma 导出流程。涵盖 alpha 通道、修饰符解析与跨平台映射规则。内置常见用例示例,适用于品牌升级或设计系统迁移场景。design-tokens 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/design-tokens

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/ilikescience/design-tokens-skill --skill desig…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它标注为只读,先用只读任务试一次,确认行为符合预期再扩大使用范围。

常见问题

6 条

design-tokens 怎么安装?

在终端执行 npx skills add https://github.com/ilikescience/design-tokens-skill --skill design-tokens。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

design-tokens 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

design-tokens 需要什么权限?

权限级别是只读。该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

design-tokens 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

design-tokens 用的人多吗?

公开数据是累计安装 1,505 次,近一周安装 64 次,下载 527 次,GitHub 12 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

design-tokens 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 标注为只读权限,试用阶段不容易误改本地文件。

先想清楚的地方

  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。
  • 只想先试试效果、不希望它改动本地文件的人。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
design-tokens

设计代币 · 本页

1,50512只读MIT有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Design Tokens Expert

Expert guidance for working with design tokens following the Design Tokens Community Group (DTCG) specification.

Quick Reference

TopicReference
Token types, structure, validationreference/format.md
Color spaces, components, alpha, common mistakesreference/color.md
Sets, modifiers, resolution orderreference/resolver.md
jq, JSONata, Figma export, Terrazzo configreference/tools.md
Common patterns and examplesexamples/use-cases.md

Getting Started: See Getting Started Guides for step-by-step workflows.

Specification Sources

Based on the latest DTCG Draft Community Group Reports:

Core Concepts

Token Structure

A token is a JSON object with $value. Special properties use $ prefix:

{
  "brand-blue": {
    "$type": "color",
    "$value": {
      "colorSpace": "srgb",
      "components": [0.15, 0.39, 0.92],
      "hex": "#2563eb"
    },
    "$description": "Primary brand color"
  }
}

Token Types

Atomic: color, dimension, fontFamily, fontWeight, duration, cubicBezier, number

Composite: strokeStyle, border, shadow, gradient, typography, transition

See reference/format.md for complete type definitions.

Color Format

Colors use structured objects (not hex strings):

{
  "$type": "color",
  "$value": {
    "colorSpace": "srgb",
    "components": [1, 0, 0.5],
    "alpha": 0.8,
    "hex": "#ff0080"
  }
}

Supported spaces: srgb, display-p3, oklch, oklab, hsl, hwb, lab, lch, and more. See reference/color.md.

References (Aliasing)

Two syntaxes supported:

  1. Curly braces - Token-level references: "{path.to.token}"
  2. JSON Pointer ($ref) - Property-level access: {"$ref": "#/path/to/$value/property"}

Token reference example:

{
  "color": {
    "primary": {"$type": "color", "$value": {"colorSpace": "srgb", "components": [0, 0.4, 0.8]}}
  },
  "button": {
    "background": {"$type": "color", "$value": "{color.primary}"}
  }
}

JSON Pointer example (accessing array elements):

{
  "blue": {
    "$type": "color",
    "$value": {"colorSpace": "okhsl", "components": [0.733, 0.8, 0.5]}
  },
  "blue-hue": {
    "$type": "number",
    "$ref": "#/blue/$value/components/0"
  }
}

See reference/format.md for complete reference syntax details.

Groups and Type Inheritance

Groups organize tokens. $type on a group applies to all children:

{
  "spacing": {
    "$type": "dimension",
    "sm": {"$value": {"value": 8, "unit": "px"}},
    "md": {"$value": {"value": 16, "unit": "px"}},
    "lg": {"$value": {"value": 24, "unit": "px"}}
  }
}

Resolvers for Theming

Resolvers manage tokens across contexts (themes, platforms, densities):

{
  "name": "my-system",
  "version": "2025.10",
  "sets": {
    "core": {"sources": [{"$ref": "tokens/base.json"}]}
  },
  "modifiers": {
    "theme": {
      "contexts": {
        "light": [{"$ref": "themes/light.json"}],
        "dark": [{"$ref": "themes/dark.json"}]
      },
      "default": "light"
    }
  },
  "resolutionOrder": [
    {"$ref": "#/sets/core"},
    {"$ref": "#/modifiers/theme"}
  ]
}

See reference/resolver.md for complete documentation.

Getting Started Guides

Quick Start: Convert CSS Variables to DTCG

Starting point: Existing CSS custom properties

:root {
  --color-primary: #2563eb;
  --color-background: #ffffff;
  --spacing-sm: 8px;
  --spacing-md: 16px;
}

Step 1: Create primitives.tokens.json

{
  "color": {
    "primitive": {
      "$type": "color",
      "blue-500": {
        "$value": { "colorSpace": "srgb", "components": [0.145, 0.388, 0.922], "hex": "#2563eb" }
      },
      "white": {
        "$value": { "colorSpace": "srgb", "components": [1, 1, 1], "hex": "#ffffff" }
      }
    }
  },
  "spacing": {
    "$type": "dimension",
    "scale": {
      "sm": { "$value": { "value": 8, "unit": "px" } },
      "md": { "$value": { "value": 16, "unit": "px" } }
    }
  }
}

Step 2: Create semantic.tokens.json with references

{
  "color": {
    "interactive": {
      "$type": "color",
      "primary": { "$value": "{color.primitive.blue-500}" }
    },
    "background": {
      "$type": "color",
      "page": { "$value": "{color.primitive.white}" }
    }
  },
  "spacing": {
    "$type": "dimension",
    "component": {
      "padding": { "$value": "{spacing.scale.sm}" },
      "gap": { "$value": "{spacing.scale.md}" }
    }
  }
}

Conversion tips:

  • RGB hex to sRGB: divide each channel by 255 (e.g., 37/255 = 0.145)
  • Keep hex as fallback in the hex property
  • Create semantic layer for purpose-driven naming

Quick Start: Set Up Terrazzo with Dark Mode

Step 1: Install dependencies

npm install -D @terrazzo/cli @terrazzo/plugin-css

Step 2: Create token files with mode extensions

tokens/themes/light.tokens.json:

{
  "$extensions": { "mode": "light" },
  "color": {
    "background": {
      "$type": "color",
      "page": { "$value": { "colorSpace": "srgb", "components": [1, 1, 1], "hex": "#ffffff" } }
    },
    "text": {
      "$type": "color",
      "primary": { "$value": { "colorSpace": "srgb", "components": [0.07, 0.07, 0.07], "hex": "#121212" } }
    }
  }
}

tokens/themes/dark.tokens.json:

{
  "$extensions": { "mode": "dark" },
  "color": {
    "background": {
      "$type": "color",
      "page": { "$value": { "colorSpace": "srgb", "components": [0.07, 0.07, 0.07], "hex": "#121212" } }
    },
    "text": {
      "$type": "color",
      "primary": { "$value": { "colorSpace": "srgb", "components": [0.95, 0.95, 0.95], "hex": "#f2f2f2" } }
    }
  }
}

Step 3: Create terrazzo.config.mjs

import { defineConfig } from "@terrazzo/cli";
import pluginCSS from "@terrazzo/plugin-css";

export default defineConfig({
  tokens: [
    "./tokens/primitives.tokens.json",
    "./tokens/themes/light.tokens.json",
    "./tokens/themes/dark.tokens.json"
  ],
  outDir: "./dist/",
  plugins: [
    pluginCSS({
      filename: "tokens.css",
      modeSelectors: [
        { mode: "light", selectors: [":root", "[data-theme='light']"] },
        { mode: "dark", selectors: ["[data-theme='dark']", "@media (prefers-color-scheme: dark)"] }
      ]
    })
  ]
});

Step 4: Build and use

npx terrazzo build

In your HTML:

<html data-theme="light"><!-- or "dark" -->

Quick Start: Import Figma Variables Export

Step 1: Export from Figma

  • Open Variables panel in Figma
  • Use a DTCG export plugin or Figma's built-in export
  • Save as figma-export.json

Step 2: Validate the export

# Check JSON is valid
jq '.' figma-export.json > /dev/null && echo "Valid JSON"

# List all token paths
jq -r 'paths(has("$value")) | join(".")' figma-export.json

Step 3: Add mode extensions if needed

If Figma exported separate mode files, add $extensions.mode:

# Add mode to light theme file
jq '. + {"$extensions": {"mode": "light"}}' light.json > light.tokens.json

Step 4: Add hex fallbacks (if missing)

Figma exports sRGB components but may omit hex:

# Quick check if hex values exist
jq '.. | objects | select(.colorSpace == "srgb") | select(.hex == null)' figma-export.json

Step 5: Configure Terrazzo

Create terrazzo.config.mjs pointing to your imported files and build.

Common Figma export issues:

  • Flat structure (no primitives/semantic separation) - reorganize manually
  • Space in token names - use jq to convert to kebab-case
  • Missing $type on groups - add type inheritance

Workflows

Creating a Token File

Token File Creation:
- [ ] Step 1: Define file structure (primitives → semantic → components)
- [ ] Step 2: Create primitive tokens with explicit types
- [ ] Step 3: Create semantic tokens referencing primitives
- [ ] Step 4: Validate structure and references
- [ ] Step 5: Test with target tools (Terrazzo, etc.)

Step 1: Define structure

Organize into layers:

tokens/
├── primitives.tokens.json   # Raw values (colors, spacing scales)
├── semantic.tokens.json     # Purpose-driven aliases
└── components.tokens.json   # Component-specific tokens

Step 2: Create primitives

{
  "color": {
    "primitive": {
      "$type": "color",
      "blue": {
        "500": {"$value": {"colorSpace": "srgb", "components": [0.15, 0.39, 0.92], "hex": "#2563eb"}}
      }
    }
  }
}

Step 3: Create semantic tokens

{
  "color": {
    "interactive": {
      "$type": "color",
      "default": {"$value": "{color.primitive.blue.500}"}
    }
  }
}

Step 4: Validate

Check for:

  • All tokens have resolvable $type
  • No circular references
  • Valid value formats for each type
  • Names don't contain {, }, . or start with $

Step 5: Test with tools

terrazzo validate tokens.json
terrazzo build --input tokens.json --output test.css --format css

Setting Up a Theme Resolver

Resolver Setup:
- [ ] Step 1: Organize token files by concern
- [ ] Step 2: Create resolver.json with version and sets
- [ ] Step 3: Define theme modifier with contexts
- [ ] Step 4: Configure resolution order
- [ ] Step 5: Test with different inputs

Step 1: Organize files

tokens/
├── resolver.json
├── base.tokens.json
└── themes/
    ├── light.tokens.json
    └── dark.tokens.json

Step 2: Create resolver

{
  "name": "my-design-system",
  "version": "2025.10",
  "sets": {
    "foundation": {
      "sources": [{"$ref": "base.tokens.json"}]
    }
  }
}

Step 3: Define theme modifier

{
  "modifiers": {
    "theme": {
      "contexts": {
        "light": [{"$ref": "themes/light.tokens.json"}],
        "dark": [{"$ref": "themes/dark.tokens.json"}]
      },
      "default": "light"
    }
  }
}

Step 4: Set resolution order

{
  "resolutionOrder": [
    {"$ref": "#/sets/foundation"},
    {"$ref": "#/modifiers/theme"}
  ]
}

Step 5: Test

terrazzo build --resolver resolver.json --output light.css
terrazzo build --resolver resolver.json --input theme=dark --output dark.css

Validating Token Files

Validation Checklist:
- [ ] Step 1: Check JSON syntax
- [ ] Step 2: Verify type declarations
- [ ] Step 3: Validate value formats
- [ ] Step 4: Check reference resolution
- [ ] Step 5: Verify naming constraints

Step 1: JSON syntax

jq '.' tokens.json > /dev/null && echo "Valid JSON"

Step 2: Type declarations

Every token needs a resolvable $type (explicit or inherited from parent group).

Step 3: Value formats

TypeValid Format
color{colorSpace, components, [alpha], [hex]}
dimension`{value: number, unit: "px"
duration`{value: number, unit: "ms"
cubicBezier[P1x, P1y, P2x, P2y] where P1x, P2x ∈ [0,1]
fontWeight1-1000 or string ("normal", "bold", etc.)

Step 4: References

  • All {path.to.token} references must resolve
  • No circular references (A → B → A)
  • No self-references

Step 5: Naming

  • Names cannot start with $
  • Names cannot contain {, }, .

Migrating from Other Formats

Migration Workflow:
- [ ] Step 1: Export existing tokens to JSON
- [ ] Step 2: Map types to DTCG equivalents
- [ ] Step 3: Convert color values to structured format
- [ ] Step 4: Update reference syntax
- [ ] Step 5: Validate and test

Common conversions:

FromTo DTCG
"#ff0000"{colorSpace: "srgb", components: [1,0,0], hex: "#ff0000"}
"16px"{value: 16, unit: "px"}
"$colors.primary" or {colors.primary}"{colors.primary}"

Terrazzo conversion:

terrazzo convert --from style-dictionary --to dtcg input.json output.tokens.json

Best Practices

Token Layers

  1. Primitives - Raw values without semantic meaning
  2. Semantic - Purpose-driven tokens referencing primitives
  3. Component - Specific component tokens referencing semantic

Naming Conventions

  • Use lowercase with hyphens: color.brand.primary
  • Structure: [category].[subcategory].[variant].[state]
  • Semantic over appearance: color.interactive.default not color.blue-500

Theming Strategy

Use resolvers for themes (recommended over group extension):

  • Cleaner separation of concerns
  • Token paths stay consistent across themes
  • Easy to compose themes (e.g., dark + high-contrast)
  • Standardized input handling for build tools

Accessibility

Color contrast: Document contrast ratios in $extensions:

{
  "$extensions": {
    "com.example.a11y": {"contrastRatio": 7.5, "wcagLevel": "AA"}
  }
}

Reduced motion: Use resolver modifier:

{
  "modifiers": {
    "motion": {
      "contexts": {
        "full": [{"$ref": "motion/full.json"}],
        "reduced": [{"$ref": "motion/reduced.json"}]
      },
      "default": "full"
    }
  }
}

File Conventions

  • Token files: .tokens or .tokens.json
  • Resolver files: .resolver.json
  • Encoding: UTF-8

Common Tasks

TaskApproach
Format validationCheck against DTCG spec, use Terrazzo validate
Structure optimizationOrganize into primitive → semantic → component layers
Alias resolutionTrace references, check for circular dependencies
Resolver configurationDefine sets, modifiers, resolution order
Theme implementationUse resolver modifiers with context files
Multi-context buildsGenerate outputs per theme/platform/density
Tool integrationUse jq for queries, Terrazzo for transforms
MigrationConvert colors to structured format, update references

Your Role

When helping with design tokens:

  1. Verify before claiming - Check reference files before stating what DTCG does/doesn't support. Never assume spec limitations.
  2. Use latest DTCG spec - Structured color format, proper types
  3. Validate structure - Check $value, $type, references
  4. Suggest best practices - Naming, organization, layering
  5. Help with tools - jq queries, Terrazzo commands, JSONata transforms
  6. Consider platforms - Web, iOS, Android via $extensions
  7. Think about scale - Design for maintainability
  8. Prioritize accessibility - Contrast, motion, focus indicators
  9. Connect design and code - Bridge tools and implementation

Important: When asked about spec capabilities (what syntax is valid, what features exist), always read the relevant reference file first. Do not rely on assumptions or prior knowledge about the spec.

Always provide clear examples and explain reasoning behind recommendations.

平台分布

Claude Code

28.79%
按下载量换算152

Antigravity

23.19%
按下载量换算122

windsurf

19.07%
按下载量换算100

Codex

14.94%
按下载量换算79

OpenCode

7.57%
按下载量换算40

Gemini CLI

3.89%
按下载量换算21

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。

继续浏览同类 Skills