Skip to content
figma-generate-component logo

Generate Component from Figma

figma-generate-component

Generate production-ready code from a Figma component or frame using the Figma MCP server

TheBushidoCollective/han0installs199stars

SKILL.md

Full skill instructions

Generate Component from Figma

Name

figma:figma-generate-component - Generate production-ready code from Figma designs

Synopsis

Convert Figma frames and components into production code (React, Vue, HTML/​CSS) using the Figma Desktop MCP server with support for Code Connect mappings and design tokens.

Description

You are tasked with generating production-ready code from a Figma design using the Figma MCP server. This command bridges the design-to-code workflow by analyzing Figma frames and converting them into semantic, accessible, framework-specific components.

Implementation

Uses the Figma Desktop MCP server (HTTP transport at http://127.0.0.1:3845/​mcp) to access selected frames or node IDs from Figma URLs. Leverages Code Connect mappings when available to prefer design system components over generating code from scratch.

Input Methods

The user can provide Figma context in two ways:

  1. Selection-based: User has selected a frame in Figma desktop app
  2. Link-based: User provides a Figma URL with node ID

Your Task

  1. Understand the Context:

    • If the user selected a frame in Figma, access it via MCP
    • If the user provided a URL, extract the node ID and access the design
    • If neither is provided, ask the user to either:
      • Select a frame in Figma and try again, OR
      • Provide a Figma URL with a node ID
  2. Analyze the Design:

    • Use Figma MCP tools to extract the frame structure
    • Identify components, layout, styling, and content
    • Note any design tokens or variables used
    • Check for Code Connect mappings if available
  3. Generate Code:

    • Ask the user what framework/​language they want (React, Vue, HTML/​CSS, etc.)
    • Generate clean, production-ready code that matches the design
    • Use semantic HTML and accessible markup
    • Apply proper component patterns for the target framework
    • Use design system components if Code Connect mappings exist
    • Include comments explaining key decisions
  4. Provide Context:

    • Explain the component structure
    • Note any design tokens that should be added to the design system
    • Suggest any improvements or accessibility enhancements
    • Mention responsive behavior considerations

Best Practices

  • Semantic HTML: Use appropriate HTML elements (nav, main, article, etc.)
  • Accessibility: Include ARIA labels, proper heading hierarchy, keyboard navigation
  • Design Tokens: Use variables for colors, spacing, typography when possible
  • Component Composition: Break complex UIs into smaller, reusable components
  • Responsive Design: Consider mobile, tablet, desktop breakpoints
  • Code Connect: Prefer mapped components over generating from scratch

Example Output Format

When generating a React component, structure it like:

// ComponentName.tsx
import React from 'react';
import { DesignSystemButton } from '@/​components/​Button'; // Using Code Connect mapping

interface ComponentNameProps {
  // Props based on Figma variants
}

/​**
 * ComponentName - Brief description
 *
 * Figma: [Link to Figma frame]
 * Design tokens used: --color-primary, --spacing-md, --font-heading
 */
export const ComponentName: React.FC<ComponentNameProps> = ({ ...props }) => {
  return (
    // JSX matching Figma layout
  );
};

Validation

Before finishing:

  1. Verify the code compiles/​is valid syntax
  2. Check that layout matches Figma design
  3. Ensure all interactive elements are accessible
  4. Confirm design tokens are properly referenced
  5. Note any missing assets or resources needed

Notes

  • If the Figma MCP server is not connected, provide setup instructions
  • If the frame is very complex, offer to break it into multiple components
  • Always respect the user's framework preference
  • Suggest testing in different viewports/​screen sizes

More skills from TheBushidoCollective

typescript-utility-types logo
TheBushidoCollective/han

typescript-utility-types

Use when typeScript utility types, mapped types, and advanced type manipulation. Use when creating flexible, type-safe TypeScript code.

199 0
View
shell-portability logo
TheBushidoCollective/han

shell-portability

Use when writing shell scripts that need to run across different systems, shells, or environments. Covers POSIX compatibility and platform differences.

199 0
View
tailwind-performance logo
TheBushidoCollective/han

tailwind-performance

Use when optimizing Tailwind CSS for production, reducing bundle size, and improving performance. Covers PurgeCSS, JIT mode, and build optimization.

199 0
View
dialyzer-integration logo
TheBushidoCollective/han

dialyzer-integration

Use when integrating Dialyzer into development workflows and CI/CD pipelines for Erlang/Elixir projects.

199 0
View
rubocop-configuration logo
TheBushidoCollective/han

rubocop-configuration

Use when ruboCop configuration including YAML config, departments, inheritance, and customization.

199 0
View
elixir-otp-patterns logo
TheBushidoCollective/han

elixir-otp-patterns

Use when Elixir OTP patterns including GenServer, Supervisor, Agent, and Task. Use when building concurrent, fault-tolerant Elixir applications.

199 0
View
ameba-custom-rules logo
TheBushidoCollective/han

ameba-custom-rules

Use when creating custom Ameba rules for Crystal code analysis including rule development, AST traversal, issue reporting, and rule testing.

199 0
View
Swift Optionals Patterns logo
TheBushidoCollective/han

Swift Optionals Patterns

Use when swift's optional handling patterns including optional binding, chaining, nil coalescing, and modern approaches to safely working with optional values while avoiding common pitfalls and force unwrapping.

199 0
View
code-annotation-patterns logo
TheBushidoCollective/han

code-annotation-patterns

Use when annotating code with structured metadata, tags, and markers for AI-assisted development workflows. Covers annotation formats, semantic tags, and integration with development tools.

199 0
View
Scala Collections logo
TheBushidoCollective/han

Scala Collections

Use when scala collections including immutable/mutable variants, List, Vector, Set, Map operations, collection transformations, lazy evaluation with views, parallel collections, and custom collection builders for efficient data processing.

199 0
View
reactflow-custom-nodes logo
TheBushidoCollective/han

reactflow-custom-nodes

Use when creating custom React Flow nodes, edges, and handles. Covers custom node components, resizable nodes, toolbars, and advanced customization.

199 0
View
junit-fundamentals logo
TheBushidoCollective/han

junit-fundamentals

Use when jUnit fundamentals including annotations, assertions, and test lifecycle for Java testing.

199 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View