figma-to-swiftui
Convert Figma URLs, nodes, selections, or briefs into production SwiftUI for iOS using Figma MCP. Use for Figma-to-SwiftUI implementation, planning, design tokens, and asset export; not for web or React.
What this skill does
# 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 - Figma MCP server must be connected and accessible - User must provide a Figma URL, e.g.: https://www.figma.com/design/:fileKey/:fileName?node-id=3166-70147&m=dev - 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 5. 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: Alamofir
Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.