swiftui-patterns

swiftui-patterns is a skill for Claude Code, Codex from makifbaysal/tasktrooper. It costs 42 tokens per session (1,633 once invoked), scanned A, original, Apache-2.0.

A guide to building native iOS interfaces with SwiftUI, Apple's framework for describing screens in code. It covers small reusable views, observable state models, reusable components, concurrency, and system styling.

In plain words
What is it for?
Use it when building or changing native iOS screens with SwiftUI, especially when managing state, reusable components, asynchronous work, Dynamic Type, or dark mode.
Why use it?
It keeps screen code from owning networking and business rules, and avoids scattered hardcoded colours or spacing. That makes views easier to reuse, preview, and maintain.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when building or changing native iOS screens with SwiftUI, especially when managing state, reusable components, asynchronous work, Dynamic Type, or dark mode.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/makifbaysal/tasktrooper/swiftui-patterns
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 makifbaysal/tasktrooper --skill swiftui-patterns
Clone the repo
git clone --depth 1 https://github.com/makifbaysal/tasktrooper

Made for: Claude Code, Codex.

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 swiftui-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/makifbaysal/tasktrooper/swiftui-patterns/github.svg)](https://agentmods.dev/skills/makifbaysal/tasktrooper/swiftui-patterns)
Your own site
<a href="https://agentmods.dev/skills/makifbaysal/tasktrooper/swiftui-patterns"><img src="https://agentmods.dev/badge/skills/makifbaysal/tasktrooper/swiftui-patterns/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 swiftui-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/makifbaysal/tasktrooper/swiftui-patterns"><img src="https://agentmods.dev/badge/skills/makifbaysal/tasktrooper/swiftui-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,633 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.00042 $0.01633
Opus 5.5 $0.00017 $0.00653
Sonnet 5.5 $0.00008 $0.00327
Haiku 4.5 $0.00004 $0.00163

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

Security

Grade A, and why

swiftui-patterns 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 8d 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.

catalog/agents/mobile-developer/skills/swiftui-patterns/SKILL.md · 113 lines

How it starts

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

SwiftUI Patterns

Overview

Native iOS (SwiftUI) is chosen when a task needs deep Apple-platform integration or the app is already native (see native-vs-flutter-decision). Same discipline as Flutter: small composed views, state out of the view, reusable atomic components.

Core principle: Views are a function of state. Data and business logic live in an observable model, not in the View.

Rules

  • Small views, composed. Extract subviews as their own View types (not @ViewBuilder funcs) so each has its own body and preview.
  • State ownership is explicit: @State for local ephemeral UI only (and it is always private); app/business state in an @MainActor @Observable model injected via init/@Environment. Views send intents to the model; the model owns the logic and the networking.
  • Atomic components: a shared component library (atoms → molecules → organisms) of reusable views. Reuse before building; grep before adding.
  • System styling over hardcoded values: colors from the asset catalog / Color semantic roles, spacing/typography from a tokens file (see mobile-design-system-foundation) — not scattered magic numbers. Support Dynamic Type and dark mode.
  • #Preview every reusable view in its key states (loading/data/error), and in the matrix: Dynamic Type .accessibility3, dark, traits: .landscapeLeft.
  • Value types (struct) for models and view state; reference types only where identity is needed.
  • Never name a domain type Task — it shadows _Concurrency.Task, which every async/.task {} call site needs; a rename (BoardItem, WorkItem, …) is a five-minute fix versus a confusing compile error later.

Concurrency

  • Follow the target's default actor isolation: a new Xcode 26 project defaults to @MainActor isolation, so a view model that touches UI state should be @MainActor @Observable explicitly rather than relying on inference holding across Swift versions.
  • No GCD (DispatchQueue.main.async, etc.) in new code — async/await, Task { }, Task.sleep(for:).
  • Kick off async work from .task { } on the view, not onAppear + a detached Task.

Read the full file on GitHub · 113 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. 8d ago First seen · 113 lines · 42 tokens per session scan A a738babab62e

Subscribe to this mod's changes

swiftui-patterns is a skill published in the GitHub repository makifbaysal/tasktrooper (113 stars, last pushed yesterday), licensed Apache-2.0. It adds 42 tokens to every session and 1,633 once invoked, about $0.0002 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-10-05.

Related

Other skills, from other repositories

architecture-design

Use this skill to design system architecture with documented trade-offs and decisions before any implementation begins. Activates when a feature, system, or component requires non-trivial structural decisions about how components interact, what data stores to use, or how to decompose a problem.

karthikrshet/aiskills · 60 tokens

repository-discovery

Use this skill to systematically explore an unfamiliar codebase before making any changes. Activates when starting work in an unknown repository, adding a new feature, debugging without prior context, or when no CONTEXT.md exists. Produces a grounded understanding of architecture, conventions, and constraints.

karthikrshet/aiskills · 61 tokens

rapid-prototyping

Use this skill to build disposable, rapid proof-of-concept prototypes and spikes to test feasibility, validate API designs, or explore library capabilities before committing to a full production architecture.

karthikrshet/aiskills · 45 tokens

ramp

Fetch and follow Ramp's published agent playbooks inside Paperclip, with mandatory approval gates for spend, incorporation, cards, account setup, and other financial actions.

paperclipai/paperclip · 35 tokens

github-pr-workflow

Prepare a GitHub pull request from a feature branch — branch hygiene, commit shape, title/body, verification notes, screenshots for UI work, and replies to review comments.

paperclipai/paperclip · 39 tokens

paperclip-task-bridge

Create, comment on, update, and list Paperclip tasks from Hermes using scoped Paperclip API credentials.

paperclipai/paperclip · 27 tokens