一键导入
design-tokens-basics
DTCG token schema, naming conventions, and reference/system/component layering. Use this when introducing or auditing a token set.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
DTCG token schema, naming conventions, and reference/system/component layering. Use this when introducing or auditing a token set.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | design-tokens-basics |
| description | DTCG token schema, naming conventions, and reference/system/component layering. Use this when introducing or auditing a token set. |
Design tokens are the single source of truth for every visual and behavioral decision in the design system. Follow the W3C Design Tokens Community Group (DTCG) format and a strict three-layer model.
Tokens are JSON objects where every leaf has $value and $type. Groups may set a default $type that descendants inherit.
{
"color": {
"$type": "color",
"brand": {
"600": { "$value": "#4F46E5" },
"700": { "$value": "#4338CA" }
}
},
"space": {
"$type": "dimension",
"4": { "$value": "4px" },
"8": { "$value": "8px" },
"16": { "$value": "16px" }
},
"font": {
"family": {
"sans": { "$type": "fontFamily", "$value": ["Inter", "system-ui", "sans-serif"] }
}
}
}
Supported $type values used in this system: color, dimension, fontFamily, fontWeight, number, duration, cubicBezier, shadow, typography, transition, strokeStyle.
color.blue.500, space.8, font.size.16, radius.8.color.surface.default, color.action.primary.default, space.inset.md, text.body.md.button.primary.bg.default, card.surface.bg, field.border.focus.Use DTCG alias syntax {group.name} in $value. The build resolves aliases; runtime never sees references.
{
"color": {
"action": {
"primary": {
"default": { "$value": "{color.brand.600}" },
"hover": { "$value": "{color.brand.700}" },
"pressed": { "$value": "{color.brand.800}" }
}
}
}
}
Rule: a token may alias only inward (component → system → reference). Never reference → system.
Use dotted, lowercase, noun-first names. Keep segments short and semantic.
<category>.<role>.<property>.<state>
color.action.primary.bg.default
color.action.primary.fg.default
color.feedback.danger.bg.subtle
Do not encode platform, hex value, or implementation (color-ios-blue, space-8px-v2) in the name.
Every mobile design system should minimally define tokens for:
| Category | Examples |
|---|---|
| color | color.surface.*, color.content.*, color.action.* |
| typography | text.display.lg, text.body.md (composite) |
| spacing | space.inset.*, space.stack.*, space.inline.* |
| radius | radius.sm, radius.md, radius.pill |
| elevation | elevation.level1, elevation.level2 (shadow composite) |
| motion | motion.duration.*, motion.easing.* |
| border | border.width.sm, border.style.default |
DTCG allows $description, $deprecated, and $extensions. Use them.
{
"color": {
"action": {
"primary": {
"default": {
"$value": "{color.brand.600}",
"$description": "Default background for primary CTAs.",
"$extensions": {
"com.designsystem.contrastPair": "color.action.primary.fg.default"
}
}
}
}
}
}
color.blue-primary).$value + $type on every leaf).reference/, system/, component/.$description or its intent is obvious from its name.$deprecated: true with a replacement hint.tokens/ lint step fails the build on broken aliases or layer violations.Android adaptive icons and iOS app icon light/dark/tinted modes. Use this when creating or revising app launcher icons.
Cross-platform icon pipeline — SVG source, Android VectorDrawable, SF Symbols, Flutter/RN delivery, sizing, and parity. Use this when adding or refactoring the icon set.
Scalable, theme-aware illustrations for mobile — pipeline, tokenization, and platform delivery. Use this when authoring or shipping illustrations.
Structuring a cross-platform component library into primitives, patterns, and compositions with predictable folder layout and public API. Use this when starting or reorganizing a component library.
Slots, compound components, and headless primitives for flexible mobile component APIs. Use this when a component needs to serve many callers without becoming a grab-bag of props.
Modeling component variants as a closed matrix of size × intent × state, with explicit enums and slot APIs. Use this when designing or refactoring a component's public API.