Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

figma-to-code

БесплатноБез исполняемых скриптовНе проверен

Converts Figma designs into production-ready frontend code. Use when someone shares a Figma URL, design screenshot, or exported design tokens and needs…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

Figma to Code

Overview

This skill converts Figma designs into production-ready frontend components. It extracts layout structure, spacing, typography, colors, and interactive states from designs and generates clean, responsive code using the team's existing tech stack and design system.

Instructions

Getting Design Information

There are three ways to receive design input:

  1. Figma URL — A link such as https://www.figma.com/design/Kp7dRw2xLm9QeTz4uVn8Ys/Billing-Dashboard?node-id=1289-4127 carries the file key (Kp7dRw2xLm9QeTz4uVn8Ys) and the node id (1289-4127, written 1289:4127 in the API). Read it one of two ways:

    Figma MCP server (preferred; only clients in Figma's MCP catalog, such as Claude Code, Codex, Cursor and VS Code, can connect). Add the server once, authorize it in the browser (in Claude Code: run /mcp, select figma, then Authenticate), then pass the link to its tools:

    claude mcp add --transport http figma https://mcp.figma.com/mcp   # Claude Code
    codex mcp add figma --url https://mcp.figma.com/mcp               # Codex CLI
    
    • get_design_context — layout, styles, and reference code for the node (React + Tailwind unless the prompt names another stack)
    • get_variable_defs — the variables and styles the node uses, for design tokens
    • get_screenshot — an image of the node to check the result against
    • get_metadata — a sparse XML outline, for frames too large to fetch whole

    Figma REST API. Use a personal access token (Figma Settings → Security) with the file_content:read scope, kept in FIGMA_TOKEN:

    curl -s -H "X-Figma-Token: $FIGMA_TOKEN" \
      "https://api.figma.com/v1/files/Kp7dRw2xLm9QeTz4uVn8Ys/nodes?ids=1289:4127" \
      | jq '.nodes["1289:4127"].document'
    
    # Export icons and illustrations as SVG (returns temporary download URLs)
    curl -s -H "X-Figma-Token: $FIGMA_TOKEN" \
      "https://api.figma.com/v1/images/Kp7dRw2xLm9QeTz4uVn8Ys?ids=1301:88,1301:92&format=svg"
    

    Parse the node JSON for layout (layoutMode, itemSpacing, paddingLeft, absoluteBoundingBox), styles (fills, effects, cornerRadius, text style.fontFamily / fontSize / fontWeight / lineHeightPx), and component structure (children, componentId).

  2. Screenshot/Image — Analyze the image visually to identify:

    • Layout grid (columns, gutters, margins)
    • Component hierarchy (cards, headers, lists, forms)
    • Typography scale (headings, body, captions)
    • Color palette and spacing patterns
  3. Exported Design Tokens — Parse JSON/CSS design tokens directly.

Generating Components

  1. Identify the component tree — Break the design into a hierarchy:

    • Page → Sections → Components → Elements
    • Map each to a React/Vue component or HTML section
  2. Extract design tokens:

    • Colors: Map to CSS custom properties or theme variables
    • Typography: Font family, size, weight, line-height, letter-spacing
    • Spacing: Padding, margin, gap values — normalize to a spacing scale (4px base)
    • Border radius, shadows, opacity
  3. Generate the code following these rules:

    • Use semantic HTML (<nav>, <main>, <article>, <section>)
    • Use CSS Grid or Flexbox for layout — never absolute positioning for flow content
    • Make it responsive: mobile-first, use clamp() for fluid typography
    • Use the team's existing component library if specified (e.g., Tailwind, shadcn/ui, MUI)
    • Extract repeated patterns into reusable components
    • Add proper ARIA attributes for accessibility
  4. Handle responsive breakpoints:

    • If the design shows multiple viewport sizes, implement all of them
    • If only desktop is shown, create sensible mobile breakpoints:
      • Stack horizontal layouts vertically below 768px
      • Collapse navigation to a hamburger menu
      • Adjust font sizes with clamp()
  5. Handle interactive states:

    • Hover, focus, active, disabled states
    • Loading skeletons where data is dynamic
    • Empty states and error states if visible in the design

Output Structure

Deliver code as individual files:

components/
  ComponentName/
    ComponentName.tsx       # Component code
    ComponentName.module.css # Styles (omit when styling with Tailwind classes)
    index.ts                # Re-export

Examples

Example 1: Pricing Card from Figma Screenshot

User provides: Screenshot of a pricing card with three tiers

Agent output:

// components/PricingCard/PricingCard.tsx
import { CheckIcon } from "../icons/CheckIcon";
import styles from "./PricingCard.module.css";

interface PricingCardProps {
  name: string;
  price: number;
  period: "monthly" | "yearly";
  features: string[];
  ctaLabel: string;
  highlighted?: boolean;
  onSelect: () => void;
}

export function PricingCard({ name, price, period, features, ctaLabel, highlighted, onSelect }: PricingCardProps) {
  return (
    <article className={`${styl
Полный SKILL.md на GitHub

Установить figma-to-code в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл figma-to-code?

Converts Figma designs into production-ready frontend code. Use when someone shares a Figma URL, design screenshot, or exported design tokens and needs React/Vue/HTML components, responsive layouts, or design system code. Trigger words: Figma, design to code, mockup, wireframe, UI implementation, pixel perfect, design handoff, component from design.

Как установить скилл figma-to-code?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл figma-to-code запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить figma-to-code с