swiftui-mvvm

swiftui-mvvm is a skill for Claude Code from rusel95/ios-agent-skills. It costs 158 tokens per session (3,823 once invoked), scanned A, original, MIT.

A guide for structuring SwiftUI screen logic with MVVM, a pattern that separates the user interface from its state and application logic.

In plain words
What is it for?
Use it when creating, refactoring, or testing SwiftUI view models, handling screen state, navigation, or data loaded through repositories.
Why use it?
It makes screen behavior easier to test, review, and change safely, especially in larger iOS codebases.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the ios-all plugin — 11 skills shipped together , and of ios-agent-skills

Good fit Use it when creating, refactoring, or testing SwiftUI view models, handling screen state, navigation, or data loaded through repositories.

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

Made for: Claude Code.

Or install ios-all, the plugin that ships this one along with the rest of its 11 skills.

Its marketplace also offers this one on its own, as the plugin swiftui-mvvm — /plugin install swiftui-mvvm after adding the marketplace above.

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-mvvm

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/rusel95/ios-agent-skills/swiftui-mvvm"><img src="https://agentmods.dev/badge/skills/rusel95/ios-agent-skills/swiftui-mvvm.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 158 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,823 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.00158 $0.03823
Opus 5.5 $0.00063 $0.01529
Sonnet 5.5 $0.00032 $0.00765
Haiku 4.5 $0.00016 $0.00382

Measured 3mo ago against content hash 2938efec0189, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

swiftui-mvvm 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 3mo 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-mvvm/SKILL.md · 227 lines

How it starts

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

Approach: Production-First Iterative Refactoring — This skill is built for production enterprise codebases where stability and reviewability matter more than speed. Architecture changes are delivered through iterative refactoring — small, focused PRs (≤200 lines, single concern) tracked in a refactoring/ directory. Critical safety issues ship first; cosmetic improvements come last.

SwiftUI MVVM Architecture (iOS 17+)

Enterprise-grade SwiftUI MVVM architecture skill. Opinionated: prescribes @Observable ViewModels, Router navigation, constructor injection, ViewState enum, and Repository-based networking. Adopts a production-first iterative refactoring approach — every pattern is chosen for testability, reviewability, and safe incremental adoption in large teams. For non-architectural SwiftUI API guidance (animations, modern API replacements, Liquid Glass), use a general SwiftUI skill instead.

Architecture Layers

View Layer         → SwiftUI Views. Declarative UI only. Owns ViewModel via @State.
ViewModel Layer    → @Observable @MainActor final class. Exposes ViewState<T>.
Repository Layer   → Protocol-based data access. Hides data source details.
Service Layer      → URLSession, persistence. Injected via protocol.

Quick Decision Trees

"Should this View have a ViewModel?"

Is there business logic, networking, or complex state?
├── YES → Create @Observable ViewModel
└── NO → Is it a reusable UI component (button, card, cell)?
    ├── YES → Plain struct with data parameters, NO ViewModel
    └── NO → No ViewModel needed unless it simplifies testing

"How should I own this ViewModel?"

Does THIS view create the ViewModel?
├── YES → @State private var viewModel = MyViewModel()
└── NO → Does the view need $ bindings to ViewModel properties?
    ├── YES → @Bindable var viewModel: MyViewModel
    └── NO → let viewModel: MyViewModel (plain property)

"Where do dependencies come from?"

ViewModel always receives dependencies via constructor:
  init(repository: ItemRepositoryProtocol)

How does the View get the dependency to pass?
├── Shared service (used across many screens)
│   └── Register via @Entry in EnvironmentValues
│       View reads @Environment(\.repo), passes to VM init
├── Screen-specific dependency (passed by parent)
│   └── View receives it as init parameter, passes to VM init
└── Outside view hierarchy (background service, deep utility)
    └── @Injected property wrapper (legacy/convenience only)

Read the full file on GitHub · 227 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. 3mo ago First seen · 227 lines · 158 tokens per session scan A 2938efec0189

Subscribe to this mod's changes

swiftui-mvvm is a skill published in the GitHub repository rusel95/ios-agent-skills (14 stars, last pushed 1mo ago), licensed MIT. It adds 158 tokens to every session and 3,823 once invoked, about $0.0006 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-08-31.

Related

swiftui-mvvm compared with skills from other repositories

swiftui-mvvm next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
swiftui-mvvmrusel95/ios-agent-skillsSkill141mo agoMITA158Claude Code
flutterericrisco/rsc-harnessSkill6824d agoMITA91Claude Code, Codex
compose-multiplatformericrisco/rsc-harnessSkill6824d agoMITA80Claude Code, Codex
react-nativeericrisco/rsc-harnessSkill6824d agoMITA90Claude Code, Codex
harmony-arktsMindrally/skillsSkill3221mo agoApache-2.0A86Claude Code
localization-l10nMindrally/skillsSkill3221mo agoApache-2.0A28Claude Code
android-developmentMindrally/skillsSkill3221mo agoApache-2.0A27Claude Code