generating-code-connect
БесплатноЗапускает вложенные скриптыНе проверенGenerates Figma Code Connect mappings for React or Angular repos, validates them with pre-checks and the Figma CLI, and can publish via figma connect. Use…
Об этом скилле
Generating Code Connect
Scope
Create Code Connect files, write figma.config.json, validate mappings, and optionally publish
Command line first
- Prefer
rg,jq, andast-grepover manual inspection - Use CLI tools or tiny scripts to validate and inspect outputs before editing by hand
- When extracting or transforming JSON, use
jqinstead of ad-hoc parsing
Inputs to collect
- Repo path, default current working directory
- Figma file URL
- Framework, auto-detect or ask React vs Angular
- Component scope, comma-separated list or Enter for all
- Output directory, default codeConnect
- Permission to install @figma/code-connect locally if missing
Default behaviors
- Generate all components when the user hits Enter on scope
- Prefer local @figma/code-connect over global installs
- Do not overwrite existing Code Connect files unless the user agrees
Workflow
- Pre-flight checks
- Parse the file key from the Figma URL
- Validate the token against the target file without printing it:
curl -s -o /dev/null -w "%{http_code}\n" -H "X-Figma-Token: $FIGMA_ACCESS_TOKEN" https://api.figma.com/v1/files/<fileKey>
- Check for @figma/code-connect with
scripts/check_figma_cli.sh - If the token check returns 403 but the user says it is valid:
- Locate the token source without printing it:
rg -l -g '.env*' -g 'superconnect.toml' "FIGMA_ACCESS_TOKEN|figma_access_token" - Ask the user to set the token in the current shell and re-run the check
- Confirm the token is non-empty without printing it:
echo ${#FIGMA_ACCESS_TOKEN} - Do not echo or paste the token value in any command or response
- Locate the token source without printing it:
- Detect framework
- Read package.json and look for react or @angular/core
- If ambiguous, ask the user to choose
- Extract Figma data with figma-scan.js
- Use the bundled script for reliable extraction:
node scripts/figma-scan.js <figmaFileUrl> \ --token $FIGMA_ACCESS_TOKEN \ --output codeConnect/.figma-evidence \ --index codeConnect/.figma-evidence/figma-components-index.json - The script handles all Figma API complexity including:
- Fetching componentPropertyDefinitions via /v1/files/:key/nodes endpoint
- Parsing variant properties from component names
- Extracting text layers for figma.textContent()
- Extracting slot layers for figma.children()
- Normalizing property names to camelCase
- Do NOT use raw curl + jq for extraction - the API has edge cases the script handles
- See references/figma-extraction-spec.md for output format details
Evidence output structure
Each evidence file contains:
{
"schemaVersion": "figma-component@1",
"componentSetId": "6:4335",
"componentName": "Button",
"variantProperties": { "Size": ["Compact", "Base", "Wide"] },
"variantValueEnums": {
"Size": { "normalizedKey": "size", "enums": ["compact", "base", "wide"] }
},
"componentProperties": [
{ "name": "Disabled", "type": "BOOLEAN" },
{ "name": "Label", "type": "STRING" }
],
"textLayers": [{ "name": "Label", "type": "TEXT" }],
"slotLayers": [{ "name": "Icon", "type": "FRAME" }]
}
Evidence quality gate
Before proceeding to generation, verify evidence is not empty:
for f in codeConnect/.figma-evidence/*.json; do
props=$(jq '.variantProperties | length' "$f")
comps=$(jq '.componentProperties | length' "$f")
if [ "$props" -eq 0 ] && [ "$comps" -eq 0 ]; then
echo "WARNING: Empty evidence for $f"
fi
done
If evidence is empty, the script may need --layer-depth increased or the Figma component genuinely has no configurable properties.
- Extract code component inputs
- For Angular, find all inputs in each component:
rg "= input[<\(]" projects/zap/src/lib/components/button/button.component.ts - For React, find props interface or destructured props:
rg "interface.*Props|type.*Props|function.*\(\{" src/components/Button.tsx - Update codeConnect/mapping.json with discovered inputs, see references/mapping-spec.md
Mapping Figma to code
Create figmaToCodeMap in mapping.json to link Figma property names to code input names:
{
"figmaToCodeMap": {
"Size": "size",
"Disabled": "disabled",
"Label": "text"
}
}
Use these heuristics for matching:
- Case-insensitive match first (Size → size)
- Remove spaces and normalize (Has Icon → hasIcon)
- Common synonyms (Label → text, Title → heading)
- If ambiguous, prompt the user for confirmation
- Read the relevant Figma docs and extract rules
- Read bundled references first:
- references/figma-code-connect-overview.md
- references/figma-code-connect-understand-files.md
- references/figma-code-connect-react.md or references/figma-code-connect-html.md
- references/figma-code-connect-config-file.md
- references/figma-code-connect-common-issues.md
- If more detail is needed, consult the authoritative sources linked in each reference
- Enforce these rules from the docs:
- figma.connect uses an object lit
Установить generating-code-connect в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл generating-code-connect?
Generates Figma Code Connect mappings for React or Angular repos, validates them with pre-checks and the Figma CLI, and can publish via figma connect. Use when a user provides a Figma file URL and a component repo and asks for Code Connect files, figma.config.json, or validation.
Как установить скилл generating-code-connect?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл generating-code-connect запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic