← 返回
未分类 Key

figma-ios-asset-export

Export real Figma design nodes through the Figma REST images API into iOS-ready assets. Use whenever the user provides a Figma link for an iOS screen, UI implementation, visual review, design restoration, icon, illustration, logo, empty state, banner, background, or any custom visual asset. Default to downloading the Figma node as @2x/@3x PNG files into Xcode .xcassets; use vector PDF only when explicitly requested. This skill should prevent substituting Figma visuals with hand-built layers, app
Export real Figma design nodes through the Figma REST images API into iOS-ready assets. Use whenever the user provides a Figma link for an iOS screen, UI implementation, visual review, design restoration, icon, illustration, logo, empty state, banner, background, or any custom visual asset. Default to downloading the Figma node as @2x/@3x PNG files into Xcode .xcassets; use vector PDF only when explicitly requested. This skill should prevent substituting Figma visuals with hand-built layers, approximate shapes, or SF Symbols unless the user explicitly approves the substitution.
Bin
未分类 community v1.0.3 3 版本 100000 Key: 需要
★ 0
Stars
📥 94
下载
💾 0
安装
3
版本
#latest

概述

Figma iOS Asset Export

Workflow

Use scripts/export_figma_ios_assets.mjs for repeatable exports. It calls the Figma REST GET /v1/images/:key endpoint and downloads the returned asset URLs. Prefer PNG @2x and @3x for ordinary iOS bitmap assets; use PDF only when the user asks for vector PDF or when the asset should preserve vector representation.

Asset-First Rule

When a Figma link is part of an iOS implementation or visual matching task, treat the Figma file as the source of truth for custom imagery. Before replacing a visual node with native drawing, CALayers, SwiftUI shapes, UIKit views, or SF Symbols, decide whether it is an exportable asset.

Export the real Figma node by default for:

  • Custom icons, tab/nav/action icons, pictograms, badges, logos, illustrations, empty states, decorative images, complex vector groups, gradients, masks, blurred artwork, background art, and any node whose exact pixels affect the design match.
  • Figma nodes that look like icons even if a similar SF Symbol exists.
  • Multi-layer or localized visual groups where recreating with code would be approximate or time-consuming.

Use native iOS drawing/layout only for:

  • Text, simple rectangles, separators, standard controls, solid fills, rounded corners, shadows, and layout structure that can be matched directly in code.
  • Assets the user explicitly says to replace with SF Symbols or native shapes.
  • A Figma node that is clearly a standard SF Symbol and the design or user names that symbol.

If export access is blocked by a missing token, missing node id, permissions, or Figma API failure, report the blocker and continue with a clearly marked temporary placeholder only when necessary. Do not silently substitute SF Symbols or approximate layers for Figma artwork.

Figma Link Triage

When the user pastes a Figma URL:

  1. Extract the file key and node id from the URL.
  2. If the URL points to a screen/frame, inspect the design context or metadata to identify child visual nodes that should be exported.
  3. Create a mapping for each exportable visual node before implementing the screen.
  4. Export into the target app's .xcassets whenever an Xcode project is present.
  5. Reference the exported images from the iOS code using the generated asset names.
  6. Mention any intentionally non-exported nodes and why they are safe to build natively.

Prerequisites:

  • A Figma token with file read access. Pass --token-file, set FIGMA_TOKEN_FILE, or set FIGMA_TOKEN. Do not store real tokens in the skill or in committed mapping files.
  • Node.js with built-in fetch support.

Mapping File

Create a JSON mapping with either a top-level array or an object with items. Prefer stable, descriptive asset names prefixed by the feature or screen when exporting into a real app, for example home_empty_state or profile_nav_settings.

{
  "figmaUrl": "https://www.figma.com/design/FILE_KEY/FileName?node-id=1-607",
  "assetRoot": "/absolute/path/App/Assets.xcassets/FigmaSlices",
  "items": [
    { "asset": "figma_icon_settings", "nodeId": "1:202", "figmaName": "设置" },
    { "asset": "figma_icon_back", "nodeId": "1:476", "figmaName": "左侧图标/ic_back" }
  ]
}

Fields:

  • figmaUrl: Any design URL from the target Figma file. The script extracts file key and file name.
  • assetRoot: Optional. When set, each item writes an Xcode .imageset and rewrites Contents.json.
  • outDir: Optional alternative to assetRoot. Writes plain exported files to a directory.
  • asset: Required for assetRoot; also used as the filename stem for outDir.
  • nodeId: Required Figma node id, using either 1:202 or 1-202.
  • format: Optional mapping default, png or pdf. Prefer the default png.
  • scales: Optional PNG scale list. Default is [2, 3].

For a single pasted node URL, still create a mapping instead of manually downloading one-off files. This keeps names, scales, and .imageset metadata repeatable.

Commands

For Xcode PNG imagesets:

node ~/.codex/skills/figma-ios-asset-export/scripts/export_figma_ios_assets.mjs \
  --mapping /tmp/figma-assets.json

For plain PNG files:

node ~/.codex/skills/figma-ios-asset-export/scripts/export_figma_ios_assets.mjs \
  --figma-url "https://www.figma.com/design/FILE_KEY/FileName" \
  --mapping /tmp/figma-assets.json \
  --out-dir /tmp/figma-pngs

For vector PDF assets:

node ~/.codex/skills/figma-ios-asset-export/scripts/export_figma_ios_assets.mjs \
  --mapping /tmp/figma-assets.json \
  --format pdf

Verification

After exporting into .xcassets, run:

find PATH_TO_ASSET_ROOT -name '*.png' -o -name '*.pdf'
find PATH_TO_ASSET_ROOT -name Contents.json -print0 | xargs -0 python3 -m json.tool >/dev/null

For iOS projects, build through the project-approved verification command. PNG @2x and @3x exports are the default because they map directly to iOS scale factors. PDF preserves vector layers when Figma can export them, but raster images embedded inside Figma remain raster content inside the PDF.

版本历史

共 3 个版本

  • v1.0.3 1.0.3:更新 Figma iOS asset export skill 包,包含 SKILL.md、OpenAI metadata 和可重复导出脚本;保持默认导出 @2x/@3x PNG 到 Xcode .xcassets,并明确 token 安全边界与原始 Figma 视觉优先规则。 当前
    2026-06-16 10:53 安全 安全
  • v1.0.2 Initial release
    2026-05-28 14:56 安全 安全
  • v1.0.0 Initial release
    2026-05-22 10:35 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

design-media

UI/UX Pro Max

xobi667
提供 UI/UX 设计智能与实现指导,帮助打造精美界面。适用于 UI 设计、UX 流程、信息架构、视觉风格、设计系统/标记、组件规格、文案/微文案、无障碍及前端 UI(HTML/CSS/JS、React、Next.js、Vue、Svelte
★ 216 📥 47,229
design-media

Nano Banana Pro

steipete
使用 Nano Banana Pro (Gemini 3 Pro Image) 生成或编辑图像。支持文生图、图生图及 1K/2K/4K 分辨率,适用于图像创建、修改及编辑请求,使用 --input-image 指定输入图像。
★ 429 📥 116,698
design-media

Openai Whisper

steipete
使用 Whisper CLI 进行本地语音转文字(无需 API 密钥)
★ 330 📥 93,574