figma-ios-horizontal-layout

figma-ios-horizontal-layout is a skill for Cursor from mythkiven/figma-ios-codegen. It costs 89 tokens per session (2,380 once invoked), scanned A, original, MIT.

A method for turning a fixed-width Figma iPhone design, based on a 375-point screen, into horizontally adaptive iOS layout code. It chooses between flexible widths, proportional child sizing, list layouts, and fixed positioning based on the design’s margins.

In plain words
What is it for?
Generating the horizontal parts of iOS screens from Figma data using SnapKit, including containers with symmetric margins, nearly full-width containers, and freely positioned layouts.
Why use it?
It removes the need to manually decide how each horizontal container should behave on different iPhone widths. Figma is a design tool, and points are iOS’s layout measurement units.

Skill for Cursor

Written for Cursor: installed under .cursor/.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is 注:垂直方向的布局(导航栏高度、安全区、吸底按钮)由 [figma-ios-vertical-layout-safearea](../figma-ios-vertical-layout-safearea/SKILL.md) 负责。.

Good fit Generating the horizontal parts of iOS screens from Figma data using SnapKit, including containers with symmetric margins, nearly full-width containers, and freely positioned layouts.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/mythkiven/figma-ios-codegen
agentmods
npx agentmods add skills/mythkiven/figma-ios-codegen/figma-ios-horizontal-layout

Made for: Cursor.

Wrote 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.

agentmods badge for figma-ios-horizontal-layout

README.md
[![agentmods](https://agentmods.dev/badge/skills/mythkiven/figma-ios-codegen/figma-ios-horizontal-layout/github.svg)](https://agentmods.dev/skills/mythkiven/figma-ios-codegen/figma-ios-horizontal-layout)
Your own site
<a href="https://agentmods.dev/skills/mythkiven/figma-ios-codegen/figma-ios-horizontal-layout"><img src="https://agentmods.dev/badge/skills/mythkiven/figma-ios-codegen/figma-ios-horizontal-layout/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.

agentmods 80×15 button for figma-ios-horizontal-layout

Your own site · 80×15
<a href="https://agentmods.dev/skills/mythkiven/figma-ios-codegen/figma-ios-horizontal-layout"><img src="https://agentmods.dev/badge/skills/mythkiven/figma-ios-codegen/figma-ios-horizontal-layout.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 89 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,380 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00089 $0.02380
Opus 5 $0.00044 $0.01190
Sonnet 5 $0.00018 $0.00476
Haiku 4.5 $0.00009 $0.00238

Measured 9d ago against content hash 72d1365ad119, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

figma-ios-horizontal-layout 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 9d 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.

.cursor/skills/figma-ios-horizontal-layout/SKILL.md · 279 lines

How it starts

The opening of the file, as written. The whole thing — 279 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Figma 横向布局适配策略

核心原则

默认:从左往右按设计稿绝对位置布局(SnapKit)

特殊:容器左右间隙满足条件时,使用动态宽度 + 子元素比例缩放

注:垂直方向的布局(导航栏高度、安全区、吸底按钮)由 figma-ios-vertical-layout-safearea 负责。


⭐️ 数据包优先:先查 _layout_hint.horizontal_pattern

figma-ios-preload-data 阶段 1 已经把"左右间隙差 ≤ 2 / 接近全宽 / 自由布局"算好写入:

"_layout_hint": {
  "horizontal_pattern": "symmetric" | "near_full_width" | "free",
  "left_inset": 16.0,
  "right_inset": 16.0,
  "child_count": 4
}

判断流程

  1. 容器节点存在 _layout_hint.horizontal_pattern → 直接采用其结果
    • symmetric → 对称布局策略(动态宽度 + 比例缩放)
    • near_full_width → 接近全宽(动态宽度 + 子元素策略选择)
    • free → 端固定布局(默认)
  2. 没有 _layout_hint → fallback 到下面的"步骤 1:判断容器宽度策略"自己算

步骤 1:判断容器宽度策略(仅当 _layout_hint 缺失时)

从 Figma 读取容器数据,计算左右间隙:

# Figma 数据
screen_width = 375  # 设计稿屏幕宽度
container_x = 16    # 容器相对屏幕 x
container_width = 343

# 计算左右间隙
left_margin = container_x  # 16
right_margin = screen_width - container_x - container_width  # 375 - 16 - 343 = 16

判断规则

# 场景 1:对称布局(左右间隙相等,偏差 ≤2pt)
if abs(left_margin - right_margin) <= 2:
    → 容器使用动态宽度
    → 子元素按比例缩放

# 场景 2:接近全宽布局(左右边距都较小)
elif right_margin <= 20 and left_margin <= 80:
    → 容器使用动态宽度
    → 子元素根据类型选择策略(见步骤 2)

# 场景 3:固定宽度布局(默认)
else:
    → 容器使用固定宽度
    → 子元素使用固定位置

步骤 2:判断子元素布局策略

前提:容器已确定为动态宽度(场景 1 或 2)

子元素策略

# 检查 1:是否是滚动容器?
if container.is_scrollable or 'scroll' in container.name.lower():
    → 使用 UICollectionView/UIScrollView
    → 子元素固定尺寸、固定间距
    → 走 [figma-ios-listview-recognition](../figma-ios-listview-recognition/SKILL.md) 逻辑

# 检查 2:多个横向排列的子元素(非滚动)
elif len(horizontal_children) >= 1:
    → 子元素按比例缩放(位置、宽度、高度都缩放)
    → child_x = figma_x × scale
    → child_width = figma_width × scale
    → child_height = figma_height × scale

# 默认:固定布局(不应该出现)
else:
    → 子元素使用固定位置和尺寸

代码生成规则

场景 1:对称布局(动态宽度 + 比例缩放)

示例:步骤条(左 16pt,右 16pt)

// 计算缩放比例
let screenWidth = /* host.utils.screen_width */
let scale = (screenWidth - 32) / 343.0  // (屏幕宽 - 左右边距) / Figma 容器宽

// 容器:动态宽度
stepIndicatorContainer.snp.makeConstraints { make in
    make.leading.trailing.equalToSuperview().inset(16)
    make.height.equalTo(68)
}

// 子元素:位置和宽度都按比例缩放
// Figma 数据: step1(x=18, width=56), sep1(x=91, width=24), step2(x=131, width=71)

step1View.snp.makeConstraints { make in
    make.leading.equalToSuperview().offset(18 * scale)  // 位置缩放
    make.width.equalTo(56 * scale)  // ✅ 宽度也缩放
    make.centerY.equalToSuperview()
}

stepSeparator1.snp.makeConstraints { make in
    make.leading.equalToSuperview().offset(91 * scale)
    make.width.height.equalTo(24 * scale)  // ✅ 尺寸缩放
    make.centerY.equalToSuperview()
}

step2View.snp.makeConstraints { make in
    make.leading.equalToSuperview().offset(131 * scale)
    make.width.equalTo(71 * scale)  // ✅ 宽度缩放
    make.centerY.equalToSuperview()
}

Read the full file on GitHub · 279 lines

Changes

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.

  1. 9d ago First seen · 279 lines · 89 tokens per session scan A 72d1365ad119

Subscribe to this mod's changes

figma-ios-horizontal-layout is a skill published in the GitHub repository mythkiven/figma-ios-codegen (9 stars, last pushed 1mo ago), licensed MIT. It adds 89 tokens to every session and 2,380 once invoked, about $0.0004 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.

Related

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…

awdr74100/figwright · 145 tokens

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.…

awdr74100/figwright · 180 tokens

app-icon-studio

Apple app icons: create, generate, evaluate, export, install, or debug iOS AppIcon.appiconset and macOS .icns assets for small-size clarity.

Xopoko/build-swift-apps · 40 tokens

macos-window-architect

Use SwiftUI scene/window modifiers first; switch to macos-appkit-bridge only when SwiftUI cannot express the behavior.

Xopoko/build-swift-apps · 46 tokens

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.

Xopoko/build-swift-apps · 47 tokens

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.

mbenhard/unship · 37 tokens