From swiftui
Use when translating Figma designs, selected Figma nodes, design tokens, or Figma assets into production SwiftUI for an iOS app. Requires an available Figma MCP/tool connection. Do not use for web or React implementation.
How this skill is triggered — by the user, by Claude, or both
Slash command
/swiftui:beepus-maximus-swiftui-figma-to-swiftuiThe summary Claude sees in its skill listing — used to decide when to auto-load this 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.
Translate Figma nodes into production-ready SwiftUI views with pixel-perfect accuracy. Combines MCP integration rules with a structured implementation workflow for iOS projects.
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.
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.
Extract fileKey and nodeId from the URL.
Accepted URL patterns (with or without www.):
Parsing rules:
When using figma-desktop MCP without a URL, tools automatically use the currently selected node. Only nodeId is needed; fileKey is inferred.
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, first run get_metadata to get a node map, identify sections and child IDs, then fetch each section individually.
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.
get_screenshot(fileKey=":fileKey", nodeId="1-2")
This screenshot is the source of truth for visual validation throughout implementation.
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.
The get_design_context response includes download URLs (localhost) for image assets in the design. Download them during the active MCP session — URLs are ephemeral.
get_design_context response (image fills, icons, illustrations)curl -o <filename> "<localhost-url>"get_screenshot(fileKey, nodeId) to export as PNGAsset rules:
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:
Before writing any code:
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.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.
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:
If unsure whether an element is system-provided or custom, ask the user.
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
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.
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.
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.
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
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:
withAnimation(.spring) { showDetail = true } + .transition(.move(edge: .trailing))matchedGeometryEffect(id:in:) for shared element transitions between views.animation(.default, value: someState) on the animating viewRules:
Do NOT auto-validate. Before starting implementation (after Step 5), ask the user how they want to validate the result. Examples:
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):
If deviating from Figma (accessibility, platform conventions, technical constraints), document why in comments.
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:
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.
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub 4eleven7/claude-skills --plugin swiftui