cc-figma-component
БесплатноБез исполняемых скриптовНе проверенGenerate a Figma component set from a component contract. Use when the user wants to build or update a Figma component from a contract definition — e.g…
от lightspeedwp★ 20 звёзд на GitHubОб этом скилле
cc-figma-component — Component Contracts Component Skill
Generate Figma component sets from component contracts. This skill reads a contract, derives component-scoped (Tier 3) tokens, and builds a fully variable-bound component set in Figma.
Prerequisites — load these skills first:
figma-use— Plugin API syntax rules (mandatory before everyuse_figmacall)figma-generate-library— Design system workflow and component creation patternscc-figma-tokensmust have been run —PrimitivesandSemanticcollections must exist in the target Figma file
Always pass skillNames: "cc-figma-component" when calling use_figma as part of this skill.
Global Rules
Frame sizing defaults to HUG
Every frame created by this skill must have both sizing properties set to 'HUG' immediately after creation — no exceptions.
node.layoutSizingHorizontal = 'HUG';
node.layoutSizingVertical = 'HUG';
This applies to: the base component frame, every variant duplicate, the Generation Notes frame, and any other frame created during the run. Never rely on Figma's default — it sets new frames to FIXED at 100px, which produces portrait-aspect components regardless of padding values. Only deviate from HUG when a slot child's figma.sizing is explicitly set to "fixed" in the contract. In that case use the contract's figma.width and figma.height values directly:
if (child.figma?.sizing === 'fixed') {
node.layoutSizingHorizontal = 'FIXED';
node.layoutSizingVertical = 'FIXED';
node.resize(child.figma.width, child.figma.height);
}
This is the only legitimate exception to the HUG default.
1. Configuration
Before anything else, read .component-contracts from the project root. Never output FIGMA_ACCESS_TOKEN in any response.
FIGMA_ACCESS_TOKEN=... # never output this value
FIGMA_FILE_KEY=... # use for all use_figma calls
TOKENS_DIR=... # root directory of token files
CONTRACTS_DIR=... # root directory of contract files
2. Contract Structure
A component contract is a JSON file at {CONTRACTS_DIR}/{id}.contract.json. Read it fully before planning anything.
Key sections used by this skill:
tokens — defines the component's Tier 3 token bindings, organized by category:
{
"tokens": {
"color": {
"background.primary": "brand.500",
"text.primary": "neutral.0",
"border.secondary": "brand.500"
},
"spacing": {
"padding.x.sm": "space.sm",
"padding.y.sm": "space.xs"
},
"typography": {
"label.size": "textSize.sm",
"label.weight": "weight.semibold"
},
"border": {
"radius": "radius.md",
"width": "border.width.sm"
},
"motion": {
"transition": "duration.fast"
}
}
}
props — defines the component's variant axes (e.g. variant, size, state)
a11y — accessibility requirements (ARIA roles, keyboard behavior)
platforms — target platforms (web, ios, android)
3. Tier 3 Token Derivation
Component-scoped (Tier 3) tokens are derived from the contract's tokens section — they are NOT stored as a separate file. Derive them at runtime using these rules:
Naming convention
--ds-{componentId}-{role}-{qualifier}
Where:
componentId— the contract'sidfield (e.g.button,accordion)role— the Figma-aligned role name (see role translation table below)qualifier— derived from the Semantic alias name in the contract value
Role translation table
| Contract category + key prefix | CSS/Figma role |
|---|---|
color.background.* |
fill |
color.text.* |
text |
color.border.* |
border |
color.focus.* |
focus |
spacing.* |
spacing |
typography.* |
typography |
border.radius |
border (as border-radius) |
border.width |
border (as border-width) |
motion.* |
transition |
Qualifier derivation
The qualifier comes from the Semantic alias value in the contract, with the scale suffix dropped:
"background.primary": "brand.500" → qualifier = "brand" → --ds-button-fill-brand
"background.primary.hover": "brand.600" → qualifier = "brand-hover"
"text.primary": "neutral.0" → qualifier = "neutral-0"
State suffixes (hover, active, focus, disabled) are appended after the qualifier:
--ds-button-fill-brand-hover
--ds-button-fill-brand-active
Semantic variable lookup
Each Tier 3 token must bind to the corresponding Semantic variable in Figma. Look up the variable by name:
contract value "brand.500" → Semantic variable named "brand/500"
contract value "space.sm" → Semantic variable named "space/sm"
contract value "radius.md" → Semantic variable named "radius/md"
If a Semantic variable is not found, stop and report the missing variable to the user before proceeding.
Установить cc-figma-component в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл cc-figma-component?
Generate a Figma component set from a component contract. Use when the user wants to build or update a Figma component from a contract definition — e.g. 'build the Button Figma component', 'generate Figma component from contract', 'sync the Accordion to Figma', 'create component variants in Figma'. PREREQUISITE: the cc-figma-tokens skill must have been run first — Primitive and Semantic variable collections must exist in the target Figma file. Requires the figma-use and figma-generate-library skills.
Как установить скилл cc-figma-component?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cc-figma-component запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic