← 返回 Skills 市场
timeaground

Figma to Mobile

作者 TimeAground · GitHub ↗ · v1.3.0 · MIT-0
cross-platform ⚠ suspicious
167
总下载
0
收藏
0
当前安装
6
版本数
在 OpenClaw 中安装
/install figma-to-mobile
功能描述
Convert 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 mo...
使用说明 (SKILL.md)

\r \r

Figma to Mobile\r

\r Convert Figma designs to mobile UI code with interactive clarification.\r \r Supported: Android Compose, Android XML, iOS SwiftUI, iOS UIKit.\r \r

Prerequisites\r

\r

  • FIGMA_TOKEN environment variable set (Figma > Settings > Personal Access Tokens)\r
  • Python 3.8+ with requests package\r \r

Trigger & Input\r

\r This skill activates when a user provides a Figma link.\r \r The user may also include inline hints alongside the link, such as:\r

  • Target platform: "Android XML", "Compose", "SwiftUI", "UIKit"\r
  • Layout preferences: "use ConstraintLayout", "prefer StackView"\r
  • Component notes: "the switch is our custom CompactSwitch", "this is a dynamic list"\r
  • Any other context about the design\r \r If the user provides hints, respect them and skip the corresponding questions.\r 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.\r \r

Workflow\r

\r

Step 1: Fetch & Analyze\r

\r When user provides Figma link(s):\r \r

  1. Determine the input type:\r \r A. Link without specific node-id (no node-id, or node-id=0-1):\r This link points to the entire page, not a specific frame. Tell the user:\r

    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.\r If you want to convert multiple frames, send multiple links.\r \r B. Single frame link (has specific node-id):\r Run scripts/figma_fetch.py "\x3Curl>" → returns that frame's design data.\r Proceed to analysis.\r \r C. Multiple links (user sends 2+ URLs):\r First, determine the relationship by examining frame names and user context:\r \r

    • 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).\r \r
    • Parent page + overlay/drawer (e.g. "首页" + "首页-抽屉-xxx"): Generate each as an independent layout file. Then tell the user the relationship:\r

      Frame 1 ("首页") and Frame 2 ("首页-抽屉") look like a main page + side drawer.\r I've generated two separate layout files. How you wire them together (DrawerLayout, Navigation, etc.) depends on your project architecture.\r \r The Skill's job is generating UI layout code, not deciding architecture (Activity vs Fragment vs Navigation).\r \r

    • 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).\r \r
    • 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?"\r \r Rate limit protection for multiple links: When fetching multiple nodes, wait 2-3 seconds between requests. Never fire more than 2 requests in parallel.\r \r
  2. 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.\r \r
  3. Analyze the structure: identify sections, repeated patterns, component types\r
  4. Note INSTANCE nodes — they indicate reusable components. Check variantProperties for component state (e.g. State=Default, Size=Large) — these map to multi-state code\r
  5. Note gradient/shadow data — flag for the user if complex\r
  6. Apply Figma node interpretation rules before generating code\r \r Detailed interpretation rules: Read references/figma-interpretation.md\r \r

Step 1.5: Structure Summary\r

\r Before asking any questions, present a brief structure summary to the user so they can confirm your understanding:\r \r

I see: [navigation bar with back button + title] → [2 content sections: user profile card, settings list (8 items)] → [bottom action button]. Total ~25 nodes.\r \r Keep it to 2-3 lines. Mention:\r

  • Major sections identified (nav bar, content areas, footer)\r
  • Repeated patterns ("8 similar list items", "3 tab labels")\r
  • Notable elements (gradients, complex illustrations, stacked cards)\r \r If the user says "that's wrong" or corrects the structure, adjust understanding before proceeding to Step 2.\r \r If the structure is simple and obvious (e.g., a single card with a few text fields), skip this step.\r \r

Step 2: Confirm & Clarify\r

\r Question priority (strict order — ask earlier questions first):\r \r

  1. Output format (MUST ask first unless user already specified)\r → Android XML / Compose / SwiftUI / UIKit\r This determines all subsequent analysis phrasing and code output.\r \r
  2. Structural ambiguities (only ask what you're genuinely unsure about)\r → "These N items look similar — dynamic list or fixed layout?"\r → "This area: single image asset or icon-on-background combo?"\r \r
  3. Component choices (only if platform-relevant)\r → "Any custom components to use? (otherwise I'll use platform defaults)"\r \r Rules for questions:\r
  • Skip any question the user already answered via inline hints\r
  • Max 3-5 questions total, fewer is better\r
  • Each question gives concrete options with one-line pros/cons\r
  • Every question includes an open option: "or tell me more about this"\r
  • Use natural language, no JSON or technical dumps\r
  • If everything is clear (user gave full context + simple structure), skip Step 2 entirely\r \r Confidence guide — when to ask vs. when to just generate:\r
  • ≥3 sibling nodes with similar structure → likely a list → ASK (dynamic vs static)\r
  • INSTANCE nodes sharing same componentId → reusable component → MENTION but can default\r
  • Single clear hierarchy, no ambiguity → high confidence → SKIP questions, go to Step 3\r
  • Gradient/complex shadow in design → MENTION in summary ("I see a gradient here, I'll approximate it as X")\r \r

Step 2.5: Project Scan (optional but recommended)\r

\r If the target project is available locally, run a project scan:\r \r

python scripts/project_scan.py /path/to/project --json --output scan-report.json\r
```\r
\r
**How to use scan results in code generation**: Read `references/scan-usage.md`\r
\r
### Step 3: Generate Code\r
\r
After user confirms (or if no questions needed), generate code files.\r
\r
**Detailed generation rules**: Read `references/generation-rules.md`\r
\r
If multiple files are needed, output each with a clear filename header:\r
```\r
📄 activity_notification_settings.xml\r
[code]\r
\r
📄 item_expert_notification.xml\r
[code]\r
```\r
\r
### Step 4: Iterate & Capture Feedback\r
\r
After showing code, ask briefly:\r
> Matches the design? Any adjustments?\r
\r
**The user can then give feedback to refine the output.** Common iterations:\r
- "间距大了" → adjust specific spacing\r
- "Switch 换成我们的 CustomSwitch" → swap component\r
- "把标题栏去掉" → remove section\r
- "换成 Compose 版本" → regenerate in different format\r
- "颜色不对,这里应该是 #333333" → fix specific values\r
\r
Continue iterating until the user is satisfied. Each round only regenerates the changed parts, not the entire file (unless the user asks for full regeneration).\r
\r
**Feedback capture (automatic):**\r
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:\r
\r
```\r
## YYYY-MM-DD HH:MM\r
- **Platform**: Android XML / Compose / SwiftUI / UIKit\r
- **Figma node type**: (e.g., FRAME with icon, Tab bar, Button group)\r
- **Issue**: Brief description of what was wrong\r
- **Before**: What the agent generated (snippet or description)\r
- **After**: What the user wanted (snippet or description)\r
- **Rule candidate**: (optional) If this correction suggests a general pattern rule, note it here\r
```\r
\r
Log entries should be:\r
- **Concise** — only the relevant diff, not entire files\r
- **Categorized** — always include platform and Figma node type for later analysis\r
- **Actionable** — focus on the mapping error, not cosmetic preferences (e.g., "user prefers 16dp" is not a rule; "VECTOR compositions should be single ImageView" is)\r
\r
Do NOT log:\r
- One-off personal preferences (specific color choices, naming conventions)\r
- Corrections to non-mapping issues (typos, import statements)\r
- Feedback the user explicitly says is project-specific, not general\r
\r
Periodically (or when asked), run `scripts/feedback_analyze.py` to identify patterns and generate rule candidates.\r
\r
## Error Handling\r
\r
- **FIGMA_TOKEN not set** (script outputs `FIGMA_TOKEN_NOT_SET`) → do NOT ask user to run commands. Instead:\r
  1. Tell the user you need a Figma Personal Access Token\r
  2. Tell them where to get it: Figma → avatar (top-left) → Settings → Security → Personal Access Tokens\r
  3. Ask them to paste the token in chat\r
  4. Once they provide it (starts with `figd_`), write it to the project root `.env` file: `echo 'FIGMA_TOKEN=figd_xxx' >> .env`\r
  5. Retry the figma_fetch command — it will read from `.env` automatically\r
- **FIGMA_TOKEN invalid** (API returns 403/401) → token may have expired or been revoked. Ask user to regenerate and paste new token. Update `.env` file.\r
- **Invalid URL** → show valid URL example: `https://www.figma.com/design/\x3CfileKey>/\x3Cname>?node-id=\x3Cid>`\r
- **API error** → show error message, suggest checking network/proxy\r
- **Node too large (>200 children)** → suggest selecting a smaller frame\r
- **Depth auto-increased** → the script auto-retries with deeper depth if it detects truncated children. Inform user if this happens ("I needed to fetch deeper to get all details").\r
安全使用建议
This skill appears to do what it says: it calls the Figma API (requires a Personal Access Token), runs Python scripts to analyze the design tree, and can optionally scan a local project directory to match existing resources. Before installing or running: 1) Review and restrict the FIGMA_TOKEN you provide — prefer a dedicated token with minimal access and revoke it when finished. 2) Expect the skill to write generated code and exported assets into your workspace; run it in a safe/test directory if you want to avoid accidental overwrites. 3) If you plan to use project_scan, be aware it will read your project files to match colors/strings. 4) The install step runs pip3 install requests; ensure this is acceptable in your environment. If you want higher assurance, inspect scripts/figma_fetch.py and project_scan.py contents locally before running.
功能分析
Type: OpenClaw Skill Name: figma-to-mobile Version: 1.3.0 The skill provides a legitimate and highly functional toolset for converting Figma designs into mobile UI code, including scripts for fetching Figma API data (figma_fetch.py) and scanning local project resources (project_scan.py). However, SKILL.md contains a shell injection vulnerability in its error-handling instructions; it directs the AI agent to persist a user-provided Figma token by executing an unsanitized 'echo' command into a .env file. While this appears to be an unintentional security flaw intended for configuration persistence rather than a malicious backdoor, it poses a risk if the agent processes a specially crafted token.
能力标签
cryptorequires-oauth-token
能力评估
Purpose & Capability
Name/description, required binary (python3), and required env var (FIGMA_TOKEN) match the code and SKILL.md. The included scripts (figma_fetch.py, scanners, project_scan.py) are coherent with converting Figma designs and optionally scanning a local project for resource matching.
Instruction Scope
SKILL.md instructs the agent to call scripts/figma_fetch.py and (optionally) scripts/project_scan.py. These steps legitimately fetch design data from the Figma API and may scan a user-supplied local project path to match resources. Be aware the project_scan step reads local filesystem paths when invoked (this is expected for resource-matching but is a broader scope than pure Figma fetch).
Install Mechanism
No risky installers; only a single, explicit pip3 install requests command is suggested in SKILL.md. There are no downloads from unknown URLs or archive extraction steps.
Credentials
Only FIGMA_TOKEN is required (declared as primaryEnv). That is appropriate for accessing the Figma REST API. No unrelated credentials or broad secrets are requested.
Persistence & Privilege
always:false (no forced persistent inclusion). The skill will generate code and resource files when run and may write suggestions/feedback to local files (feedback-log.md). This file I/O is expected behavior for a code-generation tool but means the skill will write to working directories when invoked.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install figma-to-mobile
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /figma-to-mobile 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.3.0
Simplify link handling: one link = one frame, no more file overview mode. Add Figma seat/plan diagnostics on 429 rate limit. Cap Retry-After to prevent infinite waits.
v1.2.0
Add demo comparison image to README, expanded install/usage docs, SKILL.md refactored with modular references, new scanners for drawables and text styles
v1.1.0
v1.1.0: Figma数据补全(textAutoResize/layoutAlign/variantProperties/styleRefs) + Compose patterns补全(6章节) + Drawable shape扫描匹配 + TextAppearance索引 + 结构摘要输出 + 资源建议块 + 多状态batch compare + SKILL.md模块化拆分
v1.0.2
Fix metadata: declare FIGMA_TOKEN env var + python3 dependency - Added requires.env: FIGMA_TOKEN to package metadata - Added requires.bins: python3 - Added primaryEnv: FIGMA_TOKEN - Fixes ClawHub security scan flagging metadata inconsistency
v1.0.1
Multi-platform architecture + iOS support + performance optimization - Unified scan schema (base.py) with platform-agnostic ScanReport - iOS scanners: color (xcassets + Swift code), string (JSON i18n + .strings), imageset, custom View (UIKit + SwiftUI) - Single-pass Swift file scanning (24-50% faster) - Scan levels: --level resources (fast) vs full (default) - Android: module dependency graph + resource visibility filtering - Android: layout XML analysis (View usage, text styles, dimension patterns) - Updated xml-patterns.md: ConstraintLayout sizing rules, divider pattern, ImageView dark mode trend - Updated uikit/swiftui-patterns.md: dark mode inference rules - SKILL.md: new Step 2.5 Project Scan workflow
v1.0.0
Initial release: Figma design to mobile UI code (Android XML, Compose, SwiftUI, UIKit)
元数据
Slug figma-to-mobile
版本 1.3.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 6
常见问题

Figma to Mobile 是什么?

Convert 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 mo... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 167 次。

如何安装 Figma to Mobile?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install figma-to-mobile」即可一键安装,无需额外配置。

Figma to Mobile 是免费的吗?

是的,Figma to Mobile 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Figma to Mobile 支持哪些平台?

Figma to Mobile 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Figma to Mobile?

由 TimeAground(@timeaground)开发并维护,当前版本 v1.3.0。

💬 留言讨论