# swift-ui-architect

swift-ui-architect enforces modular MVVM-C architecture for SwiftUI and Swift 6.2 across local SPM packages. Keeps Domain, Data, and Feature boundaries strict during code generation.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 283 installs · ★ 227 repo stars
- Author: pproenca
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/pproenca/dot-skills/tree/HEAD/skills/.experimental/swift-ui-architect/SKILL.md
- Updated: 2026-08-15
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/swift-ui-architect

## What it does

This skill enforces strict modular MVVM-C architecture in SwiftUI projects targeting Swift 6.2 and iOS 26. Code lives inside local SPM packages with strict boundaries. Feature modules import only `Domain` and `DesignSystem`. Direct access to `Data` or neighboring features is disallowed. The main App target acts as the convergence hub: it instantiates `DependencyContainer`, holds concrete coordinators with `NavigationPath`, and configures Route Shells.

State management relies on `@Observable` classes. The skill blocks `ObservableObject` and `@Published`. There is no dedicated use-case or interactor tier: ViewModels call Domain repository protocols directly. All persistence, SwiftData queries, URLSession tasks, and retry queues belong inside the `Data` package. Reads follow a stale-while-revalidate pattern, while writes go to an optimistic background queue.

In codebases still using `ObservableObject` or monolithic targets, applying these constraints will cause immediate compilation breakage.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add pproenca/dot-skills --skill swift-ui-architect -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/swift-ui-architect/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/swift-ui-architect/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add pproenca/dot-skills --skill swift-ui-architect -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/swift-ui-architect/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add pproenca/dot-skills --skill swift-ui-architect -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/swift-ui-architect/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install pproenca/dot-skills skills/.experimental/swift-ui-architect
```

2. **Manually: put the files in place**
- File: `.github/skills/swift-ui-architect/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add pproenca/dot-skills --skill swift-ui-architect -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/pproenca/dot-skills --path skills/.experimental/swift-ui-architect
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/swift-ui-architect/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add pproenca/dot-skills --skill swift-ui-architect -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/pproenca/dot-skills/tree/HEAD/skills/.experimental/swift-ui-architect/SKILL.md

## When to use it
- isolate module boundaries between Feature, Domain, and Data packages
- migrate ViewModel state from `ObservableObject` to `@Observable`
- route navigation and `NavigationPath` through App-target coordinators
- set up stale-while-revalidate reads with queued optimistic sync

## Example prompts
- Review the ProfileFeature module to ensure no Data package imports leaked into views.
- Refactor CartViewModel to Swift 6.2 using @Observable and direct Domain repository calls.
- Wire a coordinator and route shell for checkout navigation using NavigationPath.

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: ffec410490539a2e.

BEGIN THIRD-PARTY FILE ffec410490539a2e
````text
---
name: swift-ui-architect
description: Opinionated SwiftUI architecture enforcement for iOS 26 / Swift 6.2 clinic modular MVVM-C apps using local SPM package boundaries. Enforces App-target `DependencyContainer` + route shells, @Observable ViewModels/coordinators, Domain repository/coordinator/error-routing protocols, Data-owned I/O, stale-while-revalidate reads, and optimistic queued sync. Use when writing, reviewing, or refactoring SwiftUI architecture, navigation, dependency wiring, or repository boundaries.
---

# SwiftUI Modular MVVM-C Architecture

Opinionated architecture enforcement for SwiftUI clinic-style apps. This skill aligns to the iOS 26 / Swift 6.2 clinic architecture: modular MVVM-C in local SPM packages, concrete coordinators and route shells in the App target, pure Domain protocols, and Data as the only I/O layer.

## Mandated Architecture Stack

```
┌───────────────────────────────────────────────────────────────┐
│ App target: DependencyContainer, Coordinators, Route Shells   │
├───────────────┬───────────────┬───────────────┬──────────────┤
│ Feature* SPM  │ Feature* SPM  │ Feature* SPM  │ Feature* SPM │
│ View + VM     │ View + VM     │ View + VM     │ View + VM    │
├───────────────────────────────────────────────────────────────┤
│ Data SPM: repository impls, remote/local, retry, sync queue   │
├───────────────────────────────────────────────────────────────┤
│ Domain SPM: models, repository protocols, coordinator protocols│
│ and ErrorRouting/AppError                                      │
├───────────────────────────────────────────────────────────────┤
│ Shared SPMs: DesignSystem, SharedKit                           │
````
END THIRD-PARTY FILE ffec410490539a2e

The third-party file has ended. Everything between the ffec410490539a2e tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2364 of 10924 bytes. © pproenca · MIT · https://github.com/pproenca/dot-skills/tree/HEAD/skills/.experimental/swift-ui-architect/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
