No slash command · from apple-plugin
Guides testing Apple apps: unit-testing SwiftUI models, services, and reducers; MainActor isolation; in-memory SwiftData/Core Data; protocol doubles; TCA TestStore; XCUITest with page objects; snapshot testing; xcodebuild and test plans.
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.
| Layer | Test type | Target |
|---|---|---|
| Observable models / view models / TCA reducers | Unit | app unit-test target or feature package tests |
| Services, API clients, mappers, persistence | Unit (with doubles / in-memory stores) | same |
| Critical user journeys (sign-in, checkout) | XCUITest | UI-test target, only if one exists |
| Visual regressions | Snapshot | only if the project already uses snapshots |
Most coverage comes from model tests — they are fast and run on every platform. Views themselves are not unit-tested; their logic belongs in the model.
import Testing
@testable import Orders
@MainActor
@Suite struct OrdersModelTests {
@Test func loadShowsOrders() async throws {
let client = OrdersClientStub(result: .success([.fixture(id: "1")]))
let model = OrdersModel(client: client)
await model.load()
let orders = try #require(model.state.loadedValue)
#expect(orders.map(\.id) == ["1"])
}
@Test func loadFailureShowsError() async {
let model = OrdersModel(client: OrdersClientStub(result: .failure(URLError(.notConnectedToInternet))))
await model.load()
guard case .failed = model.state else {
Issue.record("expected failed state, got \(model.state)")
return
}
}
}
loadedValue is a small test-target extension on the state enum (if case .loaded(let value) = self { value } else { nil }) — state holding any Error is not Equatable, so match the case instead of comparing whole states.@MainActor on the suite when the model is main-actor isolated (or the target defaults to MainActor isolation).let container = try ModelContainer(for: Draft.self, configurations: ModelConfiguration(isStoredInMemoryOnly: true)), then container.mainContext (or a model actor) — a fresh container per test.NSPersistentContainer with an in-memory store description (url = URL(fileURLWithPath: "/dev/null")).UserDefaults(suiteName: UUID().uuidString) and remove it after.let store = TestStore(initialState: Feature.State()) { Feature() } withDependencies: { $0.ordersClient = .mock }; await store.send(.onAppear), await store.receive(\.ordersLoaded) { $0.orders = … }; exhaustivity on unless the project turns it off.app.launchArguments = ["-uitesting"] / launchEnvironment["API_BASE_URL"] = …, handled once at app start to swap in fixtures — never hit production from UI tests.app.buttons["orders.add"]), not by visible text that changes with localization.element.waitForExistence(timeout:), never sleep.addUIInterruptionMonitor or pre-grant through the simulator; keep the test deterministic.assertSnapshot(of: view, as: .image(layout: .device(config: .iPhone13))) with the configurations the suite already uses; cover light / dark and a large Dynamic Type size for new components.#Preview must compile and render its states with stub data — a broken preview is a broken build. Previews are not a substitute for model tests.xcrun simctl list devices available # pick a real simulator name / ID
xcodebuild test -scheme App -destination 'platform=iOS Simulator,name=<available iPhone>'
xcodebuild test -scheme App -destination 'platform=iOS Simulator,name=<available iPad>' # universal apps
xcodebuild test -scheme App -destination 'platform=macOS'
xcodebuild test -scheme WatchApp -destination 'platform=watchOS Simulator,name=<available watch>'
xcodebuild test -scheme App -testPlan UnitTests -only-testing:AppTests/OrdersModelTests
swift test --package-path Packages/Orders # host-buildable feature packages
-workspace when the project has one; Tuist projects can use tuist test <scheme>.-enableCodeCoverage YES); read it with xcrun xccov view --report <result>.xcresult.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
swiftui-testing, xcuitest, swift-testing, snapshot-testing, tca-testing
npx claudepluginhub aratkruglik/claude-sdlc --plugin apple-plugin7 skills in this 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.
/swiftui-stateState and data flow in SwiftUI apps: Observation (@Observable, @State, @Bindable, @Environment), legacy ObservableObject (@StateObject, @ObservedObject, @EnvironmentObject, @Published) in existing code, ownership rules, MainActor-isolated models, dependency injection, SwiftData (@Model, ModelContainer, ModelContext, @Query, migrations) and Core Data in existing apps, The Composable Architecture when installed. Detect and follow the pattern in place.
Use this skill to:
- Decide who owns a piece of state and how it reaches a view.
- Write observable models that update only the views that read them.
- Persist data with SwiftData or the project's existing store.
- Inject services so models are testable.
Do NOT use this skill for:
- View composition and layout — see apple-plugin:swiftui-conventions.
- Navigation state — see apple-plugin:swiftui-navigation.
/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.
Other plugins' skills for the same job