Token导航 LogoToken导航TokenDH.com
研究检索external-servicegithub未标认证来源可访问许可证需确认审计提醒

figma-to-swiftuiFigma TO swiftui 搜索

Agent Skill

用于辅助界面设计、视觉规范、排版、配色、布局和交互体验优化。它适合让 Agent 根据产品场景整理页面结构、生成 UI 方案、检查视觉一致性或改进组件层级。使用时需要结合现有品牌、设计系统和用户任务,不应只堆装饰元素;涉及真实页面改动时,应通过截图或浏览器预览检查文本溢出、对齐和响应式表现。

总安装

2,025

周安装

87

GitHub Stars

10

下载量

710
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:figma-to-swiftui(Figma TO swiftui 搜索)
来源仓库:https://github.com/daetojemax/figma-to-swiftui-skill
仓库路径:skills/figma-to-swiftui
安装命令:
npx skills add https://github.com/daetojemax/figma-to-swiftui-skill --skill figma-to-swiftui
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/daetojemax/figma-to-swiftui-skill --skill figma-to-swiftui

简介

用于辅助界面设计、视觉规范和布局优化,适合整理页面结构或生成 UI 方案。

  • 支持根据产品场景检查视觉一致性并改进组件层级,结合品牌和设计系统使用。
  • 通过浏览器预览检查文本溢出和对齐,避免堆砌装饰元素,关注实际交互体验。
  • 安装方式:github,命令为 npx skills add https://github.com/daetojemax/figma-to-swiftui-skill --skill figma-to-swiftui。
  • 注意:涉及真实页面改动时需配合截图或本地预览确认响应式表现和视觉效果。

SKILL.md

Figma to SwiftUI Implementation Skill

Translate Figma nodes into production-ready SwiftUI views with pixel-perfect accuracy. Combines MCP integration rules with a structured implementation workflow for iOS projects.

Prerequisites

- May include &m=dev or other query params — only node-id matters - :fileKey — path segment after /design/ - node-id value — the specific component or frame to implement

  • OR when using figma-desktop MCP: select a node directly in the Figma desktop app (no URL required)
  • Xcode project with an established SwiftUI codebase (preferred)
  • Optional .txt / .md / ticket / brief describing scope, behavior, actions, and states

MCP Connection

If any MCP call fails because Figma MCP is not connected, pause and ask the user to configure it. See references/figma-mcp-setup.md for troubleshooting.


Workflow

Follow these steps in order. Do not skip steps.

Two modes: If the user wants to build a new screen from scratch, follow all steps sequentially. If the user wants to adapt/update an existing screen to match a Figma design, follow Steps 1–5, then do Step 5b (Adaptation Audit) before Step 6. Step 5b ensures every difference between the existing code and the design is identified and addressed — this is where most mistakes happen during adaptation.

Step 0 — Read Source Document (if provided)

If the user provides a .txt, .md, ticket, PM brief, or inline spec together with Figma work, read it before any Figma MCP call. Extract the feature goal, expected screens, entry point, actions, async work, required states, constraints, out-of-scope items, and unclear points. See references/source-document.md.

Use the extracted contract to narrow the Figma work. If the document and Figma disagree on screen count, scope, or primary action mapping, ask before fetching or implementing the wrong node.

Step 1 — Parse the Figma URL

Extract fileKey and nodeId from the URL.

Accepted URL patterns (with or without www.):

  • figma.com/design/:fileKey/:fileName?node-id=...
  • figma.com/file/:fileKey/:fileName?node-id=... (legacy, same behavior)

Parsing rules:

  • fileKey: first path segment after /design/ or /file/
  • nodeId: value of node-id query parameter. Always replace "-" with ":" (URLs use "3166-70147", MCP expects "3166:70147")
  • Ignore all other query parameters (m=dev, t=..., page-id=..., etc.)
  • Reject /proto/ and /board/ URLs — they are prototypes and FigJam boards, not implementable designs. Ask the user for a /design/ link instead.

When using figma-desktop MCP without a URL, tools automatically use the currently selected node. Only nodeId is needed; fileKey is inferred.

Step 1b — Screen Discovery (metadata-first when needed)

Before calling get_design_context, decide whether the node is clearly one implementable screen/component. If the URL points to a root node, page node, large container, flow, multi-screen frame, or a source document names more screens than the URL obviously contains, run get_metadata first.

Build a candidate screen map with confidence and continue only when the target node is clear. If multiple candidates would materially change the implementation, ask the user before fetching design context. See references/screen-discovery.md and references/fetch-strategy.md.

Step 2 — Fetch Design Context

get_design_context(fileKey=":fileKey", nodeId="1-2", prompt="generate for iOS using SwiftUI")

The prompt parameter steers the default code output toward SwiftUI. You can also pass project-specific hints: "use components from Components/", "generate using my design system tokens".

Returns structured design data: layout, typography, colors, spacing, and a code representation. Even with an iOS prompt, treat the output as a design specification, not code to port.

For large/complex designs: If the response is truncated or times out, do not retry the same node. Run get_metadata, identify smaller sections and child IDs, then fetch each section individually. See references/fetch-strategy.md.

For multi-device designs: If Figma contains frames for different screen sizes (iPhone + iPad), fetch all device-specific frames, not just one. See references/responsive-layout.md for merging them into adaptive SwiftUI views.

Step 3 — Capture Screenshot

get_screenshot(fileKey=":fileKey", nodeId="1-2")

This screenshot is the source of truth for visual validation throughout implementation.

Step 4 — Fetch Design Tokens (if available)

get_variable_defs(fileKey=":fileKey", nodeId="1-2")

Returns colors, spacing, typography tokens. Map to the project's SwiftUI design system. See references/design-token-mapping.md.

Step 5 — Build Asset Inventory and Download Assets

Before writing SwiftUI, build a visual asset inventory from the screenshot and design context. See references/asset-handling.md for the full decision flow.

  1. Open the screenshot from Step 3 and list every visible non-text element: icons, logos, photos, illustrations, decorative artwork, and image fills
  2. Cross-check each row against get_design_context and get_metadata to find localhost URLs, image fills, vector nodes, and node IDs
  3. Classify each row as download, code, or remote
  4. Download Figma-owned assets during the active MCP session:

- Use get_screenshot(fileKey, nodeId) by default for icons, logos, illustrations, and artwork nodes - Use localhost URLs from get_design_context only when they validate as PNG

  1. Validate downloaded files with file <asset>: visible Figma assets must be real PNG files, then add them to Asset Catalog with @1x/@2x/@3x variants and the correct rendering mode

Asset rules:

  • Figma assets first: do NOT replace Figma icons, logos, or illustrations with SF Symbols or hand-drawn SwiftUI shapes
  • Visible Figma-owned assets should be exported as Figma-rendered PNG by default; SVG/text/XML responses are failed exports, not final assets
  • SF Symbols are allowed only for iOS system chrome or when the user explicitly approves substitution
  • Do NOT create placeholder images or fake logos with Text, Rectangle, Circle, or custom Shape
  • If a visible asset has no download URL and no identifiable node ID, stop and ask the user instead of improvising
  • Do NOT import new icon packages unless the project already uses them
  • Remote content images (avatars, feeds, CDN photos) should use the project's existing image loading path, not bundled assets

Step 5b — Adaptation Audit (when modifying an existing screen)

When the user asks to adapt/update an existing screen to match a Figma design, perform a full element-by-element audit before writing any code. See references/adaptation-workflow.md for the complete process.

Key steps:

  1. Read the existing code and all its subcomponents
  2. Build a categorized diff checklist (ADD / UPDATE / REMOVE) with exact old → new values
  3. Pay special attention to spacing — it's the most commonly missed difference
  4. Present the checklist to the user and clarify unknowns before implementing
  5. Apply all changes — do not skip items that seem minor

Step 6 — Implement in SwiftUI

Before writing any code:

  1. Run get_code_connect_map(fileKey, nodeId) to check if Figma components in the design already have mapped code components. If a mapping exists — use that code directly instead of building from scratch.
  2. Inspect the project's dependencies (Package.swift, Podfile,.xcodeproj) and existing codebase for UI-related libraries and patterns. The project may use third-party solutions for things you would otherwise implement with native SwiftUI. Examples:
  • Image loading: Kingfisher, SDWebImage, Nuke instead of AsyncImage
  • Animations: Lottie instead of SwiftUI animations
  • UI components: custom design system, SnapKit for layout, etc.
  • Networking + image caching: Alamofire, custom image cache
  • Charts: Charts library instead of Swift Charts

Use whatever the project already uses. Do not introduce native SwiftUI alternatives if the project has an established library for that purpose. If the design requires something the project has no dependency for, ask the user before choosing an approach.

Critical rule: MCP output (React + Tailwind) is a representation of design intent. Do NOT port React to SwiftUI. Read design properties and build native SwiftUI views from scratch.

Read references/visual-fidelity.md before implementing non-trivial screens. Use it for exact value extraction, source-of-truth priority, visual inventory, SwiftUI default pitfalls, and screenshot cross-check.

Asset self-check before coding:

  • Every Image(...) must reference a downloaded Figma asset, a remote image loaded through the project image pipeline, or an explicitly allowed system symbol
  • Every Figma icon/logo/illustration in the visual inventory must have a corresponding Asset Catalog entry or approved remote source
  • Image(systemName:) is not allowed for Figma-designed assets unless the user approved that substitution
  • Text("G"), colored shapes, custom Shape, or approximate vector drawings must not stand in for logos, app icons, social icons, or illustrated assets

Do NOT implement system-provided elements that appear in Figma mockups. Designers often include them for context, but they are rendered by iOS automatically. Skip these:

  • Keyboard (system keyboard, emoji picker)
  • Status bar (time, battery, signal)
  • Home indicator bar
  • Navigation bar back button (provided by NavigationStack)
  • Tab bar if using native TabView (only implement custom tab bars)
  • System alerts and action sheets (use.alert() /.confirmationDialog())
  • Share sheet (use ShareLink or UIActivityViewController)
  • System search bar (use.searchable())
  • Pull-to-refresh indicator (use.refreshable())
  • Page indicator dots for native TabView with.page style

If unsure whether an element is system-provided or custom, ask the user.

6.1 — Layout Translation

See references/layout-translation.md for the complete mapping. Key rules:

Figma Auto Layout (vertical) -> VStack(spacing:) with matching alignment Figma Auto Layout (horizontal) -> HStack(spacing:) with matching alignment Figma Auto Layout with wrap -> LazyVGrid or custom FlowLayout Figma Frame with absolute children -> ZStack +.offset() (avoid when possible) Figma padding ->.padding(.horizontal, 16) edge-specific Figma gap -> spacing parameter in stack initializer Figma fill container ->.frame(maxWidth:.infinity) Figma hug contents -> No frame modifier (intrinsic sizing, SwiftUI default) Figma fixed size ->.frame(width:, height:) Figma aspect ratio ->.aspectRatio(ratio, contentMode:) Figma scroll -> ScrollView(.vertical) or.horizontal Figma constraints (pin to edges) ->.frame() + alignment in parent Figma frame sized for specific device -> Check if project supports multiple devices, adapt with size classes. See references/responsive-layout.md

6.2 — Typography Translation

Figma font family -> Closest iOS system font or project custom font Figma font weight -> Font.Weight (.regular,.medium,.semibold,.bold) Figma font size ->.font(.system(size:, weight:, design:)) or custom Font extension Figma line height ->.lineSpacing(lineHeight - fontSize) Figma letter spacing ->.tracking() (Figma px = SwiftUI points, 1:1 on iOS)

If the project has a typography system (Typography.headline), prefer project tokens over raw values.

6.3 — Color Translation

Figma hex color -> Color from Asset Catalog or Color(hex:) extension Figma color + opacity ->.opacity() modifier or color with alpha Figma linear gradient -> LinearGradient(colors:, startPoint:, endPoint:) Figma radial gradient -> RadialGradient(colors:, center:, startRadius:, endRadius:) Figma color variables -> Map to project tokens (Color.primaryText, Color.surface) Figma dark mode variants -> Adaptive colors in Asset Catalog or @Environment(.colorScheme)

When conflicts arise between project tokens and Figma specs, prefer project tokens but adjust minimally to match visuals.

6.4 — Component Translation

Figma component instance -> Check for existing view in project. Reuse over creating new. Figma button -> Button + project.buttonStyle() Figma text input -> TextField or TextEditor Figma toggle -> Toggle with custom style if design differs from system Figma image -> Image from Asset Catalog for local. For remote URLs, use the project's image loading library; if none exists, ask the user. Figma list/collection -> List or LazyVStack / LazyVGrid Figma tab bar -> TabView or custom tab bar if non-standard Figma navigation bar ->.navigationTitle() +.toolbar {} or custom header Figma sheet/modal ->.sheet() /.fullScreenCover() — sheet manages own dismiss Figma card -> Custom view +.background() +.clipShape(.rect(cornerRadius:)) +.shadow() Figma component with variants -> Check variant properties, summarize detected variants, ask user which style approach to use, then implement. See references/component-variants.md for translating Figma variant properties (state, size, style, content toggles) into SwiftUI. Always ask the user which implementation approach they prefer before writing variant code.

6.5 — Effects and Decorations

Figma drop shadow ->.shadow(color:, radius:, x:, y:) Figma inner shadow ->.overlay() with shadow or custom shape stroke Figma blur (layer) ->.blur(radius:) Figma blur (background) ->.background(.ultraThinMaterial) or.regularMaterial Figma corner radius ->.clipShape(.rect(cornerRadius:)) Figma individual corners -> UnevenRoundedRectangle(topLeadingRadius:,...) Figma border/stroke ->.overlay(RoundedRectangle(...).stroke(...)) Figma clip content ->.clipped() or.clipShape() Figma mask ->.mask {...} Figma blend mode ->.blendMode() Figma Liquid Glass (iOS 26+) ->.glassEffect() with appropriate shape

6.6 — Animations and Transitions

Figma prototype connections define transitions between frames. Interpret them as navigation or state-change animations — not as literal animation specs.

Figma dissolve ->.opacity() + withAnimation(.easeInOut) Figma move in / slide in ->.transition(.move(edge:)) or.offset() Figma push -> NavigationStack push (system transition) Figma smart animate -> withAnimation {} on state change, match property diffs (position, size, opacity) Figma scroll animate -> ScrollView with.scrollTransition() or.animation() on offset

Common SwiftUI patterns:

  • State-driven: withAnimation(.spring) {showDetail = true} + .transition(.move(edge:.trailing))
  • Matched geometry: matchedGeometryEffect(id:in:) for shared element transitions between views
  • Implicit: .animation(.default, value: someState) on the animating view

Rules:

  • Check project dependencies for Lottie or other animation libraries — use them if present
  • Do not over-animate. If Figma shows a transition only between screens (prototype link), implement it as navigation, not a custom animation
  • If the design includes complex choreographed animations (multiple elements, sequenced timing), ask the user whether to implement fully or simplify
  • Figma prototype delays and durations are hints, not exact specs — use standard iOS timing (.default,.spring) unless the user specifies otherwise

Step 7 — Validate (on user request only)

Do NOT auto-validate. Before starting implementation (after Step 5), ask the user how they want to validate the result. Examples:

  • Compare screenshot side-by-side in Xcode preview
  • Run on simulator and compare manually
  • Use snapshot testing
  • No validation needed, trust the implementation

Proceed with whichever method the user chooses. If the user does not specify, skip validation entirely.

Reference checklist (share with user if they ask what to check):

  • Layout: spacing, alignment, sizing
  • Typography: font, size, weight, line height
  • Colors: fills, strokes, backgrounds, text
  • Assets: all icons/images present, no placeholders
  • Interactive states: press, focus, disabled
  • Dark mode (if Figma provides variants)
  • Dynamic Type: text scales appropriately
  • Safe areas: no content behind notch / home indicator
  • Scroll behavior correct if design implies scrollable content

For deeper visual QA, use references/visual-fidelity.md as the checklist.

If deviating from Figma (accessibility, platform conventions, technical constraints), document why in comments.

Step 8 — Register Code Connect Mappings

After creating reusable SwiftUI components that correspond to Figma components, register them:

add_code_connect_map(fileKey, nodeId, componentPath, componentName)

This links the Figma component to your code so future designs using the same component will reference the existing implementation instead of generating new code.

Only register components that are:

  • Reusable (used in multiple places or likely to be reused)
  • Stable (not a one-off screen-specific view)

Handling Complex Designs

  1. get_metadata to get the node tree
  2. Identify major sections and child node IDs
  3. Implement top-down: container first, then sections
  4. get_design_context + get_screenshot per section
  5. If user requested validation, validate per section, then full composition

MCP Tools Reference

get_design_context: Design data + default code + asset download URLs. Use always, primary source. get_metadata: Sparse node tree. Use for large designs, structure first. get_screenshot: Visual reference PNG. Use always, validation truth. get_variable_defs: Design tokens. Use when project has design system tokens. get_code_connect_map: Existing code mappings. Use before creating components. add_code_connect_map: Register new mappings. Use after creating reusable components.

Key Principles

  1. Never implement from assumptions. Always fetch context + screenshot first.
  2. MCP output is a spec, not code. Read properties, build native SwiftUI.
  3. Use what the project uses. Check dependencies and existing patterns before implementing anything. Do not introduce native alternatives if the project already has a library for that purpose.
  4. Project tokens win. Prefer project tokens, adjust minimally for visual match.
  5. Validate only when asked. Ask the user how they want to validate before implementing.
  6. Figma assets first. Use SF Symbols only for iOS system chrome or user-approved substitutions; never replace Figma-designed icons, logos, or illustrations by default.
  7. Platform conventions matter. iOS navigation, safe areas, Dynamic Type, accessibility are more important than pixel-perfect Figma replication.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.15%
按下载量换算242

Claude

27.79%
按下载量换算197

Cursor

19.31%
按下载量换算137

Gemini CLI

10.35%
按下载量换算73

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

external-service

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills