[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M757Q8BDYJ3HANDMBPTXFWQS":3,"skill-same:01M757Q8BDYJ3HANDMBPTXFWQS":52},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":28,"commitSha":29,"skillDirectory":30,"forksCount":31,"repositoryHtmlUrl":32,"repositoryHomepageUrl":33,"ownerHtmlUrl":34,"ownerBlogUrl":35,"ownerDescription":36,"updatedAt":37,"install":38,"resources":51},"01M757Q8BDYJ3HANDMBPTXFWQS","design-tokens",null,"Architect, name, format, and export design tokens as the single source of truth across Figma, code, and multi-platform builds using the W3C DTCG format, a primitive→semantic→component tier model, and a Style Dictionary v4 pipeline.","jpoindexter\u002FVanta","jpoindexter","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F2729617?v=4","01M72VRRYY1CP7RPF3B7GHH0CR","01M757GWDBT6RD147ZZ79N4MEX",4,"MIT","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fdesign-system-skills\u002Fdesign-tokens\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: design-tokens\ndescription: Architect, name, format, and export design tokens as the single source of truth across Figma, code, and multi-platform builds using the W3C DTCG format, a primitive→semantic→component tier model, and a Style Dictionary v4 pipeline.\ntags: [design-systems, tokens, theming, architecture]\n---\n# Design Tokens — the single source of truth\n\nDesign tokens are named, structured key–value pairs that store every visual decision in a design system — color, spacing, type, radius, motion — as data instead of hardcoded literals. One token (`color.bg.default`) is authored once and consumed everywhere: Figma, CSS, iOS, Android, Tailwind. Change the value, every surface updates. Tokens turn \"the brand blue\" from a number scattered across 400 files into one row that design and engineering both point at.\n\n## Why tokens (read before you skip the semantic tier)\n\n- **Single source of truth.** The value lives in one place. No `#2563EB` typed by hand in a component.\n- **Design↔code parity.** Designers edit Figma variables; engineers consume the same names. The handoff is the token, not a redline.\n- **Theming for free.** Light\u002Fdark, multi-brand, density, and platform are *modes* of the same semantic tokens. Swap the mode, not the markup.\n- **Scale.** A 12-step gray ramp, a type scale, a spacing scale — defined once, referenced by intent. Adding a brand is a new mode, not a rewrite.\n- **Refactor safety.** Renaming or deprecating a decision is a token change with a known blast radius, not a global find-and-replace.\n\n## The 3-tier architecture (the core mental model)\n\nTokens flow in one direction. **Components reference semantic. Semantic references primitive. Primitive references nothing.** Never let a component reach past semantic into a raw primitive.\n\n| Tier | AKA | Holds | Example | Themeable? |\n|------|-----|-------|---------|------------|\n| 1 — Primitive | global, base, core, option | Raw, context-free values | `color.blue.500 = #2563EB`, `dimension.4 = 16px` | No — fixed palette |\n| 2 — Semantic | alias, decision, system | **Intent**, references a primitive | `color.bg.default → {color.gray.50}` | **Yes — modes flip here** |\n| 3 — Component | scoped | Component-specific, references semantic | `button.primary.bg → {color.action.default}` | Inherits from semantic |\n\n```\n┌─────────────┐     ┌──────────────────┐     ┌──────────────────┐\n│  PRIMITIVE  │ ◄── │     SEMANTIC      │ ◄── │    COMPONENT      │\n│ blue.500    │     │ color.action.def  │     │ button.primary.bg │\n│ #2563EB     │     │ {color.blue.500}  │     │ {color.action.def}│\n└─────────────┘     └──────────────────┘     └──────────────────┘\n   raw value           intent \u002F role            local override\n```\n\n**When to add each tier:**\n- **Primitive** — always. Build the full ramp up front (50–950 for color, a spacing\u002Ftype scale). Primitives are the only place literal values live.\n- **Semantic** — the moment a value carries *meaning*. The second you ask \"is this *the* background or just gray.50?\", you need `color.bg.default`. Themes are impossible without this tier — it is not optional polish.\n- **Component** — only when a component needs to deviate from semantic, OR when a heavily-reused component benefits from a stable, scoped contract (`button.*`). Don't create a component token for every CSS property — most components should consume semantic tokens directly. Apply the rule of 3: don't mint a component token until the override repeats.\n\n**The aliasing rule, stated plainly:** a component should never know that the brand color is blue. It knows `color.action.default`. The semantic layer is the *only* layer that maps intent→primitive, so it is the *only* layer a theme has to override.\n\n## Token types & categories\n\n| Category | `$type` | Notes |\n|----------|---------|-------|\n| Color | `color` | Hex, or DTCG color object `{colorSpace, components, alpha}`. Ramps 50–950. |\n| Spacing \u002F size | `dimension` | `{value, unit}` — `px` or `rem`. Drives padding, margin, gap, width, icon size. |\n| Typography | `typography` | **Composite** — bundles fontFamily, fontSize, fontWeight, lineHeight, letterSpacing. |\n| Font family | `fontFamily` | String or array (fallback stack). |\n| Font weight | `fontWeight` | `100`–`900` or keyword (`bold`). |\n| Radius | `dimension` | Corner radius scale: `sm`, `md`, `lg`, `full`. |\n| Border | `border` | **Composite** — `{color, width, style}`. |\n| Shadow | `shadow` | **Composite** (often array for layered shadows) — `{color, offsetX, offsetY, blur, spread}`. |\n| Opacity | `number` | `0`–`1`. |\n| Z-index | `number` | Layering scale — name by role (`zIndex.modal`), not by value. |\n| Duration | `duration` | `{value, unit}` — motion timing, ms. |\n| Easing | `cubicBezier` | `[x1, y1, x2, y2]`. |\n| Breakpoint | `dimension` | Responsive thresholds. |\n\n**Composite tokens** bundle multiple sub-values into one logical unit. A `typography` token is one decision (\"body text\") even though it's five properties. Reference composites whole; don't re-decompose them in components.\n\n## Naming conventions\n\nA token name is a path. The de-facto model is **CTI** (Category → Type → Item) extended to `namespace · object · base · modifier`, or equivalently `category-property-variant-state`.\n\n```\ncolor   ·  bg     ·  primary  ·  hover\n└type     └concept  └variant    └state\n```\n\n**What makes a good name:**\n- **Name by intent, not appearance.** `color.danger` not `color.red`. `color.bg.subtle` not `color.gray.100`. The whole point of semantic tokens dies if you name them after the value — a red error token that becomes orange shouldn't be called `color.red`.\n- **Consistent ordering.** Always category-first, modifier-last. `color.text.primary.disabled`, never `color.disabled.text.primary`.\n- **Predictable scales.** Use numeric ramps (`50…950`) or t-shirt sizes (`xs sm md lg xl`) — pick one per category and never mix.\n- **Case: `kebab-case` in JSON keys \u002F CSS,** dot-paths in references. CSS output becomes `--color-bg-default`.\n- **No magic in the name.** `space.4` is fine as a primitive (scale step); `space.button-gap` is the semantic. Don't bake pixel values into names (`margin-16`).\n\n| ✅ Good | ❌ Bad | Why |\n|--------|-------|-----|\n| `color.danger.bg` | `color.red.bg` | Intent survives a palette change |\n| `color.text.primary` | `color.text.dark` | \"dark\" is wrong in dark mode |\n| `space.inset.md` | `padding.medium.16` | Value baked into name |\n| `radius.md` | `border-radius-8px` | Couples name to current value |\n| `font.body.default` | `font.arial.14` | Brittle, appearance-named |\n\n## W3C DTCG JSON format\n\nThe [Design Tokens Community Group](https:\u002F\u002Fwww.designtokens.org\u002F) spec is the interop standard (Tokens Studio, Style Dictionary v4, Figma exporters all target it). Rules:\n\n- Every token object has a **`$value`** and a **`$type`** (or inherits `$type` from a parent group).\n- **`$description`** documents intent. **`$extensions`** holds tool-specific metadata.\n- **References \u002F aliasing** use curly-brace paths: `\"$value\": \"{color.blue.500}\"`.\n- A group sets a default `$type` for its children; tokens can override.\n- Reserved `$`-prefixed keys are tokens metadata; any non-`$` key is a nested group or token name.\n\n```json\n{\n  \"color\": {\n    \"$type\": \"color\",\n    \"blue\": {\n      \"500\": { \"$value\": \"#2563EB\", \"$description\": \"Primitive — brand blue, do not use directly in components.\" },\n      \"600\": { \"$value\": \"#1D4ED8\" }\n    },\n    \"gray\": {\n      \"50\":  { \"$value\": \"#F9FAFB\" },\n      \"900\": { \"$value\": \"#111827\" }\n    },\n    \"action\": {\n      \"default\": { \"$value\": \"{color.blue.500}\", \"$description\": \"Semantic — interactive\u002Fprimary action surface.\" },\n      \"hover\":   { \"$value\": \"{color.blue.600}\" }\n    },\n    \"bg\": {\n      \"default\": { \"$value\": \"{color.gray.50}\" },\n      \"inverse\": { \"$value\": \"{color.gray.900}\" }\n    },\n    \"text\": {\n      \"primary\": { \"$value\": \"{color.gray.900}\" }\n    }\n  },\n  \"space\": {\n    \"$type\": \"dimension\",\n    \"4\":  { \"$value\": { \"value\": 16, \"unit\": \"px\" } },\n    \"inset-md\": { \"$value\": \"{space.4}\", \"$description\": \"Semantic — default component inset.\" }\n  },\n  \"typography\": {\n    \"body-default\": {\n      \"$type\": \"typography\",\n      \"$value\": {\n        \"fontFamily\": \"Inter\",\n        \"fontSize\": { \"value\": 1, \"unit\": \"rem\" },\n        \"fontWeight\": 400,\n        \"lineHeight\": 1.5,\n        \"letterSpacing\": { \"value\": 0, \"unit\": \"px\" }\n      }\n    }\n  },\n  \"button\": {\n    \"primary\": {\n      \"bg\":      { \"$type\": \"color\", \"$value\": \"{color.action.default}\" },\n      \"bg-hover\":{ \"$type\": \"color\", \"$value\": \"{color.action.hover}\" },\n      \"padding\": { \"$type\": \"dimension\", \"$value\": \"{space.inset-md}\" }\n    }\n  }\n}\n```\n\n## Theming & modes\n\nA **mode** is an alternate set of values for the *same* semantic token names. Light and dark are two modes of `color.bg.default`. The discipline: **semantic tokens flip across modes; primitives never do.** Dark mode is not a new palette of `gray.900-but-darker` — it's `color.bg.default → {color.gray.900}` instead of `{color.gray.50}`.\n\n| Axis | Modes | What flips |\n|------|-------|-----------|\n| Color scheme | light \u002F dark \u002F high-contrast | `color.bg.*`, `color.text.*`, `color.border.*` → different primitives |\n| Brand | brand-a \u002F brand-b | `color.action.*` → different brand ramps; spacing\u002Ftype usually shared |\n| Density | comfortable \u002F compact | `space.*` semantic tokens → tighter primitives |\n| Platform | web \u002F ios \u002F android | `dimension` units, font stacks, motion |\n\n```jsonc\n\u002F\u002F Tokens Studio \"sets\" \u002F Figma \"modes\" — one semantic name, value per mode\n{\n  \"light\": { \"color.bg.default\": \"{color.gray.50}\",  \"color.text.primary\": \"{color.gray.900}\" },\n  \"dark\":  { \"color.bg.default\": \"{color.gray.900}\", \"color.text.primary\": \"{color.gray.50}\"  }\n}\n```\n\n```css\n\u002F* Output: same custom property, value swaps by mode. Markup never changes. *\u002F\n:root            { --color-bg-default: #F9FAFB; --color-text-primary: #111827; }\n[data-theme=dark]{ --color-bg-default: #111827; --color-text-primary: #F9FAFB; }\n```\n\n**Figma variables map directly:** a variable collection = a token set; each *mode* column = a theme. **Tokens Studio** calls them *sets* + *themes* and exports DTCG JSON. Keep one collection per tier (Primitives \u002F Semantic) so modes only exist where they belong — on semantic.\n\n## Tooling pipeline\n\n```\nFigma Variables ──► Tokens Studio ──► tokens.json (DTCG) ──► Style Dictionary v4 ──► outputs\n   (authoring)        (sync\u002Fexport)      (source of truth)        (transform)         (consume)\n                                              │\n                          ┌───────────────────┼────────────────────┬──────────────┐\n                          ▼                    ▼                    ▼              ▼\n                   CSS custom props      JS\u002FTS tokens        iOS (Swift)    Android (XML)\n                   --color-bg-default    export const …      UIColor         \u003Ccolor name=…>\n                                                            Tailwind theme  Compose\u002FFlutter\n```\n\n- **Figma Variables** — designers author primitives + semantic with modes. Native variable modes do light\u002Fdark\u002Fbrand.\n- **Tokens Studio** (Figma plugin) — bridges Figma ⇄ a git-backed `tokens.json` in DTCG format. Manages sets\u002Fthemes, references, and pushes to GitHub.\n- **Style Dictionary v4** — the build engine. Reads DTCG JSON, applies **transforms** (e.g. `color\u002Fhex`, `size\u002Frem`, `name\u002Fkebab`) and **formats** (per-platform file templates) to emit every target.\n\n```jsonc\n\u002F\u002F style-dictionary.config.json (v4)\n{\n  \"source\": [\"tokens\u002F**\u002F*.json\"],\n  \"platforms\": {\n    \"css\":     { \"transformGroup\": \"css\", \"buildPath\": \"dist\u002Fcss\u002F\",\n                 \"files\": [{ \"destination\": \"tokens.css\", \"format\": \"css\u002Fvariables\" }] },\n    \"ts\":      { \"transformGroup\": \"js\",  \"buildPath\": \"dist\u002Fts\u002F\",\n                 \"files\": [{ \"destination\": \"tokens.ts\",  \"format\": \"javascript\u002Fes6\" }] },\n    \"ios\":     { \"transformGroup\": \"ios-swift\", \"buildPath\": \"dist\u002Fios\u002F\",\n                 \"files\": [{ \"destination\": \"Tokens.swift\", \"format\": \"ios-swift\u002Fclass.swift\" }] },\n    \"android\": { \"transformGroup\": \"android\", \"buildPath\": \"dist\u002Fandroid\u002F\",\n                 \"files\": [{ \"destination\": \"colors.xml\", \"format\": \"android\u002Fcolors\" }] }\n  }\n}\n```\n\n```css\n\u002F* dist\u002Fcss\u002Ftokens.css *\u002F\n:root {\n  --color-blue-500: #2563eb;\n  --color-action-default: var(--color-blue-500);\n  --color-bg-default: #f9fafb;\n  --space-inset-md: 16px;\n}\n```\n\n```ts\n\u002F\u002F dist\u002Fts\u002Ftokens.ts\nexport const ColorActionDefault = \"#2563EB\";\nexport const SpaceInsetMd = \"16px\";\n```\n\n**Tailwind** — map tokens into `theme.extend` so utilities resolve to custom properties:\n```js\n\u002F\u002F tailwind.config.js\nexport default { theme: { extend: {\n  colors: { bg: { default: \"var(--color-bg-default)\" }, action: { DEFAULT: \"var(--color-action-default)\" } },\n  spacing: { \"inset-md\": \"var(--space-inset-md)\" },\n} } };\n```\n\n**CI sync** — Tokens Studio pushes `tokens.json` to a PR → CI runs `style-dictionary build` → commits\u002Fpublishes `dist\u002F`. Treat generated files as build artifacts (don't hand-edit). Gate the PR on a visual-regression or token-diff check.\n\n## Governance\n\n- **Ownership.** A design-systems owner (or DRI) reviews every token PR. Primitives change rarely and need the highest bar; semantic changes need design sign-off; component tokens can be team-owned.\n- **Versioning — semver on the published package.**\n  - **Patch** — value change that doesn't alter intent (a hex nudge).\n  - **Minor** — **additive** only (new token, new mode). Safe to consume.\n  - **Major** — rename or removal of a token (breaking). Never silently rename.\n- **Deprecation, not deletion.** Mark `$deprecated` \u002F add to `$description`, keep the old token aliasing the new value for one major cycle, then remove. Ship a codemod or mapping table.\n- **Additive-first.** Adding tokens is cheap and non-breaking; prefer it over mutating existing ones.\n- **Contribution.** New token requests go through: propose intent → check an existing semantic token covers it → if not, add semantic referencing an existing primitive → only add a primitive if the value truly doesn't exist. PR includes name rationale + the tier it lands in.\n\n## Common mistakes\n\n| Mistake | Why it hurts | Fix |\n|---------|-------------|-----|\n| **Skipping the semantic tier** (components reference primitives) | No theming possible; dark mode means editing every component | Always route components → semantic → primitive |\n| **Naming by appearance** (`color.red`, `text.dark`) | Name lies when the value or mode changes | Name by intent: `color.danger`, `text.primary` |\n| **Hardcoding in components** (`padding: 16px`) | Token system bypassed; drift returns | Consume `{space.inset.md}` \u002F `var(--space-inset-md)` |\n| **Too-specific primitives** (`color.button-blue`) | Primitives must be context-free building blocks | Primitives are raw ramps; specificity lives in semantic |\n| **Modes on the primitive layer** | Palette mutates per theme; references break | Modes live on semantic only |\n| **One giant flat file, no tiers** | Can't tell decision from raw value; un-themeable | Separate primitive \u002F semantic \u002F component groups |\n| **Component token per CSS property** | Token explosion, unmaintainable | Components consume semantic directly; add component tokens only on the rule-of-3 |\n| **Hand-editing generated `dist\u002F`** | Overwritten on next build; source drifts | Edit `tokens.json`; regenerate |\n| **Renaming without deprecation** | Breaks every consumer silently | Major bump + alias old→new for one cycle + codemod |\n\n## Checklist before shipping a token set\n\n- [ ] Three tiers exist and reference one-directionally (component→semantic→primitive).\n- [ ] No component or app code references a primitive directly.\n- [ ] Every semantic token is named by intent, not appearance.\n- [ ] Light\u002Fdark (and any brand) are *modes* of the same semantic names.\n- [ ] Source is DTCG JSON (`$value`\u002F`$type`); outputs are generated, not hand-written.\n- [ ] Pipeline emits every target platform from one source via Style Dictionary.\n- [ ] Versioning + deprecation policy is written down and enforced in PR review.\n","# Design Tokens — the single source of truth\n\nDesign tokens are named, structured key–value pairs that store every visual decision in a design system — color, spacing, type, radius, motion — as data instead of hardcoded literals. One token (`color.bg.default`) is authored once and consumed everywhere: Figma, CSS, iOS, Android, Tailwind. Change the value, every surface updates. Tokens turn \"the brand blue\" from a number scattered across 400 files into one row that design and engineering both point at.\n\n## Why tokens (read before you skip the semantic tier)\n\n- **Single source of truth.** The value lives in one place. No `#2563EB` typed by hand in a component.\n- **Design↔code parity.** Designers edit Figma variables; engineers consume the same names. The handoff is the token, not a redline.\n- **Theming for free.** Light\u002Fdark, multi-brand, density, and platform are *modes* of the same semantic tokens. Swap the mode, not the markup.\n- **Scale.** A 12-step gray ramp, a type scale, a spacing scale — defined once, referenced by intent. Adding a brand is a new mode, not a rewrite.\n- **Refactor safety.** Renaming or deprecating a decision is a token change with a known blast radius, not a global find-and-replace.\n\n## The 3-tier architecture (the core mental model)\n\nTokens flow in one direction. **Components reference semantic. Semantic references primitive. Primitive references nothing.** Never let a component reach past semantic into a raw primitive.\n\n| Tier | AKA | Holds | Example | Themeable? |\n|------|-----|-------|---------|------------|\n| 1 — Primitive | global, base, core, option | Raw, context-free values | `color.blue.500 = #2563EB`, `dimension.4 = 16px` | No — fixed palette |\n| 2 — Semantic | alias, decision, system | **Intent**, references a primitive | `color.bg.default → {color.gray.50}` | **Yes — modes flip here** |\n| 3 — Component | scoped | Component-specific, references semantic | `button.primary.bg → {color.action.default}` | Inherits from semantic |\n\n```\n┌─────────────┐     ┌──────────────────┐     ┌──────────────────┐\n│  PRIMITIVE  │ ◄── │     SEMANTIC      │ ◄── │    COMPONENT      │\n│ blue.500    │     │ color.action.def  │     │ button.primary.bg │\n│ #2563EB     │     │ {color.blue.500}  │     │ {color.action.def}│\n└─────────────┘     └──────────────────┘     └──────────────────┘\n   raw value           intent \u002F role            local override\n```\n\n**When to add each tier:**\n- **Primitive** — always. Build the full ramp up front (50–950 for color, a spacing\u002Ftype scale). Primitives are the only place literal values live.\n- **Semantic** — the moment a value carries *meaning*. The second you ask \"is this *the* background or just gray.50?\", you need `color.bg.default`. Themes are impossible without this tier — it is not optional polish.\n- **Component** — only when a component needs to deviate from semantic, OR when a heavily-reused component benefits from a stable, scoped contract (`button.*`). Don't create a component token for every CSS property — most components should consume semantic tokens directly. Apply the rule of 3: don't mint a component token until the override repeats.\n\n**The aliasing rule, stated plainly:** a component should never know that the brand color is blue. It knows `color.action.default`. The semantic layer is the *only* layer that maps intent→primitive, so it is the *only* layer a theme has to override.\n\n## Token types & categories\n\n| Category | `$type` | Notes |\n|----------|---------|-------|\n| Color | `color` | Hex, or DTCG color object `{colorSpace, components, alpha}`. Ramps 50–950. |\n| Spacing \u002F size | `dimension` | `{value, unit}` — `px` or `rem`. Drives padding, margin, gap, width, icon size. |\n| Typography | `typography` | **Composite** — bundles fontFamily, fontSize, fontWeight, lineHeight, letterSpacing. |\n| Font family | `fontFamily` | String or array (fallback stack). |\n| Font weight | `fontWeight` | `100`–`900` or keyword (`bold`). |\n| Radius | `dimension` | Corner radius scale: `sm`, `md`, `lg`, `full`. |\n| Border | `border` | **Composite** — `{color, width, style}`. |\n| Shadow | `shadow` | **Composite** (often array for layered shadows) — `{color, offsetX, offsetY, blur, spread}`. |\n| Opacity | `number` | `0`–`1`. |\n| Z-index | `number` | Layering scale — name by role (`zIndex.modal`), not by value. |\n| Duration | `duration` | `{value, unit}` — motion timing, ms. |\n| Easing | `cubicBezier` | `[x1, y1, x2, y2]`. |\n| Breakpoint | `dimension` | Responsive thresholds. |\n\n**Composite tokens** bundle multiple sub-values into one logical unit. A `typography` token is one decision (\"body text\") even though it's five properties. Reference composites whole; don't re-decompose them in components.\n\n## Naming conventions\n\nA token name is a path. The de-facto model is **CTI** (Category → Type → Item) extended to `namespace · object · base · modifier`, or equivalently `category-property-variant-state`.\n\n```\ncolor   ·  bg     ·  primary  ·  hover\n└type     └concept  └variant    └state\n```\n\n**What makes a good name:**\n- **Name by intent, not appearance.** `color.danger` not `color.red`. `color.bg.subtle` not `color.gray.100`. The whole point of semantic tokens dies if you name them after the value — a red error token that becomes orange shouldn't be called `color.red`.\n- **Consistent ordering.** Always category-first, modifier-last. `color.text.primary.disabled`, never `color.disabled.text.primary`.\n- **Predictable scales.** Use numeric ramps (`50…950`) or t-shirt sizes (`xs sm md lg xl`) — pick one per category and never mix.\n- **Case: `kebab-case` in JSON keys \u002F CSS,** dot-paths in references. CSS output becomes `--color-bg-default`.\n- **No magic in the name.** `space.4` is fine as a primitive (scale step); `space.button-gap` is the semantic. Don't bake pixel values into names (`margin-16`).\n\n| ✅ Good | ❌ Bad | Why |\n|--------|-------|-----|\n| `color.danger.bg` | `color.red.bg` | Intent survives a palette change |\n| `color.text.primary` | `color.text.dark` | \"dark\" is wrong in dark mode |\n| `space.inset.md` | `padding.medium.16` | Value baked into name |\n| `radius.md` | `border-radius-8px` | Couples name to current value |\n| `font.body.default` | `font.arial.14` | Brittle, appearance-named |\n\n## W3C DTCG JSON format\n\nThe [Design Tokens Community Group](https:\u002F\u002Fwww.designtokens.org\u002F) spec is the interop standard (Tokens Studio, Style Dictionary v4, Figma exporters all target it). Rules:\n\n- Every token object has a **`$value`** and a **`$type`** (or inherits `$type` from a parent group).\n- **`$description`** documents intent. **`$extensions`** holds tool-specific metadata.\n- **References \u002F aliasing** use curly-brace paths: `\"$value\": \"{color.blue.500}\"`.\n- A group sets a default `$type` for its children; tokens can override.\n- Reserved `$`-prefixed keys are tokens metadata; any non-`$` key is a nested group or token name.\n\n```json\n{\n  \"color\": {\n    \"$type\": \"color\",\n    \"blue\": {\n      \"500\": { \"$value\": \"#2563EB\", \"$description\": \"Primitive — brand blue, do not use directly in components.\" },\n      \"600\": { \"$value\": \"#1D4ED8\" }\n    },\n    \"gray\": {\n      \"50\":  { \"$value\": \"#F9FAFB\" },\n      \"900\": { \"$value\": \"#111827\" }\n    },\n    \"action\": {\n      \"default\": { \"$value\": \"{color.blue.500}\", \"$description\": \"Semantic — interactive\u002Fprimary action surface.\" },\n      \"hover\":   { \"$value\": \"{color.blue.600}\" }\n    },\n    \"bg\": {\n      \"default\": { \"$value\": \"{color.gray.50}\" },\n      \"inverse\": { \"$value\": \"{color.gray.900}\" }\n    },\n    \"text\": {\n      \"primary\": { \"$value\": \"{color.gray.900}\" }\n    }\n  },\n  \"space\": {\n    \"$type\": \"dimension\",\n    \"4\":  { \"$value\": { \"value\": 16, \"unit\": \"px\" } },\n    \"inset-md\": { \"$value\": \"{space.4}\", \"$description\": \"Semantic — default component inset.\" }\n  },\n  \"typography\": {\n    \"body-default\": {\n      \"$type\": \"typography\",\n      \"$value\": {\n        \"fontFamily\": \"Inter\",\n        \"fontSize\": { \"value\": 1, \"unit\": \"rem\" },\n        \"fontWeight\": 400,\n        \"lineHeight\": 1.5,\n        \"letterSpacing\": { \"value\": 0, \"unit\": \"px\" }\n      }\n    }\n  },\n  \"button\": {\n    \"primary\": {\n      \"bg\":      { \"$type\": \"color\", \"$value\": \"{color.action.default}\" },\n      \"bg-hover\":{ \"$type\": \"color\", \"$value\": \"{color.action.hover}\" },\n      \"padding\": { \"$type\": \"dimension\", \"$value\": \"{space.inset-md}\" }\n    }\n  }\n}\n```\n\n## Theming & modes\n\nA **mode** is an alternate set of values for the *same* semantic token names. Light and dark are two modes of `color.bg.default`. The discipline: **semantic tokens flip across modes; primitives never do.** Dark mode is not a new palette of `gray.900-but-darker` — it's `color.bg.default → {color.gray.900}` instead of `{color.gray.50}`.\n\n| Axis | Modes | What flips |\n|------|-------|-----------|\n| Color scheme | light \u002F dark \u002F high-contrast | `color.bg.*`, `color.text.*`, `color.border.*` → different primitives |\n| Brand | brand-a \u002F brand-b | `color.action.*` → different brand ramps; spacing\u002Ftype usually shared |\n| Density | comfortable \u002F compact | `space.*` semantic tokens → tighter primitives |\n| Platform | web \u002F ios \u002F android | `dimension` units, font stacks, motion |\n\n```jsonc\n\u002F\u002F Tokens Studio \"sets\" \u002F Figma \"modes\" — one semantic name, value per mode\n{\n  \"light\": { \"color.bg.default\": \"{color.gray.50}\",  \"color.text.primary\": \"{color.gray.900}\" },\n  \"dark\":  { \"color.bg.default\": \"{color.gray.900}\", \"color.text.primary\": \"{color.gray.50}\"  }\n}\n```\n\n```css\n\u002F* Output: same custom property, value swaps by mode. Markup never changes. *\u002F\n:root            { --color-bg-default: #F9FAFB; --color-text-primary: #111827; }\n[data-theme=dark]{ --color-bg-default: #111827; --color-text-primary: #F9FAFB; }\n```\n\n**Figma variables map directly:** a variable collection = a token set; each *mode* column = a theme. **Tokens Studio** calls them *sets* + *themes* and exports DTCG JSON. Keep one collection per tier (Primitives \u002F Semantic) so modes only exist where they belong — on semantic.\n\n## Tooling pipeline\n\n```\nFigma Variables ──► Tokens Studio ──► tokens.json (DTCG) ──► Style Dictionary v4 ──► outputs\n   (authoring)        (sync\u002Fexport)      (source of truth)        (transform)         (consume)\n                                              │\n                          ┌───────────────────┼────────────────────┬──────────────┐\n                          ▼                    ▼                    ▼              ▼\n                   CSS custom props      JS\u002FTS tokens        iOS (Swift)    Android (XML)\n                   --color-bg-default    export const …      UIColor         \u003Ccolor name=…>\n                                                            Tailwind theme  Compose\u002FFlutter\n```\n\n- **Figma Variables** — designers author primitives + semantic with modes. Native variable modes do light\u002Fdark\u002Fbrand.\n- **Tokens Studio** (Figma plugin) — bridges Figma ⇄ a git-backed `tokens.json` in DTCG format. Manages sets\u002Fthemes, references, and pushes to GitHub.\n- **Style Dictionary v4** — the build engine. Reads DTCG JSON, applies **transforms** (e.g. `color\u002Fhex`, `size\u002Frem`, `name\u002Fkebab`) and **formats** (per-platform file templates) to emit every target.\n\n```jsonc\n\u002F\u002F style-dictionary.config.json (v4)\n{\n  \"source\": [\"tokens\u002F**\u002F*.json\"],\n  \"platforms\": {\n    \"css\":     { \"transformGroup\": \"css\", \"buildPath\": \"dist\u002Fcss\u002F\",\n                 \"files\": [{ \"destination\": \"tokens.css\", \"format\": \"css\u002Fvariables\" }] },\n    \"ts\":      { \"transformGroup\": \"js\",  \"buildPath\": \"dist\u002Fts\u002F\",\n                 \"files\": [{ \"destination\": \"tokens.ts\",  \"format\": \"javascript\u002Fes6\" }] },\n    \"ios\":     { \"transformGroup\": \"ios-swift\", \"buildPath\": \"dist\u002Fios\u002F\",\n                 \"files\": [{ \"destination\": \"Tokens.swift\", \"format\": \"ios-swift\u002Fclass.swift\" }] },\n    \"android\": { \"transformGroup\": \"android\", \"buildPath\": \"dist\u002Fandroid\u002F\",\n                 \"files\": [{ \"destination\": \"colors.xml\", \"format\": \"android\u002Fcolors\" }] }\n  }\n}\n```\n\n```css\n\u002F* dist\u002Fcss\u002Ftokens.css *\u002F\n:root {\n  --color-blue-500: #2563eb;\n  --color-action-default: var(--color-blue-500);\n  --color-bg-default: #f9fafb;\n  --space-inset-md: 16px;\n}\n```\n\n```ts\n\u002F\u002F dist\u002Fts\u002Ftokens.ts\nexport const ColorActionDefault = \"#2563EB\";\nexport const SpaceInsetMd = \"16px\";\n```\n\n**Tailwind** — map tokens into `theme.extend` so utilities resolve to custom properties:\n```js\n\u002F\u002F tailwind.config.js\nexport default { theme: { extend: {\n  colors: { bg: { default: \"var(--color-bg-default)\" }, action: { DEFAULT: \"var(--color-action-default)\" } },\n  spacing: { \"inset-md\": \"var(--space-inset-md)\" },\n} } };\n```\n\n**CI sync** — Tokens Studio pushes `tokens.json` to a PR → CI runs `style-dictionary build` → commits\u002Fpublishes `dist\u002F`. Treat generated files as build artifacts (don't hand-edit). Gate the PR on a visual-regression or token-diff check.\n\n## Governance\n\n- **Ownership.** A design-systems owner (or DRI) reviews every token PR. Primitives change rarely and need the highest bar; semantic changes need design sign-off; component tokens can be team-owned.\n- **Versioning — semver on the published package.**\n  - **Patch** — value change that doesn't alter intent (a hex nudge).\n  - **Minor** — **additive** only (new token, new mode). Safe to consume.\n  - **Major** — rename or removal of a token (breaking). Never silently rename.\n- **Deprecation, not deletion.** Mark `$deprecated` \u002F add to `$description`, keep the old token aliasing the new value for one major cycle, then remove. Ship a codemod or mapping table.\n- **Additive-first.** Adding tokens is cheap and non-breaking; prefer it over mutating existing ones.\n- **Contribution.** New token requests go through: propose intent → check an existing semantic token covers it → if not, add semantic referencing an existing primitive → only add a primitive if the value truly doesn't exist. PR includes name rationale + the tier it lands in.\n\n## Common mistakes\n\n| Mistake | Why it hurts | Fix |\n|---------|-------------|-----|\n| **Skipping the semantic tier** (components reference primitives) | No theming possible; dark mode means editing every component | Always route components → semantic → primitive |\n| **Naming by appearance** (`color.red`, `text.dark`) | Name lies when the value or mode changes | Name by intent: `color.danger`, `text.primary` |\n| **Hardcoding in components** (`padding: 16px`) | Token system bypassed; drift returns | Consume `{space.inset.md}` \u002F `var(--space-inset-md)` |\n| **Too-specific primitives** (`color.button-blue`) | Primitives must be context-free building blocks | Primitives are raw ramps; specificity lives in semantic |\n| **Modes on the primitive layer** | Palette mutates per theme; references break | Modes live on semantic only |\n| **One giant flat file, no tiers** | Can't tell decision from raw value; un-themeable | Separate primitive \u002F semantic \u002F component groups |\n| **Component token per CSS property** | Token explosion, unmaintainable | Components consume semantic directly; add component tokens only on the rule-of-3 |\n| **Hand-editing generated `dist\u002F`** | Overwritten on next build; source drifts | Edit `tokens.json`; regenerate |\n| **Renaming without deprecation** | Breaks every consumer silently | Major bump + alias old→new for one cycle + codemod |\n\n## Checklist before shipping a token set\n\n- [ ] Three tiers exist and reference one-directionally (component→semantic→primitive).\n- [ ] No component or app code references a primitive directly.\n- [ ] Every semantic token is named by intent, not appearance.\n- [ ] Light\u002Fdark (and any brand) are *modes* of the same semantic names.\n- [ ] Source is DTCG JSON (`$value`\u002F`$type`); outputs are generated, not hand-written.\n- [ ] Pipeline emits every target platform from one source via Style Dictionary.\n- [ ] Versioning + deprecation policy is written down and enforced in PR review.\n",{"name":5,"tags":23,"description":7},[24,25,26,27],"design-systems","tokens","theming","architecture","main","4911ae44bbb35beef4511ba298475ba5a82b7e1c","design-system-skills\u002Fdesign-tokens",0,"https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta","https:\u002F\u002Fdocs.vanta.theft.studio","https:\u002F\u002Fgithub.com\u002Fjpoindexter","jason.theft.studio","Just some guy trying to build stuff","2026-11-12 17:11:35",{"source":8,"skillName":5,"commands":39,"prompt":49,"zipAvailable":50},[40,43,46],{"tool":41,"command":42},"npx","npx skills add jpoindexter\u002FVanta --skill design-tokens",{"tool":44,"command":45},"bunx","bunx skills add jpoindexter\u002FVanta --skill design-tokens",{"tool":47,"command":48},"pnpm","pnpm dlx skills add jpoindexter\u002FVanta --skill design-tokens","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fdesign-system-skills\u002Fdesign-tokens\u002FSKILL.md",true,[],[53,60,67,74,81,87],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":18},"01M7582PEM7XM8B98VFRDV0C0J","write-changelog","Turn a range of commits into a user-facing changelog","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fvanta-ts\u002Fsrc\u002Fmigrate\u002F__fixtures__\u002Fopenclaw\u002Fskills\u002Fwrite-changelog\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":18},"01M7582KTQJMP5Y7GS83MS1C7Z","debug-flaky-test","Reproduce and isolate a flaky test before fixing it","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fvanta-ts\u002Fsrc\u002Fmigrate\u002F__fixtures__\u002Fopenclaw\u002Fskills\u002Fdebug-flaky-test\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":18},"01M7582HG7XFM4Z5NGG1YFECT8","triage-incident","First 10 minutes of an incident — stabilize, then diagnose","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fvanta-ts\u002Fsrc\u002Fmigrate\u002F__fixtures__\u002Fhermes\u002Fskills\u002Ftriage-incident\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":18},"01M7582DQABK7A96XHMB770KQZ","writing-plans","Write implementation plans: bite-sized tasks, paths, code.","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fvanta-ts\u002Fskills-library\u002Fwriting-plans\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":18},"01M7582BBK8H0HGSXKK08FCXJ1","vanta-port-adapter","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fvanta-ts\u002Fskills-library\u002Fvanta-port-adapter\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":18},"01M75828P8PX5XSBMJ2BVVDA9Y","test-driven-development","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fvanta-ts\u002Fskills-library\u002Ftest-driven-development\u002FSKILL.md",[],[]]