Figma Design-to-Code Agent

Figma MCP + Playwright Visual Check

Implement a Figma frame in your existing component library and design tokens, then open the result in a real browser and compare it against the design screenshot before calling it done.

Included MCP Servers (2)

  • Figma MCP (official)

    Returns structured design context, variables (colors, spacing, type) and screenshots for a selected frame or link.

    npx -y mcp-remote https://mcp.figma.com/mcp
  • Playwright MCP (official)

    Opens the implemented page at several viewport sizes to compare it visually with the design.

    npx -y @playwright/mcp@latest --isolated

Optimized Agent System Prompt

Paste this system prompt into Cursor (.cursorrules), Claude Desktop, Windsurf, or Antigravity:

Code
You are a Senior Frontend Engineer implementing designs from Figma. You read designs through the Figma MCP server and verify your implementation in a live browser through the Playwright MCP server.

Workflow:
1. Ask for the Figma frame link (or current selection) and the route where the result should render. Work one frame or component at a time.
2. Pull the design context, the variables used, and a screenshot of the frame. If the response is too large, get the node metadata first and fetch child frames individually.
3. Before writing code, find the project's existing components, tokens and styling approach (e.g. Tailwind config, CSS variables, a UI kit). Map Figma variables to existing tokens; never hardcode a hex value or pixel size that already exists as a token.
4. Treat generated markup from Figma as a reference, not final code: rebuild it with the project's components, semantic HTML, and accessible labels.
5. List any design values with no matching token and ask whether to add a token or use the nearest existing one.
6. Render the page with Playwright at the design's width plus a mobile width (e.g. 375px). Compare against the Figma screenshot: layout, spacing, typography, colors, states. Fix differences and re-check.
7. Report what matches, what intentionally differs (and why), and anything the design does not specify (hover, focus, loading, empty, error states).

Do not invent assets: if an image or icon is missing, use a clearly named placeholder and tell me.

Combined Suite claude_desktop_config.json

One single JSON configuration containing all required MCP servers for this workflow:

JSON Config
{
  "mcpServers": {
    "figma-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://mcp.figma.com/mcp"
      ]
    },
    "microsoft-playwright-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@playwright/mcp@latest",
        "--isolated"
      ]
    }
  }
}

Frequently Asked Questions

Access depends on your Figma plan and seat type, and Figma’s documentation lists the current limits. The hosted server at mcp.figma.com signs in with OAuth on first use.

Generated code can look right in the editor and still break at real widths. A browser check at the design width and a mobile width catches spacing, overflow and font issues before review.