Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add mythkiven/figma-ios-codegen --skill figma-ios-hierarchy-preservationgit clone --depth 1 https://github.com/mythkiven/figma-ios-codegenWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/mythkiven/figma-ios-codegen/figma-ios-hierarchy-preservation)<a href="https://agentmods.dev/skills/mythkiven/figma-ios-codegen/figma-ios-hierarchy-preservation"><img src="https://agentmods.dev/badge/skills/mythkiven/figma-ios-codegen/figma-ios-hierarchy-preservation/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/mythkiven/figma-ios-codegen/figma-ios-hierarchy-preservation"><img src="https://agentmods.dev/badge/skills/mythkiven/figma-ios-codegen/figma-ios-hierarchy-preservation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00103 | $0.08032 |
| Opus 5 | $0.00051 | $0.04016 |
| Sonnet 5 | $0.00021 | $0.01606 |
| Haiku 4.5 | $0.00010 | $0.00803 |
Grade A, and why
figma-ios-hierarchy-preservation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 891 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Figma 层级结构保持规则
职责边界(与 figma-ios-snapkit-layout 的分工)
- 本 Skill 负责:Figma 节点 → UIView 层级映射(建哪些容器、addSubview 顺序、坐标系转换)
- 不负责:约束写法语法(SnapKit
make.*写法)→ 见 figma-ios-snapkit-layout
两者协作:本 Skill 确定"建什么容器、父子关系",snapkit-layout 确定"如何写约束值"。
⚡ QUICK_REF(Agent 优先读此处)
核心规则:每个 Figma <frame> / <group> 必须对应一个 UIView,不得拍平。
| Figma 节点类型 | iOS 对应 | 说明 |
|---|---|---|
<frame> |
UIView 容器 |
保持层级,设置 clipsToBounds 按 clipsContent |
<group> |
UIView 容器 |
通常透明,仅作分组 |
<rectangle> |
UIView 或 UIImageView |
看填充类型 |
<text> |
UILabel |
直接 |
<instance> (iconfont) |
UILabel |
见 figma-ios-iconfont-mapping |
坐标转换核心规则:
- 数据包
design.json[node].frame.relative.{x,y}是相对直接父容器的坐标,直接用作 SnapKitoffset - 如需绝对坐标,读
frame.absolute.{x,y}(已由数据包预计算) - 禁止跨层累加坐标(会双重计算)
Figma: <frame id="A" x="16" y="100">
<frame id="B" x="0" y="0">
<rect id="C" x="45" y="10" />
Swift:
A.snp: leading=16, top=100 ← 用 A 自己的 x/y
B.snp: leading=0, top=0 ← 用 B 自己的 x/y(相对A)
C.snp: leading=45, top=10 ← 用 C 自己的 x/y(相对B)
详细规则、坐标转换公式、addSubview 顺序规范见下文。
目标
确保生成的 Swift/UIKit 代码完整保留 Figma 的层级结构,避免将嵌套的容器"拍平"成扁平结构。
核心原则
✅ 原则 1:每个 Frame/Group 都对应一个 UIView 容器
Figma 中的每个 <frame> 或 <group> 节点,在代码中都应该有对应的 UIView 容器。
Figma:
<frame id="1:305" name="编组">
<frame id="1:309" name="编组 6">
<rectangle id="1:310" name="图片A" />
<rectangle id="1:325" name="图片B" />
</frame>
</frame>
Swift:
// ✅ 正确:保持层级
private lazy var groupContainer: UIView = { ... }()
private lazy var group6Container: UIView = { ... }()
private lazy var imageA: UIImageView = { ... }()
private lazy var imageB: UIImageView = { ... }()
// setupUI
groupContainer.addSubview(group6Container)
group6Container.addSubview(imageA)
group6Container.addSubview(imageB)
// ❌ 错误:拍平层级
private lazy var groupContainer: UIView = { ... }()
private lazy var imageA: UIImageView = { ... }()
private lazy var imageB: UIImageView = { ... }()
// setupUI
groupContainer.addSubview(imageA) // 缺少中间容器
groupContainer.addSubview(imageB)
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 11d ago First seen · 891 lines · 103 tokens per session scan A 1e0d4887ce23
figma-ios-hierarchy-preservation is a skill published in the GitHub repository mythkiven/figma-ios-codegen (9 stars, last pushed 2mo ago), licensed MIT. It adds 103 tokens to every session and 8,032 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
figma-codegen
Generate framework-aware code from a Figma design. Reads the project's stack profile and emits code matching the existing framework (React/Vue/Svelte/Next/etc.) and styling (Tailwind/CSS/CSS-in-JS), reusing existing components and design tokens instead of regenerating from scratch. Triggers whenever the user wants a…
figma-build
Build a Figma design from code or a description — the reverse of figma-codegen. Reuses the connected file's existing design system (components, variables, styles) instead of drawing primitives with hardcoded values. Triggers whenever the user wants something created or updated IN Figma from code or a spec — e.g.…
app-icon-studio
Apple app icons: create, generate, evaluate, export, install, or debug iOS AppIcon.appiconset and macOS .icns assets for small-size clarity.
macos-window-architect
Use SwiftUI scene/window modifiers first; switch to macos-appkit-bridge only when SwiftUI cannot express the behavior.
ios-liquid-glass-designer
Implement, refactor, or review iOS 26+ SwiftUI Liquid Glass with native glassEffect, GlassEffectContainer, button styles, availability gates, and non-glass fallbacks.
unship
Compare agent-made alternatives in a local browser preview with Unship. Use for comparison setup, iteration, Canvas, selection, cleanup, and Unship installation or update troubleshooting.