Agent Skills › iamcheyan/oc › figma-swiftui

figma-swiftui

GitHub

实现 Figma 设计与 SwiftUI 代码的双向转换。支持将设计稿转为 iOS 代码,或将 SwiftUI 视图同步回 Figma。通过解析 URL 和文件上下文,利用专用工具获取设计上下文并遵循 iOS 规范进行映射。

packages/plugins/figma/skills/figma-swiftui/SKILL.md iamcheyan/oc

触发场景

用户提及 Swift、SwiftUI、iOS、iPhone 或 iPad 要求将 Figma 设计转换为 SwiftUI 代码 要求将 SwiftUI 视图推送到 Figma 出现 Figma URL 且伴随 .swift 文件或 .xcodeproj

安装

npx skills add iamcheyan/oc --skill figma-swiftui -g -y
更多选项

非标准路径

npx skills add https://github.com/iamcheyan/oc/tree/main/packages/plugins/figma/skills/figma-swiftui -g -y

不安装直接使用

npx skills use iamcheyan/oc@figma-swiftui

指定 Agent (Claude Code)

npx skills add iamcheyan/oc --skill figma-swiftui -a claude-code -g -y

安装 repo 全部 skill

npx skills add iamcheyan/oc --all -g -y

预览 repo 内 skill

npx skills add iamcheyan/oc --list

SKILL.md

Frontmatter
{
    "name": "figma-swiftui",
    "description": "SwiftUI ↔ Figma translation. Use whenever the user mentions Swift, SwiftUI, iOS, iPhone, or iPad — in EITHER direction — translating a Figma design into SwiftUI (design → code), or pushing SwiftUI views \/ screens \/ tokens back into a Figma file (code → design). Triggers on phrases like 'implement this Figma design in SwiftUI', 'build this screen in Swift', 'push this SwiftUI view to Figma', 'mirror my Swift code in a Figma file', or whenever a Figma URL appears alongside `.swift` files \/ an `.xcodeproj`. Routes to a direction-specific reference doc; loads alongside `figma-use` for the code → design path.",
    "disable-model-invocation": false
}

Figma ↔ SwiftUI

Translation between Figma designs and SwiftUI code, both directions. This file is a router — actual guidance lives in the references below.

Pick the direction

Direction Trigger Reference
Design → code User wants SwiftUI in their iOS project from a Figma file/frame references/design-to-code.md
Code → design User wants to push SwiftUI views / screens / tokens into a Figma file references/code-to-design.md

If the request is ambiguous — a Figma URL and .swift files both present, no verb makes it clear — ask the user which direction before loading a reference.

Shared context (applies to both directions)

These points hold regardless of direction; the direction-specific references assume them.

  1. get_design_context is the read tool for Figma. Pass clientLanguages: "swift" and clientFrameworks: "swiftui" so the response is framed as Swift. URL → tool args: figma.com/design/:fileKey/:fileName?node-id=:nodeId → use fileKey, replace - with : in nodeId. For figma.com/design/:fileKey/branch/:branchKey/:fileName, use branchKey as fileKey.
  2. The React+Tailwind in get_design_context output is a structural reference, not a literal source. It approximates the visual. Never transliterate position: absolute / pixel frames / mix-blend-mode stacks into SwiftUI or into Figma — the screenshot is the source of truth in both directions.
  3. iOS HIG semantic colors are tokens, not hex. var(--backgrounds/primary, …), var(--labels/secondary, …), var(--separators/non-opaque, …) etc. map to Color(.systemBackground), Color.secondary, Color(.separator) in SwiftUI, and to variables in a semantic collection in Figma. Keep the mapping; drop the literal RGBA.
  4. SF Symbols round-trip by name in both directions — never by codepoint. Design → code: get_design_context substitutes Figma's SF Symbol glyph runs back into <SFSymbol>{Image(systemName: "...")}</SFSymbol> wrappers in the response. Use those names verbatim. Code → design: call figma.util.getSfSymbolCharacter(name) inside use_figma to convert a symbol name to the matching character — never look up codepoints by hand.
  5. Recognize the underlying iOS pattern, not the literal node / view name. The same patterns recur in both directions: large title + back chevron + trailing action = NavigationStack chrome; bottom row of icon+label pairs = TabView; repeating same-height rows with leading/trailing chrome = List. Match those system patterns rather than rebuilding them from primitives.
  6. For code → design, use_figma is the API. Always load figma-use before any use_figma call. If the task involves building a full screen, also load figma-generate-design; if it involves building components or a design system, also load figma-generate-library.

References

Doc When to load
references/design-to-code.md Translating a Figma design / frame into SwiftUI
references/code-to-design.md Pushing SwiftUI views / screens / tokens into Figma

版本历史

  • d9b4ce8 当前 2026-10-18 23:23

同 Skill 集合

.opencode/skills/opencode-dev/SKILL.md
.opencode/skills/rtl-aware-development/SKILL.md
.opencode/skills/sample-skill/SKILL.md
packages/opencode-vim/skills/git-master/SKILL.md
packages/opencode-vim/skills/git-workflow/SKILL.md
packages/plugins/figma/skills/figma-code-connect/SKILL.md
packages/plugins/figma/skills/figma-create-new-file/SKILL.md
packages/plugins/figma/skills/figma-generative-plugins/SKILL.md
packages/plugins/figma/skills/figma-implement-motion/SKILL.md
packages/plugins/figma/skills/figma-shaders/SKILL.md
packages/plugins/figma/skills/figma-use-figjam/SKILL.md
packages/plugins/figma/skills/figma-use-motion/SKILL.md
packages/plugins/figma/skills/figma-use-slides/SKILL.md
.opencode/skills/app-e2e-tests/SKILL.md
.opencode/skills/component-tests/SKILL.md
.opencode/skills/effect/SKILL.md
.opencode/skills/tui-tests/SKILL.md
.opencode/skills/unit-tests/SKILL.md
packages/plugins/figma/skills/figma-design-to-code/SKILL.md
packages/plugins/figma/skills/figma-generate-design/SKILL.md
packages/plugins/figma/skills/figma-generate-diagram/SKILL.md
packages/plugins/figma/skills/figma-generate-library/SKILL.md
packages/plugins/figma/skills/figma-use/SKILL.md

元信息

文件数
0
版本
d9b4ce8
Hash
868c4def
收录时间
2026-10-18 23:23

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-10-20 21:56
浙ICP备14020137号-1