# Swift modern architecture

> Swift modern architecture is an open-source agent skill for developer tools. Guides an agent to write modern Swift and SwiftUI with Observation, SwiftData and async. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/pstuart/pstuart/tree/main/plugins/swift-modern-dev/skills/swift-modern-architecture
- **Repository:** https://github.com/pstuart/pstuart
- **GitHub stars:** 20
- **License:** MIT
- **Skill name:** swift-modern-architecture
- **Collection:** https://github.com/pstuart/pstuart
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-04

## About

This skill steers an AI coding agent toward current Apple-platform conventions when writing Swift or SwiftUI code for iOS and macOS. It sets a baseline of Swift 6.3, Observation, SwiftData and Swift Testing, and asks the agent to confirm deployment targets against project requirements before changing anything.

The skill works mostly as a rulebook. It lists patterns to always use and legacy APIs to avoid, such as ObservableObject and XCTest for new code, then offers a short decision guide for choosing between state, actors, persistence, networking and navigation. Code samples show an observable view model backed by an actor service, plus a Swift Testing example. A checklist at the end lets the agent verify its output before finishing.

It points to a separate anti-pattern reference and two companion skills for app bootstrapping and test scaffolding. The skill itself ships no scripts, and the content does not specify required tools or external services beyond Swift and Apple's frameworks.

## When your agent uses it

> Use when writing Swift or SwiftUI code, designing iOS/macOS architecture, modernizing legacy patterns, or choosing ViewModels, SwiftData, navigation, or concurrency APIs.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/pstuart/pstuart/tree/HEAD/plugins/swift-modern-dev/skills/swift-modern-architecture)
- [License: MIT](https://github.com/pstuart/pstuart/tree/HEAD/plugins/swift-modern-dev/skills/swift-modern-architecture)

## Features

- **Observation-based view models:** Guidance for building state with @Observable classes and @State or @Environment in SwiftUI views.
- **Modern concurrency rules:** Patterns for async/await, actors and main-actor isolation in place of GCD and completion handlers.
- **SwiftData persistence choices:** Direction to use SwiftData models and queries for new code instead of Core Data.
- **Typed navigation guidance:** Advice on NavigationStack and NavigationSplitView with typed destinations.
- **Swift Testing examples:** Sample test code using the Swift Testing framework for new test suites.
- **Architecture decision guide:** A quick decision tree for state, services, persistence, networking and shared packages.
- **Pre-finish checklist:** A review list that checks observation, concurrency, navigation and testing choices before completion.

## Good for

- Refactor an ObservableObject view model to use @Observable
- Design a networking layer using an actor and async calls
- Add SwiftData persistence to a new iOS app
- Replace NavigationView with NavigationStack and typed destinations
- Write Swift Testing unit tests for a view model

## Install

### Claude Code

This skill ships in the `swift-modern-dev` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add pstuart/pstuart
/plugin install swift-modern-dev@pstuart
```

Or copy only this skill to `~/.claude/skills/swift-modern-architecture`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/pstuart/pstuart.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/swift-modern-architecture &&
cp -R "$tmp/plugins/swift-modern-dev/skills/swift-modern-architecture" ~/.claude/skills/swift-modern-architecture &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/swift-modern-architecture` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/swift-modern-architecture` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/pstuart/pstuart.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/swift-modern-architecture &&
cp -R "$tmp/plugins/swift-modern-dev/skills/swift-modern-architecture" ~/.agents/skills/swift-modern-architecture &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/swift-modern-architecture` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/swift-modern-architecture` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/pstuart/pstuart.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/swift-modern-architecture &&
cp -R "$tmp/plugins/swift-modern-dev/skills/swift-modern-architecture" ~/.cursor/skills/swift-modern-architecture &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/swift-modern-architecture` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/pstuart/pstuart.git --path plugins/swift-modern-dev/skills/swift-modern-architecture
```

Or copy the folder to `~/.gemini/skills/swift-modern-architecture` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/swift-modern-architecture`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/pstuart/pstuart.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/swift-modern-architecture &&
cp -R "$tmp/plugins/swift-modern-dev/skills/swift-modern-architecture" ~/.copilot/skills/swift-modern-architecture &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/swift-modern-architecture` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/pstuart/pstuart.git
```

Then copy `pstuart/plugins/swift-modern-dev/skills/swift-modern-architecture` into your agent's skills folder as `swift-modern-architecture`. Agents that support SKILL.md read one folder per skill.

## FAQ

### Which Swift and SwiftUI versions does Swift modern architecture target?

It sets a baseline of Swift 6.3, SwiftUI, Observation, SwiftData and Swift Testing, and tells the agent to confirm deployment targets against project requirements.

### Does Swift modern architecture run any scripts or require extra tools?

The skill has no scripts, and its allowed tools are not set. It is instructions and reference material only.

### What should I do if I need the full list of anti-patterns?

The skill points to a references/anti-patterns.md file, or to the separate swift-anti-pattern-guard skill, for the complete catalog.

### How do I install Swift modern architecture in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/swift-modern-architecture to use it in all your projects, or to .claude/skills/swift-modern-architecture in one project. Or install the swift-modern-dev plugin, which includes it: /plugin marketplace add pstuart/pstuart, then /plugin install swift-modern-dev@pstuart.

### Does Swift modern architecture run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Swift modern architecture?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Swift modern architecture?

The closest alternatives to Swift modern architecture are Swift swiftui, Axiom swift, Axiom modernize, Axiom swiftui and Swift anti pattern guard.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Swift swiftui](https://ai-powered.com/skills/swift-swiftui): Swift swiftui is an open-source agent skill for developer tools.
- [Axiom swift](https://ai-powered.com/skills/axiom-swift-charleswiltgen-2): Axiom swift is an open-source agent skill for developer tools.
- [Axiom modernize](https://ai-powered.com/skills/axiom-modernize): Axiom modernize is an open-source agent skill for developer tools.
- [Axiom swiftui](https://ai-powered.com/skills/axiom-swiftui-charleswiltgen-2): Axiom swiftui is an open-source agent skill for developer tools.
- [Swift anti pattern guard](https://ai-powered.com/skills/swift-anti-pattern-guard): Swift anti pattern guard is an open-source agent skill for developer tools.
- [Build swiftui interface](https://ai-powered.com/skills/build-swiftui-interface): Build swiftui interface is an open-source agent skill for developer tools.
- [Swift app scaffold](https://ai-powered.com/skills/swift-app-scaffold): Swift app scaffold is an open-source agent skill for developer tools.
- [Swift performance optimization](https://ai-powered.com/skills/swift-performance-optimization): Swift performance optimization is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/swift-modern-architecture
