/frontend:figma-connectfrom frontend
Bridges Figma MCP server with Code Connect CLI for design-to-code workflows: implementing UI from Figma URLs, publishing component mappings to Dev Mode, extracting design tokens as CSS/Tailwind variables, and setting up Code Connect in projects.
Ships in frontend. 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.
Bridge between Figma MCP server (reads designs, generates code, extracts tokens) and Code Connect CLI (publishes persistent component mappings to Dev Mode). Use MCP tools for READ operations, CLI for PUBLISH operations.
This skill requires two independent authentication paths:
MCP Auth (OAuth) — for all mcp__claude_ai_Figma__* tools:
whoami() to check. If it fails, the user needs to authenticate the Figma MCP server via their MCP client settings (OAuth flow).CLI Auth (Token) — for npx figma connect publish/parse/create:
[ -n "$FIGMA_ACCESS_TOKEN" ] && echo "Token set" || echo "Token missing" or npx figma connect --versionexport FIGMA_ACCESS_TOKEN=<token> (prefer .env with .gitignore entry to avoid shell history exposure)Always check both before workflows that use both (Setup, Publish, Roundtrip). Design-to-Code and Token Extraction only need MCP auth.
Auto-detect the project framework to set MCP clientFrameworks param and CLI Code Connect label:
| Detection Signal | Framework | Code Connect Label | clientFrameworks |
|---|---|---|---|
package.json has react | React | React | react |
package.json has next | React (Next.js) | React | react,nextjs |
package.json has vue | Vue | Vue | vue |
package.json has svelte | Svelte | Svelte | svelte |
package.json has @angular/core | Angular | Web Components | angular |
Podfile or *.xcodeproj + SwiftUI | SwiftUI | SwiftUI | swiftui |
build.gradle.kts + Compose | Compose | Compose | compose |
pubspec.yaml has flutter | Flutter | Flutter | flutter |
| None detected / plain HTML | Web Components | Web Components | html,css |
Precedence: User-stated framework in the prompt always overrides file detection. When ambiguous (e.g., monorepo with multiple frameworks), ask the user.
Extract fileKey and nodeId from Figma URLs before calling MCP tools:
Standard: figma.com/design/:fileKey/:fileName?node-id=:nodeId
-> fileKey = :fileKey, nodeId = convert "-" to ":" in :nodeId
Branch: figma.com/design/:fileKey/branch/:branchKey/:fileName
-> fileKey = :branchKey (NOT :fileKey), nodeId from query param
Make: figma.com/make/:makeFileKey/:makeFileName
-> fileKey = :makeFileKey
Always convert node-id dashes to colons: 42-156 becomes 42:156.
When: New project, first-time Code Connect configuration.
Check MCP auth: Call whoami(). If fails, guide OAuth setup and stop.
Check CLI auth: Run npx figma connect --version. If not found, install:
npm install -D @figma/code-connect
Then check FIGMA_ACCESS_TOKEN is set.
Detect framework: Inspect project files (see Framework Detection table above).
Generate config: Create figma.config.json at project root:
{
"codeConnect": {
"parser": "react",
"include": ["src/components/**"],
"exclude": ["**/*.test.*", "**/*.stories.*"],
"label": "React"
}
}
Adjust parser, include, and label based on detected framework.
Generate design system rules (optional but recommended):
Call MCP create_design_system_rules() with clientFrameworks and clientLanguages.
Save the output to a rules file in the project (e.g., .cursor/rules/figma-design-system.md or .claude/rules/).
Extract initial tokens (optional):
If a Figma URL was provided, call get_variable_defs(fileKey, nodeId) and write tokens to the project's token file format (see Mode 4).
@figma/code-connect installedfigma.config.json createdWhen: User shares a Figma URL and wants code implementation. (For new projects needing full setup first, run Mode 1 before this.)
Check MCP auth: Call whoami(). If it fails, guide OAuth setup and stop.
Parse URL: Extract fileKey and nodeId (see URL Parsing section).
Screenshot (visual confirmation):
Call get_screenshot(fileKey, nodeId) to see what we're implementing.
Check existing Code Connect:
Call get_code_connect_map(fileKey, nodeId) to check whether mappings exist. Note: get_design_context independently includes <CodeConnectSnippet> wrappers when mappings are present — prioritize these over generated code.
Get design context:
get_design_context(
fileKey, nodeId,
clientFrameworks: "<detected-framework>",
clientLanguages: "<detected-languages>"
)
Returns: reference code (default React+Tailwind), screenshot, asset download URLs.
Adapt to project conventions:
Download assets: Use the asset URLs from get_design_context response for images, icons, etc.
Suggest Code Connect (if not set up):
If get_code_connect_map returned empty, suggest: "Consider setting up Code Connect to improve future design-to-code workflows. Run the Setup mode to get started."
get_screenshot(fileKey, nodeId) — visual referenceget_code_connect_map(fileKey, nodeId) — check existing mappingsget_design_context(fileKey, nodeId, clientFrameworks, clientLanguages) — generate codeget_variable_defs(fileKey, nodeId) — extract tokens (optional, if needed for styling)search_design_system(query, fileKey) — find reusable design system components (optional)When: User wants to map existing code components back to Figma so they appear in Dev Mode.
@figma/code-connect installedfigma.config.json exists (or will be created)Get AI suggestions:
Call get_code_connect_suggestions(fileKey, nodeId, clientFrameworks, clientLanguages).
Returns: list of unmapped components with names, properties, thumbnails.
Requires Organization/Enterprise plan with published team library components.
Analyze code components: Read the source files for components that match suggestions. Understand their props, variants, and structure.
Choose mapping approach:
Simple mappings (no variants/props): Use MCP directly:
send_code_connect_mappings(fileKey, nodeId, mappings: [
{ nodeId: "5:30", componentName: "Button", source: "src/components/Button.tsx", label: "React" }
])
Complex mappings (variants, boolean props, enums): Generate a .figma.tsx file:
import figma from "@figma/code-connect"
import { Button } from "./Button"
figma.connect(Button, "https://figma.com/design/abc123/DS?node-id=5-30", {
props: {
label: figma.string("Label"),
disabled: figma.boolean("Disabled"),
variant: figma.enum("Variant", {
Primary: "primary",
Secondary: "secondary",
Danger: "danger"
}),
icon: figma.instance("Icon")
},
example: (props) => (
<Button variant={props.variant} disabled={props.disabled} icon={props.icon}>
{props.label}
</Button>
)
})
Validate before publishing:
npx figma connect parse --label React
Fix any parse errors before proceeding.
Publish (or dry-run):
# Dry-run first (recommended)
npx figma connect publish --dry-run
# Actual publish
npx figma connect publish
Verify: Call get_code_connect_map(fileKey, nodeId) to confirm the mapping is registered. Future get_design_context calls will now include Code Connect snippets.
| Function | Maps | Example |
|---|---|---|
figma.string(prop) | Text properties | figma.string("Label") |
figma.boolean(prop, map?) | Toggle properties | figma.boolean("Disabled") |
figma.enum(prop, map) | Variant properties | figma.enum("Size", { Small: "sm", Large: "lg" }) |
figma.instance(prop) | Instance swap (nested component) | figma.instance("Icon") |
figma.children(layer) | Child instances by layer name | figma.children("Tab") |
figma.textContent(layer) | Text from child layers | figma.textContent("Title") |
figma.className(parts) | Concatenated class names | figma.className(["btn", figma.enum("Size", {...})]) |
See references/code-connect-cli-reference.md for full API documentation.
When: User wants to sync Figma design variables to code token files.
Extract variables:
get_variable_defs(fileKey, nodeId, clientFrameworks, clientLanguages)
Returns: variable name-to-value mappings (e.g., {"color/primary": "#3B82F6", "spacing/md": "16px"}).
Detect project token format:
tailwind.config.{js,ts} exists → Tailwind theme formattokens/ or src/tokens/ directory with .css → CSS custom propertiesstyle-dictionary.config.json → Style Dictionary formatMap and organize: Group by category (colors, spacing, typography, shadows, etc.) based on Figma variable collection/group naming.
Write token files:
CSS Custom Properties:
:root {
/* Colors */
--color-primary: #3B82F6;
--color-secondary: #64748B;
/* Spacing */
--spacing-sm: 8px;
--spacing-md: 16px;
--spacing-lg: 24px;
}
Tailwind Config:
// Add to tailwind.config.ts theme.extend
colors: {
primary: '#3B82F6',
secondary: '#64748B',
},
spacing: {
sm: '8px',
md: '16px',
lg: '24px',
}
See references/token-format-mappings.md for all supported formats.
When: Full end-to-end setup — new project or design system migration.
get_design_context again with the same fileKey/nodeId. When Code Connect mappings are registered, the response includes Code Connect snippet wrappers (typically tagged similar to <CodeConnectSnippet>) containing the component import and usage — look for these as the confirmation signal. If absent, re-run npx figma connect publish and retry.| Task | Tool | Why |
|---|---|---|
| Read design / generate code | MCP get_design_context | MCP returns structured context for LLM |
| Get visual reference | MCP get_screenshot | Built-in screenshot capability |
| Check existing mappings | MCP get_code_connect_map | Read-only operation |
| Get mapping suggestions | MCP get_code_connect_suggestions | AI-powered matching |
| Create simple mappings | MCP send_code_connect_mappings | No prop mapping needed |
| Create complex mappings | Generate .figma.tsx manually + CLI figma connect parse | Rich prop mapping API |
| Validate before publish | CLI figma connect parse | Local validation |
| Publish to Dev Mode | CLI figma connect publish | Only way to make snippets visible |
| Dry-run validation | CLI figma connect publish --dry-run | Pre-flight check |
| Extract design tokens | MCP get_variable_defs | Direct variable access |
| Search design system | MCP search_design_system | Cross-library search |
| Generate design rules | MCP create_design_system_rules | Convention template |
| CI/CD automation | CLI in GitHub Actions | Headless operation |
| Error | Cause | Resolution |
|---|---|---|
whoami fails / no user data | MCP not authenticated | Re-authenticate Figma MCP server via client settings (OAuth) |
FIGMA_ACCESS_TOKEN not set | CLI not authenticated | Create token at figma.com/developers, set env var |
npx figma connect not found | CLI not installed | npm install -D @figma/code-connect |
figma connect parse errors | Invalid .figma.tsx syntax | Check Code Connect template syntax, ensure correct imports |
figma connect publish 403 | Token lacks "Code Connect: Write" scope | Regenerate token with correct scopes |
get_code_connect_suggestions empty | No published library components | Publish components to team library first |
| Rate limit (429) | Too many MCP calls | Rate limits vary by plan — check Figma developer documentation for current limits. Batch operations to reduce API calls. |
| Node not found | Invalid nodeId or file moved | Verify URL, check if file was renamed or node deleted |
| Branch URL wrong fileKey | Using fileKey instead of branchKey | For branch URLs, use branchKey as fileKey (see URL Parsing) |
| Code Connect conflict | UI and CLI mappings on same node | Only one connection type per component. Remove one before adding the other. |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
figma-connect, design-to-code, code-connect, dev-mode, design-tokens
npx claudepluginhub anton-abyzov/vskill --plugin frontend4 skills in this plugin
/frontend-designCreate distinctive, production-grade frontend interfaces with visual verification. Use this skill when the user asks to build web components, pages, landing pages, dashboards, React/Vue/Svelte components, HTML/CSS layouts, or any web UI that needs to look polished. Also activates when styling, beautifying, redesigning, or doing visual refresh of existing UI. Covers the full loop: design thinking, code generation, and browser-based visual verification to iterate until the result actually looks right. Use this skill even if the user doesn't explicitly say 'design' — any request to build or improve a web interface benefits from this skill's aesthetic guidance and verification workflow./scrollcraft-layoutTurn a static site into a premium, multi-layered, scroll-driven experience (the "ScrollCraft" approach from Nate Herk's Claude design-skill video, adapted to Anton's no-npm static sites). Use when Anton asks for "multi-layered layout", "layers when you scroll", "interactive scrolling", "make it gorgeous / premium", "scroll animations", "not AI slop", or to apply the ScrollCraft approach to antonabyzov.com, football.antonabyzov.com, EasyChamp or any landing page. Pairs with the frontend-design skill (aesthetics) and the webapp-testing skill (headless verification)./task-skill-announcerDEPRECATED: A smoke-test fixture, not a user skill; moved to e2e fixtures. Do not activate on any request; it only answers an explicit /task-skill-announcer invocation.Other plugins' skills for the same job