AI Agent Hub
Back to skills
Figma Design to Modular Code icon

Figma Design to Modular Code

Development Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please install @user_3141f90e/figma2code according to https://skillhub.cn/install/skillhub.md.

About this skill

Problem

When translating a complex design in one pass, models often track page structure, tokens, breakpoints, and layout at once, causing inconsistent components, spacing drift, flattened hierarchy, and lost responsive behavior. The root issue is context overload, not simply code generation quality.

How It Works

figma2code separates planning from execution. It expects a connected Figma or Mastergo MCP server to read structured node data such as type, layout, and fills, and uses rendered images for visual comparison. Phase 1 confirms target framework, TypeScript, styling approach, existing component library, theme tokens, output path, responsive scope, interactions, and base width, then creates PLAN.md with tokens and a module list. Phase 2 produces COMPONENTS.md, merges repeated elements, decides whether to use, wrap, or build each component based on existing libraries such as Element Plus, Vant, Ant Design, shadcn/ui, or internal UI kits, and maps hover, disabled, and loading variants. Phase 3 builds in the order token, primitive, composite, and module. Each unit is grounded in node data and a 2x rendered reference, with required fixes for color, spacing, font size, and layout differences. Phase 4 assembles the page, checks cross-module consistency and breakpoints, and provides a handoff list including generated files, reused components, logged differences, usage notes, dependencies, and intentional deviations.

Boundaries

It is best for pages with multiple sections, repeated components, or poor one-shot conversion results; a single small button does not need the full workflow. Without a design MCP, screenshots cannot replace structured node data for spacing, color, and typography tokens. Mini-program, Flutter, SwiftUI, and React Native targets need extra care for rpx, safe areas, native layering, line-height, and shadow behavior. Interactions, animations, empty states, error states, and accessibility should be scoped explicitly rather than inferred from static screenshots.

Use Cases

  • Convert a Figma admin dashboard home page into React and Tailwind components, prioritizing Ant Design reuse.
  • Break a Mastergo campaign page into Vue 3 modules by tokens, cards, and lists, then check spacing and breakpoints.
  • Add a home page to an existing mini-program project, identify the current component library, and restore it module by module.
  • Redo a page that drifted after one-shot code generation by repeating planning, component mapping, modular restoration, and assembly.

Best For

  • Frontend engineers landing Figma or Mastergo designs into React or Vue projects, focused on reducing duplicate components and spacing drift.
  • Frontend developers maintaining component libraries or design tokens, aiming to unify color, typography, spacing, and reuse existing components.
  • Mini-program, Taro, or uni-app developers restoring pages who need to handle rpx, safe areas, and native layering differences.
  • Engineers taking over legacy pages and needing a clear module list and component lineage for later changes and handoff.