/design-system:design-tokens-w3cfrom Design System
Exports design tokens to W3C DTCG tokens.json format compatible with Style Dictionary, Token Studio, and Specify. Includes a CSS-to-DTCG converter script.
Ships in Design System. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
DTCG (Design Tokens Community Group) — стандарт tokens.json, который читают:
Каждый токен — объект с $value и $type:
{
"color": {
"primary": {
"500": { "$value": "#D97757", "$type": "color" },
"600": { "$value": "#C56640", "$type": "color" }
}
},
"spacing": {
"sm": { "$value": "8px", "$type": "dimension" },
"md": { "$value": "16px", "$type": "dimension" }
},
"typography": {
"heading": {
"$value": {
"fontFamily": "Fraunces",
"fontSize": "48px",
"fontWeight": 600,
"lineHeight": 1.1
},
"$type": "typography"
}
},
"shadow": {
"card": {
"$value": {
"color": "rgba(0,0,0,0.08)",
"offsetX": "0px", "offsetY": "2px",
"blur": "8px", "spread": "0px"
},
"$type": "shadow"
}
}
}
templates/css-to-dtcg.mjs:
import fs from 'node:fs/promises';
import postcss from 'postcss';
const file = process.argv[2] || 'tokens.css';
const css = await fs.readFile(file, 'utf8');
const root = postcss.parse(css);
const tokens = {};
root.walkRules(':root', rule => {
rule.walkDecls(decl => {
if (!decl.prop.startsWith('--')) return;
const name = decl.prop.slice(2);
const value = decl.value.trim();
const path = name.split('-'); // primary-500 → ['primary', '500']
let cur = tokens;
for (let i = 0; i < path.length - 1; i++) {
cur[path[i]] = cur[path[i]] || {};
cur = cur[path[i]];
}
let type = 'other';
if (/^#|rgb|hsl|oklch/.test(value)) type = 'color';
else if (/^\d+(\.\d+)?(px|rem|em|%)$/.test(value)) type = 'dimension';
else if (/^\d+(\.\d+)?$/.test(value)) type = 'number';
else if (/^['"]/.test(value) || /^[A-Z][a-zA-Z\s,]+$/.test(value)) type = 'fontFamily';
cur[path.at(-1)] = { '$value': value, '$type': type };
});
});
await fs.writeFile(file.replace(/\.css$/, '.tokens.json'), JSON.stringify(tokens, null, 2));
console.log('✓', file.replace(/\.css$/, '.tokens.json'));
npm i postcss
node css-to-dtcg.mjs tokens.css
# → tokens.tokens.json
Для команды на Style Dictionary:
npm i -D style-dictionary
config.json:
{
"source": ["tokens.tokens.json"],
"platforms": {
"css": { "transformGroup": "css", "files": [{ "destination": "tokens.css", "format": "css/variables" }] },
"scss": { "transformGroup": "scss", "files": [{ "destination": "_tokens.scss", "format": "scss/variables" }] },
"js": { "transformGroup": "js", "files": [{ "destination": "tokens.js", "format": "javascript/es6" }] },
"android": { "transformGroup": "android", "files": [{ "destination": "colors.xml", "format": "android/colors" }] },
"ios": { "transformGroup": "ios", "files": [{ "destination": "Colors.swift","format": "ios-swift/class.swift" }] }
}
}
npx style-dictionary build
# → tokens.css + tokens.js + colors.xml + Colors.swift
Один источник, все платформы.
DTCG поддерживает ссылки на другие токены:
{
"color": {
"brand": { "$value": "#D97757", "$type": "color" },
"primary": { "$value": "{color.brand}", "$type": "color" }
},
"button": {
"background": { "$value": "{color.primary}", "$type": "color" }
}
}
Style Dictionary разрезолвит при сборке.
В DTCG сейчас два подхода:
light и dark, переключаются на этапе сборки.$mode (новая фича DTCG, ещё не везде):{
"color": {
"background": {
"$value": { "light": "#fff", "dark": "#0d0d0d" },
"$type": "color"
}
}
}
Для совместимости — два файла:
tokens.light.json
tokens.dark.json
@company/tokens.--color-primary-500. Иерархия в DTCG — это ценность.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub jhamidun/claude-code-config-pack --plugin design-system12 skills in this plugin
/brand-extractorВытащить цвета, шрифты, копирайт из сайта по URL (headless Playwright). Триггеры: «сделай в стиле нашего сайта», «вытащи цвета с сайта». НЕ чужие продукты→content-policy./brand-guidelinesОфициальные цвета и шрифты бренда Anthropic (палитра + Poppins/Lora) для артефактов и .pptx. Триггеры: «стиль Anthropic». НЕ бренд пользователя/клиента→design-md-brands./color-system-builderИз одного акцента — полная палитра: light+dark, 9-step scale, semantic, WCAG-контраст. Триггеры: «построй цветовую систему», «color tokens»./dark-mode-addДобавить dark mode к light-дизайну: продуманные dark-токены, не инверт. Триггеры: «тёмная тема к дизайну», «dark theme tokens»./deck-themesГотовые CSS-темы для slides без бренда: минимал, editorial, dark, data, brutalist. Триггеры: «тема презентации», «оформление дека». Любой артефакт → theme-factory./design-md-brandsБанк DESIGN.md: 73 бренда (Stripe, Linear, Notion) + 287 сайтов инди-эстетики. Триггеры: «как у Linear», «современный лендинг», «портфолио-стиль». НЕ по URL → brand-extractor.Other plugins' skills for the same job