Install
openclaw skills install figma-to-mobileConvert Figma designs to mobile UI code. Supports Android (Jetpack Compose, XML) and iOS (SwiftUI, UIKit). Use when a user provides a Figma link and wants mobile layout code. Extracts design tokens via Figma REST API, asks clarifying questions, then generates production-ready code files.
openclaw skills install 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)requests packageThis skill activates when a user provides a Figma link.
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.
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):
Run scripts/figma_fetch.py "<url>" → returns that frame's design data.
Proceed to analysis.
C. Multiple links (user sends 2+ URLs): First, determine the relationship by examining frame names and user context:
Same page, different visual states (e.g. "首页-有banner" and "首页-无banner"): Use --compare mode to fetch all and get a diff summary. Generate multi-state code (conditional visibility, state switching).
Parent page + overlay/drawer (e.g. "首页" + "首页-抽屉-xxx"): Generate each as an independent layout file. Then tell the user the relationship:
Frame 1 ("首页") and Frame 2 ("首页-抽屉") look like a main page + side drawer. I've generated two separate layout files. How you wire them together (DrawerLayout, Navigation, etc.) depends on your project architecture.
The Skill's job is generating UI layout code, not deciding architecture (Activity vs Fragment vs Navigation).
Different independent pages (e.g. "首页" + "设置页" + "个人中心"): Process each independently. Fetch them one at a time with a pause between requests to avoid rate limiting. Present a summary of all pages, then ask which to convert first (or convert all sequentially).
Not sure: Ask the user — "These frames look related but I'm not sure how. Are they different states of the same page, a page with an overlay, or independent pages?"
Rate limit protection for multiple links: When fetching multiple nodes, wait 2-3 seconds between requests. Never fire more than 2 requests in parallel.
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:
If the target project is available locally, run a project scan:
python scripts/project_scan.py /path/to/project --json --output scan-report.json
How to use scan results in code generation: Read references/scan-usage.md
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.⚠️ 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. Do not skip this step — the log is how the skill learns and improves over time.
Feedback capture (automatic):
Whenever the user corrects your generated output, log the correction to feedback-log.md in the project root (create if it doesn't exist). Each entry follows this format:
## YYYY-MM-DD HH:MM
- **Platform**: Android XML / Compose / SwiftUI / UIKit
- **Figma node type**: (e.g., FRAME with icon, Tab bar, Button group)
- **Issue**: Brief description of what was wrong
- **Before**: What the agent generated (snippet or description)
- **After**: What the user wanted (snippet or description)
- **Rule candidate**: (optional) If this correction suggests a general pattern rule, note it here
Log entries should be:
Do NOT log:
Periodically (or when asked), run scripts/feedback_analyze.py to identify patterns and generate rule candidates.
FIGMA_TOKEN_NOT_SET) → do NOT ask user to run commands. Instead:
figd_), write it to the project root .env file: echo 'FIGMA_TOKEN=figd_xxx' >> .env.env automatically.env file.https://www.figma.com/design/<fileKey>/<name>?node-id=<id>