Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

token-architecture

БесплатноБез исполняемых скриптовНе проверен

Design and govern a three-tier CSS custom property token system (primitive → semantic → component), including semantic alias layers, light/dark theming, and…

eugenelimот eugenelim★ 35 звёзд на GitHub

Об этом скилле

Skill: token-architecture

Load this skill when the primary task is designing or auditing a token system — the architecture that governs how tokens are named, derived, and organized. Do not load this skill for routine surface work where seeding a token block is sufficient; the fallback token block frontend-engineering routes to at its lowest authority rung covers that case. Load token-architecture when:

  • The product needs a token system designed from scratch
  • An existing token system has hardcoded value drift and needs an audit
  • A new semantic alias layer is being added (e.g., adding a dark-theme override)
  • Multi-platform distribution requires DTCG-compatible source generation

Three-tier architecture

The one-way dependency rule governs the entire system:

Primitive  →  Semantic  →  Component
  • Primitives are raw values: #5e6ad2, 16px, 1.5. They have no meaning beyond their value. They are defined once at the top of the CSS file (or in the design tool) and referenced only by the semantic layer. Component tokens must not reference primitives directly — only semantics.
  • Semantics are role assignments: --ds-color-primary points to a primitive. Semantics carry the design intent. When the brand changes, only the semantic layer's pointer changes; component tokens remain stable.
  • Components are usage tokens scoped to a specific component: --btn-bg: var(--ds-color-primary). They reference semantics, never primitives.

Violation to refuse: a component token that reads var(--primitive-color-indigo-500) directly. This is a one-way dependency violation — if the primitive moves, every component that references it must be updated rather than only the semantic pointer.


Naming conventions

The --ds- namespace prefix is required for all system tokens. It signals "design system" and prevents collisions with author-defined custom properties or third-party libraries.

Semantic naming rules

Wrong Right Why
--color-blue-500 --ds-color-primary Implementation detail leaks into the name; survives no redesign
--spacing-16px --ds-space-4 Value leaks into the name; breaks if the scale changes
--radius-8 --ds-radius-md Same problem; semantic size name is stable
--font-inter --ds-font-body Font family leaks; semantic role is stable

The naming rule: a token name encodes role, never implementation. --ds-color-primary survives a rebrand to a different hue. --color-blue-500 does not.


Scale derivation

Derive spacing, typography, and radius scales from a single organizing ratio. Three ratios cover most design needs:

Ratio Value Best for
Minor third 1.25 Compact, data-dense surfaces (dashboards, admin)
Major third 1.333 General product surfaces
Golden ratio 1.618 Editorial, marketing, high-visual-weight surfaces

Spacing scale (minor third, 4px base)

--ds-space-1:  4px          (base)
--ds-space-2:  8px          (base × 1.25 → round to 8)
--ds-space-3:  12px
--ds-space-4:  16px
--ds-space-5:  24px         (major jump — section separation)
--ds-space-6:  32px
--ds-space-7:  48px
--ds-space-8:  64px

Typography scale (major third)

--ds-text-sm:   0.75rem     (12px)
--ds-text-base: 0.875rem    (14px)
--ds-text-lg:   1rem        (16px)
--ds-text-xl:   1.125rem    (18px)
--ds-text-2xl:  1.25rem     (20px)
--ds-text-3xl:  1.5rem      (24px)

Derive line-height from the scale ratio — not from a fixed pixel value. A unitless multiplier (1.25, 1.5, 1.75) scales with the font size and avoids WCAG 1.4.12 (Text Spacing) violations.

Radius scale

--ds-radius-sm:   4px       (chips, badges, small controls)
--ds-radius-md:   8px       (buttons, cards)
--ds-radius-lg:   12px      (modals, sheets, large containers)
--ds-radius-full: 9999px    (pills)

Semantic alias layer

The semantic layer maps roles to primitives. A complete minimum viable set:

Role Light theme default Dark theme override Meaning
--ds-color-surface #ffffff #0d0d0d Primary background
--ds-color-surface-alt #f8fafc #1a1a1a Secondary/alternate background
--ds-color-on-surface #1a202c #e2e8f0 Primary text on surface
--ds-color-on-surface-2 rgba(0,0,0,0.60) rgba(255,255,255,0.60) Secondary/muted text
--ds-color-primary #5e6ad2 #8b93e8 Brand / interactive primary
--ds-color-on-primary #ffffff #ffffff Text on primary
--ds-color-error #dc2626 #f87171 Error state
--ds-color-on-error #ffffff #ffffff Text on error
--ds-color-warning #d97706 #fbbf24 Warning state
--ds-color-success #16a34a #4ade80 Success state
--ds-color-info #0284c7 #38bdf8 Informational state
--ds-color-disabled rgba(0,0,0,0.38) `rgba(255,255,255,
Полный SKILL.md на GitHub

Установить token-architecture в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

evals/eval_queries.json

FAQ

Что делает скилл token-architecture?

Design and govern a three-tier CSS custom property token system (primitive → semantic → component), including semantic alias layers, light/dark theming, and DTCG-compatible source generation. Triggers on "design a three-tier token system for our web app", "audit our CSS tokens for hardcoded value drift", "add a semantic dark-theme alias layer", "export our tokens in DTCG format".

Как установить скилл token-architecture?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл token-architecture запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

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

Сравнить token-architecture с