No slash command · from apple-plugin
Guides state and data flow in SwiftUI apps: Observation, ObservableObject, SwiftData, Core Data, and TCA. Helps decide state ownership, write observable models, persist data, and inject testable services.
Ships in apple-plugin. 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.
None: SKILL.md is the whole skill.
| Signal | Pattern | Follow it |
|---|---|---|
@Observable classes, @State var model = …, @Bindable | Observation (iOS 17 / macOS 14 / watchOS 10+) | default for new code |
ObservableObject, @Published, @StateObject | Combine-era observation | keep it in that feature; do not mix both in one model |
import ComposableArchitecture, @Reducer, Store | TCA | new features as reducers, dependencies via @Dependency |
*ViewModel classes per screen | MVVM | one view model per screen, same naming |
Never introduce a second pattern. Migrating a feature from ObservableObject to @Observable is a separate change unless the BA spec asks for it.
@State private var.@State private var model = OrdersModel() with Observation (@StateObject in legacy code). Never @ObservedObject / plain let for something the view creates — it is recreated on every parent render.let / var property (Observation tracks reads automatically); @Bindable var model when the view needs bindings ($model.title)..environment(model), read with @Environment(OrdersModel.self).@Binding.@AppStorage / @SceneStorage (scene restoration). Never tokens or personal data.@MainActor
@Observable
final class OrdersModel {
private(set) var state: LoadState<[Order]> = .idle
var filter: OrderFilter = .open
@ObservationIgnored private let client: any OrdersClient
init(client: any OrdersClient) {
self.client = client
}
func load() async {
state = .loading
do {
state = .loaded(try await client.orders(filter: filter))
} catch is CancellationError {
return
} catch {
state = .failed(error)
}
}
}
@MainActor (implicit when the target uses MainActor default isolation). Do networking and heavy work through async services; assign results on the main actor.isLoading + error + items combinations.private(set) for state the view only reads; expose intent methods (load(), toggleFavorite(_:)) instead of letting views mutate internals.@ObservationIgnored for dependencies and caches that must not trigger updates.@Entry), so tests and previews can substitute them.@Dependency(\.ordersClient) with liveValue / testValue / previewValue.@Model
final class Draft {
var title: String
var createdAt: Date
@Relationship(deleteRule: .cascade) var attachments: [Attachment] = []
init(title: String, createdAt: Date = .now) {
self.title = title
self.createdAt = createdAt
}
}
ModelContainer for the app (.modelContainer(...) on the scene); views read with @Query(sort: \Draft.createdAt, order: .reverse) and filter with #Predicate; writes through @Environment(\.modelContext) or a model actor.@ModelActor actor with its own context — never pass @Model instances across actors; pass PersistentIdentifiers.VersionedSchema and a SchemaMigrationPlan stage when the app has shipped with the old schema; never rename or retype a stored property without one.NSPersistentContainer / stack; UI reads on viewContext, writes in performBackgroundTask or a background context; @FetchRequest / @SectionedFetchRequest in SwiftUI..xcdatamodeld) with lightweight migration where possible; never edit the shipped version in place.AsyncSequences (NotificationCenter.default.notifications(named:), Core Location updates, SwiftData changes) inside .task so they are cancelled with the view, or in the model with a stored Task cancelled in deinit.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
7 skills in this plugin
/apple-testingTesting Apple apps: what to unit-test in a SwiftUI app (observable models, services, mappers, reducers), MainActor-isolated tests, SwiftData and Core Data in memory, protocol doubles for system services, TCA TestStore, XCUITest UI tests (launch arguments, accessibility identifiers, page objects), snapshot tests with swift-snapshot-testing, previews as smoke tests, running tests per platform with xcodebuild and test plans, coverage. Builds on swift-foundation:swift-testing for framework basics.
Use this skill to:
- Test app logic without launching the UI.
- Write UI tests that survive layout changes.
- Run the right scheme and destination for each platform target.
Do NOT use this skill for:
- Swift Testing / XCTest basics — see swift-foundation:swift-testing.
- Server-side Swift tests — see swift-plugin.
/ios-ipadosiPhone and iPad specifics for Apple apps: device families and size classes, adaptive layouts across iPhone, iPad and foldable iPhone screens, iPad multitasking and resizable windows, multiple scenes, pointer, hardware keyboard shortcuts, drag and drop, Apple Pencil, app lifecycle and background work (BGTaskScheduler, background URLSession), push and local notifications, permissions and Info.plist usage descriptions, privacy manifests, WidgetKit / Live Activities / App Intents extensions, Mac Catalyst and "Designed for iPad" on Mac.
Use this skill to:
- Make a screen correct on every iPhone and iPad size the target supports.
- Add a system capability (notifications, background refresh, location, camera) with the right plist keys and permission flow.
- Add or extend a widget, Live Activity or App Intent.
Do NOT use this skill for:
- Mac-native (AppKit / SwiftUI macOS) targets — see apple-plugin:macos-app.
- watchOS targets — see apple-plugin:watchos-app.
/macos-appmacOS app specifics: SwiftUI scenes on the Mac (WindowGroup, Window, DocumentGroup, Settings, MenuBarExtra, UtilityWindow), opening and managing windows, menus and commands (CommandMenu, CommandGroup, keyboard shortcuts, focused values), Mac-idiomatic UI (Table, Inspector, toolbars, sidebar, context menus, hover), document-based apps and file access, App Sandbox and security-scoped bookmarks, hardened runtime and notarization constraints, AppKit interop, login items and menu-bar apps, Mac Catalyst vs native.
Use this skill to:
- Make a feature feel native on the Mac instead of a stretched iPad screen.
- Add windows, menu commands, settings and keyboard shortcuts.
- Read and write user files correctly under the App Sandbox.
Do NOT use this skill for:
- iPad apps running on Mac via Catalyst or "Designed for iPad" — see apple-plugin:ios-ipados.
- Shared SwiftUI view rules — see apple-plugin:swiftui-conventions.
/swiftui-conventionsSwiftUI conventions for Apple apps: app and scene structure, view composition and identity, modifiers and custom ViewModifiers, layout (stacks, Grid, ViewThatFits, Layout), lists and lazy containers, async work with .task, environment values (@Entry), design-system tokens from the asset catalog, Dynamic Type, Dark Mode, accessibility, String Catalog localization, #Preview, UIKit / AppKit interop, performance. Platform specifics live in ios-ipados, macos-app and watchos-app.
Use this skill to:
- Build screens out of small, previewable views that match the rest of the app.
- Keep side effects out of view bodies.
- Make every new screen accessible, localized and theme-aware.
- Bridge to UIKit / AppKit only where SwiftUI cannot do the job.
Do NOT use this skill for:
- Where state lives and how it flows — see apple-plugin:swiftui-state.
- Navigation, deep links, sheets — see apple-plugin:swiftui-navigation.
- Tests and previews as tests — see apple-plugin:apple-testing.
/swiftui-navigationNavigation in SwiftUI apps: NavigationStack with value-based navigationDestination and a programmatic path, NavigationSplitView for iPad and Mac, TabView (including the sidebar-adaptable style), sheets, full-screen covers, popovers, inspectors, alerts and confirmation dialogs, router / coordinator objects, deep links (custom URL schemes, Universal Links), state restoration, UIKit navigation interop.
Use this skill to:
- Add a destination the same way existing ones are added.
- Drive navigation from models (deep links, notifications, post-save redirects).
- Handle incoming URLs safely.
Do NOT use this skill for:
- Platform-specific window and scene management — see apple-plugin:macos-app and apple-plugin:ios-ipados.
- Screen state — see apple-plugin:swiftui-state.
/watchos-appwatchOS app specifics: single-target SwiftUI watch apps (companion or independent), glanceable design for small screens, navigation on the watch, the Digital Crown, complications and Smart Stack widgets with WidgetKit, background refresh and extended runtime sessions, workouts and HealthKit, WatchConnectivity with the iPhone app, networking and data sync constraints, notifications, power and performance limits.
Use this skill to:
- Build a watch screen that is useful in a two-second glance.
- Add or update a complication / Smart Stack widget.
- Share data between the iPhone and the watch correctly.
- Run workout or health features within watchOS limits.
Do NOT use this skill for:
- iPhone / iPad targets — see apple-plugin:ios-ipados.
- Shared SwiftUI view rules — see apple-plugin:swiftui-conventions.
npx claudepluginhub aratkruglik/claude-sdlc --plugin apple-pluginOther plugins' skills for the same job