Логотип Figma Component Generator

Figma Component Generator

Сообщество
cris-achiardi
figma-component-generator

Создание наборов компонентов Figma из исходного кода с помощью инструмента figma-cli. Навык следует использовать, когда пользователь хочет создать или обновить компоненты Figma, прочитав исходные файлы React/CSS и сгенерировав соответствующие наборы компонентов с вариантами, свойствами и привязками переменных. Запускается слэш-командой с URL страницы Figma или названием компонента.

Add to TypingMind

Обзор

Издательcris-achiardi
Репозиторийclaude-skills
Название навыкаfigma-component-generator
Звёзды
72
Форки
8
Файлы в комплекте
10
ЛицензияMIT
Ссылки
  • Инструкции в формате Markdown

    Модель загружает файл SKILL.md по мере необходимости, поэтому токены расходуются только при подходящем запросе.

  • Работает с любой большой языковой моделью

    Навыки ИИ — это обычный Markdown, а не код для конкретного поставщика, поэтому они работают с GPT, Claude, Gemini, Grok и локальными моделями.

  • Файлы в комплекте: 10

    Скрипты, шаблоны и справочные материалы, которые модель может читать во время работы. Файлы доступны только для чтения и никогда не выполняются.

  • Открытый исходный код

    Издатель навыка на GitHub — cris-achiardi. Перед установкой изучите исходные материалы.

Установка

Установите навык ИИ Figma Component Generator в TypingMind, чтобы использовать его с любой LLM, или добавьте его в другой агент, который умеет читать SKILL.md.

1

Установка в TypingMind

TypingMind устанавливает навык прямо из его папки на GitHub: читает SKILL.md, собирает файлы ресурсов и сохраняет результат локально.

  1. Откройте приложение и перейдите в раздел «Плагины → Навыки».
  2. Выберите «Установить из GitHub».
  3. Вставьте указанную ниже ссылку на папку навыка и подтвердите установку.
    https://github.com/cris-achiardi/claude-skills/tree/main/skills/figma-component-generator
  4. Включите навык в каждом чате, где хотите его использовать.
Плагины → Навыки → Добавить навык → По ссылке GitHub, затем вставьте ссылку на папку и нажмите «Продолжить».
2

Установка в другом агенте

Любой агент с поддержкой формата Agent Skills может использовать этот навык — скопируйте папку в каталог навыков этого агента.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/cris-achiardi/claude-skills.git /tmp/claude-skills
mkdir -p .claude/skills
cp -r /tmp/claude-skills/skills/figma-component-generator .claude/skills/figma-component-generator
После копирования перезапустите Claude Code, чтобы загрузить новый навык.

Использование в TypingMind

Включите навык Figma Component Generator в любом чате TypingMind, и дальше модель всё сделает сама. Его название и описание хранятся в системном промпте, а при появлении подходящего запроса модель сама загружает полные инструкции. Вам не нужно вызывать навык вручную, и до фактического использования он не расходует токены.

Модель сама загружает навык Figma Component Generator, как только появляется подходящий для него запрос.

Работает с любой моделью ИИ

Навыки ИИ — это обычные инструкции в Markdown, а не код для конкретного поставщика, поэтому навык Figma Component Generator не привязан к модели, для которой он был создан. Установите его один раз в TypingMind и используйте с GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama или локальной моделью, которую запускаете самостоятельно, — со своими ключами API.

  • Загружается только при необходимости

    Системный промпт содержит только название и описание. Инструкции загружаются при первом подходящем запросе, поэтому неиспользуемый навык не расходует токены.

  • Меняйте модели прямо в чате

    Навык состоит из инструкций, а не кода, поэтому смена модели не нарушает его работу: новая модель читает тот же файл SKILL.md.

Инструкции навыка

Это содержимое файла SKILL.md, которое загружает модель. Прочитайте его перед установкой: навык — это инструкции, которым будет следовать ваша модель.

Figma Component Generator

Generate Figma component sets from source code (TSX, CSS Modules, metadata files) using the figma-cli eval command. Reads component logic, styles, and optional metadata to produce a properly structured Figma component set with variants, sizes, colors, and boolean properties -- all bound to Figma variables.

Prerequisites

  • The figma-cli repo must be cloned locally
  • Figma Desktop must be running with CDP enabled (port 9222)
  • The target Figma file must be open
  • The daemon should be running (node src/index.js daemon start)

To verify the connection:

bash
curl -s http://localhost:9222/json

Usage

/figma-component-generator <figma-page-url> [component-path]
  • figma-page-url: URL of the Figma page where the component should be created (required)
  • component-path: Path to the component folder (if not provided, ask the user)

Workflow

Step 1: Resolve inputs

Parse the Figma page URL to extract the file and page context. If component-path is not provided, ask the user for it.

Locate the figma-cli repo. Check common locations:

  • Look for a figma-cli directory in the current working directory or its parent
  • Check ~/figma-cli or ~/Projects/figma-cli
  • Or ask the user for the path if not found

Store the CLI path for use in all subsequent eval commands:

CLI_PATH=<path-to-figma-cli>

Step 2: Analyze the component source

Read the component files. At minimum, look for:

  1. Component logic (.tsx, .jsx, .vue, .svelte): Extract props, variants, types, default values
  2. Styles (.module.css, .css, .scss): Extract sizing, colors, spacing, border radius, token usage
  3. Metadata (.metadata.ts, .metadata.json): If available, extract structured variant definitions, sizes, colors, descriptions

From these files, build a component spec:

  • Variant dimensions: Identify the props that create visual variants (e.g., variant: solid|soft|outline, color: primary|danger|..., size: sm|md|lg)
  • Sizing tokens: Map size variants to pixel values (height, padding, font-size, gap)
  • Color tokens: Map each variant+color combination to CSS custom properties (e.g., var(--background-interactive-primary))
  • Boolean features: Identify optional visual elements (dots, icons, close buttons) that should become boolean component properties
  • Shape properties: Border radius, stroke width, stroke alignment

Step 3: Classify component and resolve dependencies

Before querying variables or generating, determine whether this component should be generated as a component set, and if so, resolve its atom dependencies.

Read references/rules/atomic-dependencies.md and follow the classification and resolution workflow:

  1. Classify the component as Visual, Layout Wrapper, or Compositional using the CSS and metadata signals described in the rule
  2. If Layout Wrapper: present the clarity checkpoint to the user and wait for their choice before proceeding. Do NOT generate a component set unless the user explicitly requests it.
  3. If Visual or Compositional: extract dependency names from metadata (composition.nestedComponents, composition.commonPartners) and source imports
  4. Resolve dependencies using the lookup table or Figma traversal (see below)
  5. Build a dependency map: for each found dependency, record the component set ID and available variants. For missing dependencies, warn the user.
  6. Pass the dependency map to Step 6 (generation) so the eval script uses createInstance() instead of raw frames for found dependencies.
Dependency resolution with optional lookup table

An external JSON lookup table may exist that maps component names to Figma node IDs. Read references/figma-map-lookup.md for the full schema and generation instructions.

Resolution order:

  1. Check for lookup table: Look for a figma-map.json file provided by the user (typically in ~/.claude/data/). If found, extract the figmaFileKey and compare it to the file key parsed from the Figma URL. If they match, use the map.
  2. Direct ID lookup (fast path): For each dependency name, check components.<name>.componentSetId in the map. If non-null, use figma.getNodeByIdAsync(id) to fetch the node directly. This avoids cross-page traversal entirely.
  3. Fallback to findAll (slow path): If the map doesn't exist, the file keys don't match, or a dependency isn't in the map, fall back to figma.root.findAll(n => n.type === 'COMPONENT_SET' && n.name === name).

The lookup table is optional — the skill must work without it. Never hardcode a specific file path; treat it as an external data source that may or may not be present.

Step 4: Query Figma variables

Before generating, fetch all available Figma variables to build a mapping:

bash
cd $CLI_PATH && node src/index.js eval "
(async () => {
  const allVars = await figma.variables.getLocalVariablesAsync();
  return JSON.stringify(allVars.map(v => v.name));
})()"

Token-to-variable mapping: Convert CSS token names to Figma variable paths:

  • var(--background-interactive-primary) maps to background/interactive/primary
  • Strip var(-- and ), replace - with / for path segments

For each token used by the component, check if a matching Figma variable exists. Track any unmapped tokens for the final report.

For detailed mapping rules and patterns, read references/figma-plugin-api-patterns.md.

Step 5: Navigate to the target page

Parse the node-id from the Figma URL (URL-encoded, e.g., 2001-2 means 2001:2).

bash
cd $CLI_PATH && node src/index.js eval "
(async () => {
  const targetId = '<decoded-node-id>';
  const page = figma.root.children.find(p => p.id === targetId);
  if (!page) {
    // Fallback: find by name
    const page2 = figma.root.children.find(p => p.name.trim() === '> <ComponentName>');
    if (page2) { figma.currentPage = page2; return 'Navigated by name'; }
    return 'Page not found';
  }
  figma.currentPage = page;
  return 'Navigated to: ' + page.name;
})()"

Step 6: Generate the component set

Build a single eval script that creates all variant combinations. The script must:

  1. Load fonts (load the weights your design system requires -- see references/figma-typography.md)
  2. Fetch variables and create a lookup helper
  3. Create component variants by iterating over all dimension combinations:
    • For each combination of variant properties (e.g., solid + primary + md), create a figma.createComponent()
    • Name it using Figma's variant syntax: Variant=solid, Color=primary, Size=md
    • Set auto-layout, sizing, padding, gap, corner radius
    • Set fills/strokes with placeholder colors, then bind to Figma variables
    • Create child elements (text labels, dots, icons) with proper variable bindings
    • For children that map to resolved dependencies (from Step 3), use componentNode.createInstance() instead of creating raw frames. See references/rules/atomic-dependencies.md for instance creation and variant selection patterns.
    • Add boolean component properties for optional elements
  4. Combine all variants using figma.combineAsVariants(components, figma.currentPage)
  5. Arrange in a grid for readability (remove auto-layout from set, position manually)
  6. Return a report with created count and any unmapped variables

For detailed Figma Plugin API patterns and code examples, read references/figma-plugin-api-patterns.md.

Pattern detection checklist

Before generating, scan the component source for these patterns and load the relevant rule:

PatternDetection SignalRule File
Sizing & layoutAny componentreferences/rules/sizing-modes.md (always read)
Iconslucide-react imports, icon props, SVG elements, spinnersreferences/figma-icon-library.md + references/rules/icon-recoloring.md
TypographyText nodes, font tokens, text-style CSS propertiesreferences/figma-typography.md
Nested components.map() loops, repeated elements with per-item state (isActive, isSelected)references/rules/nested-components.md
Dynamic item countPositive: prop is an array mapped with .map(); runtime-determined count; no fixed upper bound. Negative: named structural children (header/footer); fixed count (OTP=6, rating=5); single-child wrapper (Tooltip trigger); render-propsreferences/rules/slots.md
Floating overlaysImports from @floating-ui/*, @radix-ui/react-popover, @radix-ui/react-dropdown-menu, @radix-ui/react-tooltip, cmdk, @headlessui/react; uses createPortal; position: absolute|fixed with high z-index on the expanded part; conditional render of menu/dropdown/popover contentreferences/rules/floating-overlays.md
Atomic dependenciesMolecule/organism; metadata nestedComponents non-empty; imports design-system componentsreferences/rules/atomic-dependencies.md

Cross-dependency: Nested components and Dynamic item count often fire together. When a parent maps over items AND each item has per-item state (isActive, isSelected), you need BOTH: create a sub-component set per nested-components.md, then use slot Pattern A (instance-filled) in the parent per slots.md. If items are heterogeneous or have no per-item state, only slots.md applies (Pattern B, frame-filled).

Key rules for the eval script:
  • Wrap everything in (async () => { ... })()
  • Always set a placeholder fill/stroke BEFORE binding a variable
  • Append children to parent BEFORE setting layoutSizingHorizontal
  • Apply text style (textStyleId) BEFORE setting .characters (avoids Inter font loading issues)
  • Return JSON.stringify() for structured results
  • Use figma.variables.setBoundVariableForPaint() for variable binding
  • For complex scripts, write to a temp .js file and use eval --file <path>, then clean up after
  • Icons should use your project's icon component set when available -- read references/figma-icon-library.md
  • All text must use the project's font family via Figma text styles -- read references/figma-typography.md
Grid layout strategy:

Arrange variants in a grid where:

  • Columns = sizes (sm, md, lg)
  • Rows = colors (neutral, primary, ...)
  • Sections (separated by gap) = visual variants (solid, soft, outline)

Step 7: Report results

After generation, present a summary:

## Component Generated: Badge

- **Variants created**: 63 (3 variants x 7 colors x 3 sizes)
- **Properties**: Variant, Color, Size, Show Dot (boolean)
- **Variables bound**: 42 fill bindings, 21 stroke bindings
- **Unmapped tokens**: (none)
  OR
- **Unmapped tokens**:
  - `var(--background-utility-coral)` -- no matching Figma variable found
  - `var(--foreground-utility-coral)` -- no matching Figma variable found
- **Dependencies resolved**: 3/5 (Button, SearchInput, Select found; Input, Checkbox not in file)
  OR
- **Dependencies**: none (atom component)

If there are unmapped tokens, suggest the user create the missing variables in Figma or check for naming mismatches.

Important Notes

  • Never delete existing content on the page. Only add new nodes.
  • The figma-cli daemon has a 60-second timeout. For very large component sets (100+ variants), consider splitting into multiple eval calls.
  • If the connection is lost mid-generation, run node src/index.js daemon restart and retry.
  • The eval script can be substantial in size. The daemon handles large payloads.

Файлы в комплекте

Модель читает эти файлы по мере необходимости, пока навык загружен. Они доступны только для чтения и никогда не выполняются.

Часто задаваемые вопросы

Что делает навык ИИ Figma Component Generator?

Создание наборов компонентов Figma из исходного кода с помощью инструмента figma-cli. Навык следует использовать, когда пользователь хочет создать или обновить компоненты Figma, прочитав исходные файлы React/CSS и сгенерировав соответствующие наборы компонентов с вариантами, свойствами и привязками переменных. Запускается слэш-командой с URL страницы Figma или названием компонента.

Зачем использовать Figma Component Generator в TypingMind?

Потому что вы устанавливаете навык один раз и используете его с любой моделью. Figma Component Generator — это обычный текст в формате Markdown, а не код для конкретного поставщика, поэтому один и тот же навык работает с GPT-5, Claude, Gemini, Grok или локальной моделью. Вы можете менять модель прямо во время чата, и навык продолжит работать. TypingMind использует ваши собственные ключи API, поэтому вы платите поставщикам напрямую, а не оформляете подписку с оплатой за каждое место. Ваши навыки и чаты остаются в вашем собственном хранилище.

Как установить Figma Component Generator в TypingMind?

В TypingMind откройте «Плагины → Навыки → Установить из GitHub» и вставьте https://github.com/cris-achiardi/claude-skills/tree/main/skills/figma-component-generator. TypingMind прочитает файл SKILL.md, включит сопутствующие файлы в пакет и установит навык, который можно включать отдельно для каждого чата.

Какие модели ИИ могут использовать Figma Component Generator?

Любая модель, которую вы подключите в TypingMind. Навыки ИИ — это обычные инструкции в формате Markdown, а не код для конкретного поставщика, поэтому GPT, Claude, Gemini, Grok и локальные модели могут загружать этот навык, когда запрос ему соответствует.

Со сколькими моделями ИИ можно использовать Figma Component Generator?

С любым количеством. В TypingMind вы можете использовать Figma Component Generator с любой моделью, которая поддерживает навыки, в том числе с GPT, Claude, Gemini, Grok, DeepSeek, Mistral и Llama. Для этого вы используете собственные ключи API.

Бесплатен ли навык ИИ Figma Component Generator?

Да. Навык опубликован на GitHub по лицензии MIT. Издатель — cris-achiardi. Вы платите только своему поставщику ИИ за использованные токены.

Что такое навыки ИИ?

Навык ИИ — это набор инструкций, которыми модель ИИ может пользоваться каждый раз, когда ей нужно выполнить конкретную задачу. Он соответствует открытому формату Agent Skills: файл SKILL.md с названием и описанием, а также любые скрипты, шаблоны или справочные файлы, которые могут понадобиться модели. Модель читает инструкции, только когда ваш запрос соответствует навыку, поэтому установленный навык ничего не стоит, пока не используется.

Чем навыки ИИ отличаются от плагинов и серверов MCP?

Плагин или сервер MCP даёт модели новые инструменты, которые она может вызывать: при вызове где-то выполняется код и возвращает результат. Навык ИИ, напротив, даёт модели знания и описывает порядок действий: как подойти к задаче, какие шаги выполнить и каким должен быть хороший результат. Навыки — это обычный текст в формате Markdown, поэтому им не нужны сервер, ключ API или среда выполнения, и они работают с любой моделью.

Все
Логотип anthropics

Brand Guidelines

anthropics
ОрганизацияПопулярный

Применяет официальные фирменные цвета и типографику Anthropic к артефактам, которым подойдёт стиль компании. Используйте этот навык, если важны фирменные цвета, рекомендации по стилю, визуальное оформление…

21.8K
184K
Инструкции
Открыть
Логотип openclaw

Solid

openclaw
ОрганизацияПопулярный

Пишите, переносите, проверяйте или тестируйте интерфейсы Solid 2 UI в OpenClaw (Control UI, представления плагинов, хосты Canvas), включая управление состоянием, совместимость с Lit в процессе миграции, встроенные оверлеи, тестирование, производительность и…

82.4K
391.7K
Файлы: 9
Открыть
Логотип openclaw

Canvas

openclaw
ОрганизацияПопулярный

Показывайте документы размещённых виджетов на подключённой панели macOS и управляйте её видимостью и навигацией.

82.2K
391K
Инструкции
Открыть
Логотип openclaw

Diagram Maker

openclaw
ОрганизацияПопулярный

Создавайте диаграммы в SVG/HTML или Excalidraw для описания концепций, архитектуры, процессов и досок для совместной работы.

82.2K
391K
Файлы: 2
Открыть

Создайте своё рабочее пространство с ИИ прямо сейчас

Подпишитесь на нашу рассылку, чтобы узнавать о новых функциях и предстоящих розыгрышах 👇