layout

layout is a skill for Claude Code from rshankras/claude-code-apple-skills. It costs 78 tokens per session (1,716 once invoked), scanned A, original, MIT.

A guide to building advanced layouts and scrolling containers in SwiftUI, Apple's user-interface framework for Swift apps. It covers custom layouts, grids, reusable containers, and lazy scrolling, which loads list content as needed.

In plain words
What is it for?
Use it when creating custom SwiftUI containers, equal-width controls, grids, carousels, paging, programmatic scrolling, or long scrolling lists.
Why use it?
It helps avoid common layout, sizing, scrolling, and performance problems when basic stacks are not enough.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: positional $N argument.

Part of the apple-skills plugin — 182 skills shipped together , and of apple-skills

Good fit Use it when creating custom SwiftUI containers, equal-width controls, grids, carousels, paging, programmatic scrolling, or long scrolling lists.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/rshankras/claude-code-apple-skills/layout
Install

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.

Any agent
npx skills add rshankras/claude-code-apple-skills --skill layout
Clone the repo
git clone --depth 1 https://github.com/rshankras/claude-code-apple-skills

Made for: Claude Code.

Or install apple-skills, the plugin that ships this one along with the rest of its 182 skills.

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 layout

README.md
[![agentmods](https://agentmods.dev/badge/skills/rshankras/claude-code-apple-skills/layout/github.svg)](https://agentmods.dev/skills/rshankras/claude-code-apple-skills/layout)
Your own site
<a href="https://agentmods.dev/skills/rshankras/claude-code-apple-skills/layout"><img src="https://agentmods.dev/badge/skills/rshankras/claude-code-apple-skills/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 layout

Your own site · 80×15
<a href="https://agentmods.dev/skills/rshankras/claude-code-apple-skills/layout"><img src="https://agentmods.dev/badge/skills/rshankras/claude-code-apple-skills/layout.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 78 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,716 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.00078 $0.01716
Opus 5.5 $0.00031 $0.00686
Sonnet 5.5 $0.00016 $0.00343
Haiku 4.5 $0.00008 $0.00172

Measured 2d ago against content hash b25bce8fc57b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

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 2d 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.

skills/swiftui/layout/SKILL.md · 118 lines

How it starts

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

SwiftUI Layout & Containers

The layer between "stacks and spacers" and "it scrolls like butter with 100k rows" — Apple's Layout protocol, container composition, and the lazy-stack rules from the WWDC26 deep dive. View identity/data-flow questions route to swiftui/data-flow.

When This Skill Activates

  • "Make these buttons equal width" / measurement-dependent layout
  • Building a reusable container (custom List/board/carousel) that should accept ForEach + sections
  • Lazy stack jank, memory growth, scroll-position bugs, broken scroll targeting
  • Programmatic scrolling, paging/snapping, scroll-linked effects
  • GeometryReader causing layout loops or mangled sizing

Custom Layout protocol (not GeometryReader)

Reach for a custom Layout whenever you must measure subviews and feed the measurement back into layout — GeometryReader only measures its container and can't influence the engine. Canonical case: equal-width buttons.

  • sizeThatFits: propose .unspecified to read each subview's ideal size (subviews.map { $0.sizeThatFits(.unspecified) }); guard empty subviews; replacingUnspecifiedDimensions() for nil proposal dimensions.
  • placeSubviews: never assume origin (0,0) — use bounds.minX/midX (non-zero origins are what make layouts composable); place(at:anchor:proposal:) with a proposal that may differ from the ideal size (that's how equal widths happen).
  • Respect spacing preferences: subviews[i].spacing.distance(to:along:), taking the larger of conflicting preferences — matching built-in containers. No hardcoded 8s.
  • Per-subview data via LayoutValueKey (+ a layoutValue convenience modifier), read as subview[Key.self].
  • Cache only after Instruments shows layout cost — it's an optimization, not a requirement.
  • Switch layouts without killing identity: AnyLayout(HStackLayout()) ↔ custom layout with .animation(_:value:) — SwiftUI sees one changing view, so state survives and it animates.
  • Don't build fallbacks into the layout — wrap alternatives in ViewThatFits.

Read the full file on GitHub · 118 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. 2d ago First seen · 118 lines · 78 tokens per session scan A b25bce8fc57b

Subscribe to this mod's changes

layout is a skill published in the GitHub repository rshankras/claude-code-apple-skills (864 stars, last pushed 2d ago), licensed MIT. It adds 78 tokens to every session and 1,716 once invoked, about $0.0003 per session on Opus 5.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-11-05.

Related

layout compared with skills from other repositories

layout next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
layoutrshankras/claude-code-apple-skillsSkill8642d agoMITA78Claude Code
swift-expertpersonamanagmentlayer/pclSkill4411d agoApache-2.0A76Claude Code
ios-expertpersonamanagmentlayer/pclSkill4411d agoApache-2.0A64Claude Code
ios-swiftui-productJasonColapietro/ios-app-dev-skillsSkill92mo agoMITA67Codex
swiftui-maxDev869/swift-tothemaxSkill74mo agoMITA271Claude Code
apple-dev-conductorDev869/swift-tothemaxSkill74mo agoMITA156Claude Code
kotlin-patternssoftspark/ai-toolkitSkill17910d agoApache-2.0A51Claude Code