/swift-modern-dev:swift-modern-architecturefrom swift-modern-dev
Guides modern Swift/SwiftUI architecture with @Observable, async/await, NavigationStack, SwiftData, and Swift Testing. Use when designing iOS/macOS apps or modernizing legacy patterns.
Ships in swift-modern-dev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Baseline: Swift 6.3, SwiftUI, Observation, SwiftData, and Swift Testing. Confirm deployment targets against the project requirements.
| ALWAYS | NEVER |
|---|---|
@Observable ViewModels | ObservableObject / @Published / @StateObject |
async/await, actor, @MainActor | DispatchQueue.main for UI work |
NavigationStack / NavigationSplitView | NavigationView |
SwiftData @Model / @Query | Core Data for new code |
| Swift Testing for new tests | XCTest for new tests |
| Strict concurrency | Completion handlers when async exists |
@Observable + @State / @EnvironmentactorNavigationStack + typed destinations@Observable
final class ItemsViewModel {
private let service: ItemsService
private(set) var items: [Item] = []
private(set) var isLoading = false
init(service: ItemsService) {
self.service = service
}
func load() async {
isLoading = true
defer { isLoading = false }
items = (try? await service.fetchItems()) ?? []
}
}
struct ItemsView: View {
@State private var viewModel: ItemsViewModel
var body: some View {
List(viewModel.items) { item in
Text(item.name)
}
.task { await viewModel.load() }
}
}
actor ItemsService {
func fetchItems() async throws -> [Item] {
let (data, _) = try await URLSession.shared.data(from: endpoint)
return try JSONDecoder().decode([Item].self, from: data)
}
}
import Testing
@Test("loads items")
func loadsItems() async {
let vm = ItemsViewModel(service: MockItemsService())
await vm.load()
#expect(!vm.items.isEmpty)
}
| When | Read |
|---|---|
| Full anti-pattern catalog | references/anti-patterns.md or skill swift-anti-pattern-guard |
| New app bootstrap | swift-app-scaffold |
| Test boilerplate | swift-test-scaffold |
| Reusable cross-target code | Extract a focused package or module |
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub pstuart/pstuart --plugin swift-modern-dev7 skills in this plugin
/ios-accessibilityUse when implementing or auditing VoiceOver, Dynamic Type, accessibility labels, focus, contrast, or Hit-testing for SwiftUI iOS/macOS apps./memory-leak-diagnosisUse when investigating memory growth, retain cycles, leaks in Instruments, Task cancellation issues, or ARC problems in Swift 6 apps./swift-anti-pattern-guardUse when reviewing Swift code for outdated patterns, modernizing a project, running architecture health checks, or grepping for ObservableObject, DispatchQueue.main, NavigationView, or Core Data./swift-app-scaffoldUse when starting a new iOS or macOS app, bootstrapping Package.swift, or scaffolding a modern SwiftUI architecture with Observation, SwiftData, NavigationStack, and Swift Testing./swift-performance-optimizationUse when profiling slow SwiftUI screens, optimizing lists, reducing main-thread work, improving memory/CPU, or using Instruments Time Profiler or Swift Concurrency tools./swift-test-scaffoldUse when adding Swift tests, creating test targets, scaffolding ViewModel or service tests, or choosing Swift Testing over XCTest.Other plugins' skills for the same job