К основному содержанию
скилл CX Codex

design-system-tokens — скилл для Claude Code: токены и установка

Скилл design-system-tokens помогает строить W3C-токены для цветов, отступов и тем. Включается при создании .tokens.json и систем с тёмной темой.

MIT 215 установок ★ 305 обновлён 2026-11-14

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add yonatangross/orchestkit --skill design-system-tokens -a claude-code
Открыть на GitHub

Что делает design-system-tokens

Скилл раскладывает дизайн-токены по трём уровням: global хранит исходные значения, alias задаёт смысловые имена, component связывает их с элементами интерфейса. Такой порядок позволяет менять тему через alias-токены, не переписывая значения компонентов. Цвета описываются в OKLCH, а контраст можно проверять на этапе объявления токена.

Внутри есть 8 правил для формата W3C, контраста, иерархии, OKLCH, отступов, глубины, Style Dictionary, темизации и версионирования. Style Dictionary преобразует один набор токенов в CSS custom properties, тему Tailwind, Swift для iOS и XML для Android. Для Style Dictionary указан диапазон >=5.5.5.

Скилл также описывает переключение dark mode через alias-связи и миграцию токенов с депрекацией и codemod. В Claude Code нужна версия 2.1.277 или новее, иначе заявленная совместимость не выполняется.

Какие задачи решает

  • разложить цвета и размеры по уровням global, alias и component
  • создать .tokens.json по формату W3C DTCG
  • описать палитру в OKLCH с равномерными изменениями светлоты
  • сгенерировать CSS, Tailwind, Swift и Android XML из токенов
  • связать alias-токены с dark mode и другими темами

Примеры запросов агенту

  • Создай структуру токенов для цветов, отступов и компонентов в формате .tokens.json.
  • Разложи текущие значения на уровни global, alias и component и подготовь тему dark mode.
  • Настрой Style Dictionary для генерации CSS custom properties и темы Tailwind из одного набора токенов.

Как установить design-system-tokens

1Через Skills CLI (Vercel)

npx skills add yonatangross/orchestkit --skill design-system-tokens -a claude-code

2Вручную: положить файлы

~/.claude/skills/design-system-tokens/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/design-system-tokens/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о design-system-tokens

Как установить design-system-tokens в Claude Code?

Выполните npx skills add yonatangross/orchestkit --skill design-system-tokens -a claude-code, затем откройте файл ~/.claude/skills/design-system-tokens/SKILL.md.

Что делает design-system-tokens?

Скилл помогает создавать W3C-токены для цветов, отступов, типографики и тем. Он задаёт трёхуровневую структуру, использует OKLCH и связывает токены со Style Dictionary и dark mode.

Что нужно для работы со Style Dictionary?

Для Style Dictionary указан диапазон версии >=5.5.5. Для Claude Code нужна версия 2.1.277 или новее.

Исходный текст

SKILL.md · MIT
---
name: design-system-tokens
license: MIT
compatibility: "Claude Code 2.1.277+."
description: "W3C design tokens: global, alias and component tiers, OKLCH color, Style Dictionary, dark mode. Use when creating token files or theme systems."
user-invocable: false
targets:
  - library: "style-dictionary"
    version: ">=5.5.5"
metadata:
  owner-agent: "frontend-ui-developer"
  category: document-asset-creation
  dtcg-version: "v2025.10"
  version: "1.1.0"
  author: "OrchestKit"
  complexity: "medium"
  tags: "design-tokens, w3c-tokens, oklch, style-dictionary, theming, dark-mode, css-variables, tailwind-theme, design-system, color-spaces"
allowed-tools: "Read Glob Grep WebFetch WebSearch"
---

# Design System Tokens

Design token management following the W3C Design Token Community Group (DTCG) specification. Tokens provide a single source of truth for design decisions — colors, spacing, typography, elevation — shared between design tools (Figma, Penpot) and code (CSS, Tailwind, iOS, Android). Major adopters include Figma (Variables API), Google (Material Design 3), Microsoft (Fluent UI), and Shopify (Polaris).

## Quick Reference

| Category | Rule File | Impact | When to Use |
|----------|-----------|--------|-------------|
| W3C Token Format | `tokens-w3c-format.md` | CRITICAL | Creating or reading `.tokens.json` files |
| Contrast Enforcement | `tokens-contrast-enforcement.md` | CRITICAL | Validating WCAG contrast at token definition time |
| Three-Tier Hierarchy | `tokens-three-tier.md` | HIGH | Organizing tokens into global/alias/component layers |
| OKLCH Color Space | `tokens-oklch-color.md` | HIGH | Defining colors with perceptual uniformity |
| Spacing & Depth | `tokens-spacing-depth.md` | HIGH | Defining elevation shadows and spacing scales as tokens |
| Style Dictionary | `tokens-style-dictionary.md` | HIGH | Transforming tokens to CSS/Tailwind/iOS/Android |
| Theming & Dark Mode | `tokens-theming-darkmode.md` | HIGH | Implementing theme switching and dark mode |
| Versioning | `tokens-versioning.md` | HIGH | Evolving tokens without breaking consumers |

**Total: 8 rules across 8 categories**

## Quick Start

W3C DTCG token format (`.tokens.json`):

```json
{
  "color": {
    "primary": {
      "50": {
        "$type": "color",
        "$value": "oklch(0.97 0.01 250)",
        "$description": "Lightest primary shade"
      },
      "500": {
        "$type": "color",
        "$value": "oklch(0.55 0.18 250)",
        "$description": "Base primary"
      },
      "900": {
        "$type": "color",
        "$value": "oklch(0.25 0.10 250)",
        "$description": "Darkest primary shade"
      }
    }
  },
  "spacing": {
    "sm": {
      "$type": "dimension",
      "$value": "8px"
    },
    "md": {
      "$type": "dimension",
      "$value": "16px"
    },
    "lg": {
      "$type": "dimension",
      "$value": "24px"
    }
  }
}
```

## Three-Tier Token Hierarchy

Tokens are organized in three layers — each referencing the layer below:

| Tier | Purpose | Example |
|------|---------|---------|
| **Global** | Raw values | `color.blue.500 = oklch(0.55 0.18 250)` |
| **Alias** | Semantic meaning | `color.primary = {color.blue.500}` |
| **Component** | Scoped usage | `button.bg = {color.primary}` |

This separation enables theme switching (swap alias mappings) without touching component tokens.

```json
{
  "color": {
    "blue": {
      "500": { "$type": "color", "$value": "oklch(0.55 0.18 250)" }
    },
    "primary": { "$type": "color", "$value": "{color.blue.500}" },
    "action": {
      "default": { "$type": "color", "$value": "{color.primary}" }
    }
  }
}
```

## OKLCH Color Space

OKLCH (Oklab Lightness, Chroma, Hue) provides perceptual uniformity — equal numeric changes produce equal visual changes. This solves HSL's problems where `hsl(60, 100%, 50%)` (yellow) appears far brighter than `hsl(240, 100%, 50%)` (blue) at the same lightness.

```css
/* OKLCH: L (0-1 lightness), C (0-0.4 chroma/saturation), H (0-360 hue) */
--color-primary: oklch(0.55 0.18 250);
--color-primary-hover: oklch(0.50 0.18 250);  /* Just reduce L for darker */
```

Key advantage: adjusting lightness channel alone creates accessible shade scales with consistent contrast ratios.

## Detailed Rules

Each rule file contains incorrect/correct code pairs and implementation guidance.

Read("rules/tokens-w3c-format.md")

Read("rules/tokens-contrast-enforcement.md")

Read("rules/tokens-three-tier.md")

Read("rules/tokens-oklch-color.md")

Read("rules/tokens-spacing-depth.md")

Read("rules/tokens-style-dictionary.md")

Read("rules/tokens-theming-darkmode.md")

Read("rules/tokens-versioning.md")

## Style Dictionary Integration

Style Dictionary transforms W3C tokens into platform-specific outputs (CSS custom properties, Tailwind theme, iOS Swift, Android XML). Configure a single `config.json` to generate all platform outputs from one token source.

> **Style Dictionary 5.x (current)** — pin `style-dictionary >= 5.3.0`. Relevant deltas vs the 4.x documented elsewhere:
>
> - **Native OKLCH output** — the custom `color/oklch` transform required in 4.x is **no longer needed**; the built-in `css/variables` formatter emits OKLCH directly when the input token uses `$type: "color"` with an OKLCH value. Remove hand-rolled transforms.
> - **DTCG v2025.10 dimension object** — `$type: "dimension"` now takes an object `{ "value": 16, "unit": "px" }` instead of the bare string `"16px"`. 5.3+ parses both, but new tokens should use the object form.
> - **Hooks API** replaces the 4.x `registerTransform` / `registerFormat` global calls — pass hooks in the config instead for better tree-shaking.

See `rules/tokens-style-dictionary.md` for configuration patterns and custom transforms.

## Dark Mode & Theming

Token-based theming maps alias tokens to different global values per theme. Dark mode is one theme — you can support any number (high contrast, brand variants, seasonal).

```css
:root {
  --color-surface: oklch(0.99 0.00 0);
  --color-on-surface: oklch(0.15 0.00 0);
}

[data-theme="dark"] {
  --color-surface: oklch(0.15 0.00 0);
  --color-on-surface: oklch(0.95 0.00 0);
}
```

See `rules/tokens-theming-darkmode.md` for full theme switching patterns.

## Versioning & Migration

Tokens evolve. Use semantic versioning for your token packages, deprecation annotations in token files, and codemods for breaking changes.

```json
{
  "color": {
    "brand": {
      "$type": "color",
      "$value": "oklch(0.55 0.18 250)",
      "$extensions": {
        "com.tokens.deprecated": {
          "since": "2.0.0",
          "replacement": "color.primary.500",
          "removal": "3.0.0"
        }
      }
    }
  }
}
```

See `rules/tokens-versioning.md` for migration strategies.

## shadcn/ui v4 Preset Integration

shadcn CLI v4 encodes style + theme + fonts + icons into a shareable preset code. Presets generate `globals.css` with CSS variables that map to the token hierarchy:

```bash
npx shadcn@latest init --preset b2D0xPaDb  # Luma + Emerald + Geist
```

**Luma elevation tokens** (the most token-rich style):

```css
/* Luma elevation system — soft depth hierarchy */
--shadow-card: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);  /* shadow-md */
--ring-card: 0 0 0 1px var(--foreground) / 0.05;  /* ring-1 ring-foreground/5 */
--shadow-dropdown: 0 4px 6px -1px rgb(0 0 0 / 0.1);  /* shadow-lg */
--shadow-dialog: 0 10px 15px -3px rgb(0 0 0 / 0.1);  /* shadow-xl */
--radius-button: var(--radius-4xl);  /* pill-shaped */
--radius-card: var(--radius-4xl);
--radius-input: var(--radius-3xl);
```

**Detection:** Read `components.json` → `"style"` field to determine which elevation/radius tokens are active. Map preset-generated CSS variables to W3C DTCG tokens via Style Dictionary transforms.

## Key Decisions

| Decision | Recommendation |
|----------|----------------|
| Token format | W3C DTCG `.tokens.json` with `$type`/`$value` |
| Color space | OKLCH for perceptual uniformity |
| Hierarchy | Three-tier: global, alias, component |
| Build tool | Style Dictionary 4.x with W3C parser |
| Theming | CSS custom properties with `data-theme` attribute |
| Token references | Use `{path.to.token}` alias syntax |

## Anti-Patterns (FORBIDDEN)

- **Hardcoded values in components**: Always reference tokens, never raw `#hex` or `16px`
- **Flat token structure**: Use three-tier hierarchy for theme-ability
- **HSL for shade scales**: OKLCH produces perceptually uniform scales; HSL does not
- **Skipping `$type`**: Every token must declare its type for tooling compatibility
- **Theme via class toggling raw values**: Use semantic alias tokens that remap per theme
- **Unversioned token packages**: Token changes break consumers; use semver

## References

| Resource | Description |
|----------|-------------|
| [references/w3c-token-spec.md](references/w3c-token-spec.md) | W3C DTCG specification overview |
| [references/style-dictionary-config.md](references/style-dictionary-config.md) | Style Dictionary 5.x configuration guide |
| [references/token-naming-conventions.md](references/token-naming-conventions.md) | Naming patterns and conventions |

## Agent Integration

The `design-system-architect` agent orchestrates token workflows end-to-end — from Figma Variables extraction through Style Dictionary transformation to theme deployment. When working on token architecture decisions, the agent coordinates with `frontend-ui-developer` for component token consumption and `accessibility` skills for contrast validation.

## Related Skills

- `ork-extras:ui-components` — Component library patterns (shadcn/ui, Radix)
- `ork-extras:accessibility` — WCAG compliance, contrast ratios
- `ork-extras:responsive-patterns` — Responsive breakpoints, fluid typography
- `ork-extras:figma-design-handoff` — Figma Variables to tokens pipeline

© OrchestKit · MIT · yonatangross/orchestkit

Похожие скиллы

Все скиллы по теме «Фронтенд и UI» →
design-tokens maxtrigify Правило design-tokens для Claude Code заменяет жёстко заданные цвета семантическими токенами. Переключение светлой и тёмной темы меняет значения переменных, а не классы компонентов. CX Codex +1 ★ 141звёзд репо design-tokens-skill podo Скилл design-tokens-skill помогает проектировать системы дизайн-токенов по спецификации W3C DTCG, работать с цветами, ссылками и темами. Нужен при миграции и настройке пайплайна токенов. CX Codex +1 227установок Design System Architect daffy0208 Скилл Design System Architect помогает проектировать дизайн-системы: от иерархии дизайн-токенов и тем оформления до атомарных компонентов на React и витрин в Storybook. CX Codex +1 227установок design-system-architect Seth Hobson Субагент design-system-architect проектирует токены, архитектуру компонентных библиотек и темы оформления. Пригодится при настройке дизайн-системы для веба и мобильных платформ через Style Dictionary и Figma Tokens. CX Codex ★ 42 780звёзд репо design-system-engineer josstei Субагент design-system-engineer проектирует иерархию дизайн-токенов, строит контракты API для компонентов и настраивает переключение тем без прямого указания цветов и отступов в коде. CX Codex ★ 489звёзд репо design-system-creation secondsky Скилл design-system-creation для Claude Code собирает дизайн-систему: токены, типографику, компоненты и документацию. Фиксирует стандарты интерфейса до начала вёрстки. CX Codex +1 512установок

Из того же набора86

Весь набор →
llm-integration Скилл llm-integration для Claude Code содержит 20 правил для интеграции LLM: строгий вызов функций, SSE-стриминг, запуск в Ollama и дообучение LoRA. CX Codex +1 218установок fix-issue Скилл fix-issue разбирает GitHub issue, ищет корневую причину, вносит исправление с тестами и создаёт PR со ссылкой на issue. CX Codex +1 217установок review-pr Скилл review-pr для Claude Code проверяет pull request, ветку или диапазон diff с помощью параллельных агентов. Перед слиянием он выдаёт вердикт approve или request-changes. CX Codex +1 217установок i18n-date-patterns Скилл i18n-date-patterns для Claude Code задаёт агенту правила переводов и локального форматирования в React: языков, дат, валют и сложных форм множественного числа. CX Codex +1 216установок task-dependency-patterns Скилл task-dependency-patterns для Claude Code помогает разбивать сложную работу на задачи и связывать их зависимостями. Он описывает учёт статусов и координацию параллельной работы. CX Codex +1 214установок api-design Скилл api-design задаёт правила проектирования контрактов REST, GraphQL и gRPC при редактировании эндпоинтов и схем OpenAPI. Включается автоматически при работе с файлами в routes/ и спецификациями. CX Codex +1 211установок assess Скилл assess выставляет оценки от 0 до 10 по семи измерениям: правильность, читаемость, сложность, производительность, безопасность, поддерживаемость и соответствие стандартам. CX Codex +1 211установок verify Скилл verify проверяет готовность работы к слиянию: запускает тесты, проверки безопасности и типов, затем даёт оценку от 0 до 10. CX Codex +1 210установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой