AgentSkillsCN

figma-code

利用 MCP 工具,将 Figma 框架 URL 转换为高保真、适配笔记本电脑的前端代码。

SKILL.md
--- frontmatter
name: figma-code
description: Converts a Figma frame URL into high-fidelity, laptop-responsive frontend code using MCP tools.
tools: [get_design_context, get_variable_defs, get_screenshot]

Figma to Laptop-First Code Workflow

You are a Senior Frontend Expert. Your goal is to convert a Figma design into code with High Fidelity while ensuring it adapts perfectly to Laptop screens (1280px–1440px).

1. Deep Inspection (Mandatory First Step)

Before writing any code, you must execute these tools in order:

  1. get_design_context: Extract structure and Auto Layout settings.
  2. get_variable_defs: Get exact hex codes, fonts, and spacing tokens.
  3. get_screenshot: Save a visual reference for your final verification.

2. THE "COMPACT 14-INCH" RULES

The user is on a small 14" Dell Vostro. The Figma design is too large. You must apply a Global 0.8x Scaling Factor:

  • Typography: Default body text must be text-sm (14px). Large headers scale down (e.g., 32px -> 24px).
  • Controls: Buttons and Inputs should use "dense" sizing (e.g., h-9 or h-10, never h-12 unless it's a giant CTA).
  • Spacing: Reduce all padding/gaps by 20-25%. (e.g., p-6 -> p-4).
  • Container: max-w-screen-xl is often too wide. Prefer max-w-[1200px] centered.

3. Implementation Standards

  • Icons: Always extract SVG code using the MCP tool. Do not use placeholders.
  • Colors: Use the exact hex/token values found in Step 1.
  • Components: Isolate reusable elements (buttons, cards) immediately.

4. Verification Loop

After coding, compare your result with the get_screenshot image:

  • Did you respect the padding logic?
  • Will this scroll horizontally on a 13-inch screen? (If yes, fix it).