Install
openclaw skills install @timeaground/figma-to-mobileConvert Figma designs to mobile UI code (Compose/XML/SwiftUI/UIKit/Flutter) via the Figma REST API with local resource scanning, multi-frame comparison, and feedback-log corrections. Activate when a user provides a Figma link and asks for mobile layout code.
openclaw skills install @timeaground/figma-to-mobileConvert Figma designs to mobile UI code with interactive clarification.
Supported: Android Compose, Android XML, iOS SwiftUI, iOS UIKit.
FIGMA_TOKEN environment variable set (Figma > Settings > Personal Access Tokens)
⚠️ Your Figma token is sensitive — treat it like a password. Never paste it into chat
messages (they may be logged). Set it via your shell rc file or OpenClaw env config.requests packageThis skill activates when a user explicitly asks to convert a Figma design to mobile UI code and provides a Figma link. It does NOT activate on casual mentions of Figma links, pasted URLs in logs, or design references without a conversion request.
The user may also include inline hints alongside the link, such as:
If the user provides hints, respect them and skip the corresponding questions. For example, if the user says "Android XML, the 3 cards are a RecyclerView list", do NOT ask about output format or whether the cards are dynamic/static.
This skill is NOT for:
After a successful conversion, the user receives:
scan-report.json — project resource scan results, only when the user agrees to a project scan (Step 2.5).feedback-log.md — correction log written to the project root, only with user consent (Step 4).When user provides Figma link(s):
Determine the input type:
A. Link without specific node-id (no node-id, or node-id=0-1):
This link points to the entire page, not a specific frame. Tell the user:
This link points to the whole page. Please select the frame you want in Figma, right-click it, and choose "Copy link to selection", then send that link. If you want to convert multiple frames, send multiple links.
B. Single frame link (has specific node-id):
python scripts/figma_fetch.py "https://www.figma.com/design/<fileKey>/<name>?node-id=<id>"
→ returns that frame's design data. Proceed to analysis.
C. Multiple links (user sends 2+ URLs):
Determine the relationship by frame names and user context: same-page
states → --compare mode (multi-state code); parent+overlay → independent
layout files; independent pages → fetch one at a time, ask which to convert
first. If unsure, ask the user.
Detailed multi-frame rules: Read references/multi-frame.md
If the link has no specific node-id, ask the user to re-copy from the specific frame (see A above). Do NOT call the API.
Analyze the structure: identify sections, repeated patterns, component types
Note INSTANCE nodes — they indicate reusable components. Check variantProperties for component state (e.g. State=Default, Size=Large) — these map to multi-state code
Note gradient/shadow data — flag for the user if complex
Apply Figma node interpretation rules before generating code
Detailed interpretation rules: Read references/figma-interpretation.md
Before asking any questions, present a brief structure summary to the user so they can confirm your understanding:
I see: [navigation bar with back button + title] → [2 content sections: user profile card, settings list (8 items)] → [bottom action button]. Total ~25 nodes.
Keep it to 2-3 lines. Mention:
If the user says "that's wrong" or corrects the structure, adjust understanding before proceeding to Step 2.
If the design has ≤10 leaf nodes (visible elements that map to actual views), skip this step — the structure is simple enough to proceed directly.
Question priority (strict order — ask earlier questions first):
Output format (MUST ask first unless user already specified) → Android XML / Compose / SwiftUI / UIKit This determines all subsequent analysis phrasing and code output.
Structural ambiguities (only ask what you're genuinely unsure about) → "These N items look similar — dynamic list or fixed layout?" → "This area: single image asset or icon-on-background combo?"
Component choices (only if platform-relevant) → "Any custom components to use? (otherwise I'll use platform defaults)"
Rules for questions:
Confidence guide — when to ask vs. when to just generate:
⚠️ Always ask the user before scanning their project. Scanning reads local files; the user should know and agree.
"你的项目在 /path/to/project 对吗?要不要我先扫描一下项目里已有的资源 (颜色、文案、图片、自定义组件),这样生成代码时可以直接复用已有的东西?"
If the user agrees:
python scripts/project_scan.py /path/to/project --json --output scan-report.json
Then read scan-report.json and references/scan-usage.md.
If the user declines: proceed with hardcoded values per generation rules.
How to present scan results (with sample phrasing): Read references/scan-usage.md
If no project path is known yet, don't scan. Proceed with hardcoded generation.
After user confirms (or if no questions needed), generate code files.
Detailed generation rules: Read references/generation-rules.md
If multiple files are needed, output each with a clear filename header:
📄 activity_notification_settings.xml
[code]
📄 item_expert_notification.xml
[code]
After showing code, ask briefly:
Matches the design? Any adjustments?
The user can then give feedback to refine the output. Common iterations:
Continue iterating until the user is satisfied.
Iteration output rule:
// replaces lines 12-18 in activity_main.xml). Do NOT repeat the entire file.⚠️ Before logging any feedback, tell the user:
"I'll save this correction locally to
feedback-log.mdto improve future output. It stores before/after snippets — is that OK?" Only proceed if the user agrees.
⚠️ IMPORTANT: Every time the user corrects your output (layout issue, wrong component, spacing problem, etc.), you MUST log it to feedback-log.md before proceeding with the fix (after user consent). Do not skip this step — the log is how the skill learns and improves over time.
Feedback format, logging rules, and analysis: Read references/feedback-log.md
The bundled scripts/figma_fetch.py enforces these limits automatically:
Retry-After header (cap 30s)When a rate limit is exceeded, the script reports:
{
"status": "error",
"error": "RATE_LIMIT_EXCEEDED",
"message": "Figma API rate limit exceeded",
"retry_after_seconds": 30,
"plan_tier": "FREE",
"limit_type": "requests_per_minute"
}
Quick reference — full details in references/error-handling.md:
FIGMA_TOKEN_NOT_SET) → guide user to set env var; never paste token into chathttps://www.figma.com/design/<fileKey>/<name>?node-id=<id>references/error-handling.mdFIGMA_TOKEN into chat — set it as an environment variable (see Prerequisites).