bitovi/ai-enablement-prompts/figma-connect-component
Claude Code and agent skill by bitovi/ai-enablement-prompts
- community
Checking that the SKILL.md file is still in the repository.
Generate Figma Code Connect mappings that link React components to their Figma counterparts. Use when a component exists in code and needs a Code Connect file so Figma shows real code snippets in Dev Mode. Also triggers on phrases like "connect this component to Figma", "generate Code Connect", "publish to Figma", "add figma.connect for this component", "link this to Figma Dev Mode".
Install
npx vskill@latest install bitovi/ai-enablement-prompts/figma-connect-componentSKILL.md
Generate Figma Code Connect for React Components
When to Use This Skill
User provides a Figma component URL (or component name) and wants to generate the Code Connect mapping for it.
Required Inputs
- Figma component identifier (one of):
- Full URL:
https://figma.com/design/{fileKey}/{fileName}?node-id={nodeId} - File key + node ID:
fileKey: abc123, nodeId: 45:67 - Evidence file path:
.temp/figma-explore/{component}.json - Component name (will search for URL in project files)
- Code component folder path (e.g.,
src/components/Button/Button.tsx)
Execution Steps
1. Gather Figma Component Data
Option A: Evidence File Provided (Preferred)
If an evidence file from figma-explore is provided (e.g., .temp/figma-explore/{component}.json):
- Read the JSON file directly
- Extract:
id(node ID),name,variants,variantProperties,componentPropertyDefinitions - The file contains all the variant names and values needed for Code Connect
Example evidence file structure:
Option B: URL/Node ID Provided (MCP Fallback)
If only a Figma URL or node ID is provided:
- Search for existing evidence files in
.temp/figma-explore/that match the component name - If not found, use MCP tools:
- Call
mcp_figma_get_metadatawithnodeIdandfileKey - Call
mcp_figma_get_design_contextwithnodeIdandfileKey
2. Discover Figma URL (if needed)
If no URL or evidence file provided, search for it:
- Check
{ComponentFolder}/README.mdfor "Figma Source" section - Check
specs/**/tasks.mdfor component-to-Figma mapping tables - Check
.temp/figma-explore/figma-components-index.jsonfor matching component names - Check prior conversation context for file key
3. Read Code Component and Inline the Mapping Contract
- Read the specified component file — identify exports, props interface, component name
- If `.temp/design-components/{component-name}/proposed-api.md` exists, read it and inline the prop-to-Figma mapping table into your working context. Do not reference this file by path during generation — the full mapping must be in active context so no property is guessed or missed.
- Cross-check: every prop in the React interface should have a corresponding Figma source in the table. Props with no Figma source (e.g.,
className,id) are omitted from Code Connect.
4. Generate Mapping
- Map Figma properties to code props using
figma.*helpers - Build example JSX template
- Add appropriate imports
5. Write Code Connect File
- Output to:
{ComponentFolder}/{ComponentName}.figma.tsx - Raw file content only—no markdown fences
6. Update README with Mapping Diagram
If {ComponentFolder}/README.md exists, ensure it has a Design-to-Code Mapping section with a mermaid flowchart at the top showing the Figma-to-React property relationships.
Diagram format:
Placement: The mermaid diagram should be placed immediately after the ## Design-to-Code Mapping heading, before any tables.
Example README structure:
flowchart LR subgraph Figma["Figma Variants"] FSize["Size"] FType["Type"] end
subgraph React["React Props"] RSize["size"] RVariant["variant"] end
FSize -->|"Small → 'sm'<br>Medium → 'md'<br>Large → 'lg'"| RSize FType -->|"Primary → 'primary'<br>Secondary → 'secondary'"| RVariant
style Figma fill:#f3e8ff,stroke:#9333ea style React fill:#dbeafe,stroke:#3b82f6 `
Variant Mappings
...
name="ButtonType=Responsive, Type=Primary, Size=Small"
variant: { ButtonType: 'Responsive' }, // ✅ Exact match props: { size: figma.enum('Size', { ... }), // ✅ Exact match variant: figma.enum('Type', { ... }), // ✅ Exact match }
{hasIcon && <Icon />} {disabled ? 'disabled' : ''} {icon || <Fallback />}
figma.boolean('Has Icon', { true: <Icon />, false: undefined })
// String property figma.string('Label')
// Boolean property (simple) figma.boolean('Disabled')
// Boolean with mapping figma.boolean('Has Icon', { true: <Icon />, false: undefined })
// Conditional string based on boolean figma.boolean('Has label', { true: figma.string('Label'), false: undefined })
// Enum/Variant property figma.enum('Size', { 'Small': 'sm', 'Medium': 'md', 'Large': 'lg' })
// Text content from a layer figma.textContent('Button Label')
// Instance swap property (nested component) figma.instance('Icon')
// Child instances by layer name figma.children('Tab') figma.children(['Tab 1', 'Tab 2']) figma.children('Icon') // wildcard figma.children('') // all children
// Nested props - access child component's properties on parent figma.nestedProps('Button Shape', { size: figma.enum('Size', { ... }) })
// className builder figma.className([ 'btn-base', figma.enum('Size', { 'Large': 'btn-large' }), figma.boolean('Disabled', { true: 'btn-disabled', false: '' }) ])
// Instance with type inference figma.instance<React.FunctionComponent>('Icon') // Returns component type figma.instance<string>('Icon') // Returns string ID
// Access nested instance props in parent figma.instance('Icon').getProps<{ iconId: string, size: 'sm' | 'lg' }>()
// Custom render for nested instance figma.instance('Icon').render<{ id: string }>(props => <CustomIcon id={props.id} />)
figma.connect(PrimaryButton, 'https://...', { variant: { Type: 'Primary' }, example: () => <PrimaryButton /> })
figma.connect(SecondaryButton, 'https://...', { variant: { Type: 'Secondary' }, example: () => <SecondaryButton /> })
// Boolean variant restriction figma.connect(IconButton, 'https://...', { variant: { 'Has Icon': true }, example: () => <IconButton /> })
// Multiple variant combination figma.connect(DangerButton, 'https://...', { variant: { Type: 'Danger', Disabled: true }, example: () => <DangerButton /> })
import figma from '@figma/code-connect' import { Button } from './Button'
figma.connect(Button, 'https://figma.com/design/abc123/File?node-id=1:2', { props: { variant: figma.enum('Variant', { Primary: 'primary', Secondary: 'secondary' }), size: figma.enum('Size', { Small: 'sm', Medium: 'md', Large: 'lg' }), disabled: figma.boolean('Disabled'), label: figma.textContent('Label'), icon: figma.boolean('Has Icon', { true: figma.instance('Icon'), false: undefined }) }, example: ({ variant, size, disabled, label, icon }) => ( <Button variant={variant} size={size} disabled={disabled} icon={icon}> {label} </Button> ) })
// Icon component figma.connect('https://...icon-url...', { example: () => <IconHeart /> })
// Parent using the icon figma.connect(Button, 'https://...button-url...', { props: { icon: figma.instance('Icon') }, example: ({ icon }) => <Button>{icon}</Button> }) // Renders: <Button><IconHeart/></Button>
// Icon returns component reference (not JSX) figma.connect('https://...icon-url...', { example: () => IconHeart // No angle brackets })
// Parent receives component type figma.connect(Button, 'https://...', { props: { Icon: figma.instance<React.FunctionComponent>('Icon') }, example: ({ Icon }) => <Button Icon={Icon} /> }) // Renders: <Button Icon={IconHeart} />
// Icon returns string ID figma.connect('https://...icon-url...', { example: () => 'icon-heart' })
// Parent uses string figma.connect(Button, 'https://...', { props: { iconId: figma.instance<string>('Icon') }, example: ({ iconId }) => <Button iconId={iconId} /> }) // Renders: <Button iconId="icon-heart" />
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingfigma/figma-connect-component/SKILL.md
Popularity
- Repository stars
- 112
- Repository forks
- 61
- 7-day trend score
- 24
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/bitovi/ai-enablement-prompts/figma-connect-component)