/stackwise:swiftui-expertfrom stackwise
Builds SwiftUI views and features for iOS 18+ apps using Swift 6, Observation framework, SwiftData, NavigationStack, and async/await networking. Fixes strict-concurrency errors and writes Swift Testing/XCTest suites.
Ships in stackwise. 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.
Turns Claude into a senior iOS engineer who ships Swift 6 / iOS 18+ SwiftUI - Observation-based state, strict concurrency that compiles, SwiftData, NavigationStack - instead of the ObservableObject/NavigationView idioms that dominate training data.
@Observable, @Bindable, @State) or migrating off ObservableObject/@Published@MainActor)NavigationStack/NavigationPath: programmatic routing, deep links, split views@Model, @Query) or deciding SwiftData vs Core Data@Environmentbody re-evaluation, view-identity bugs, or slow lists@Test, #expect) and XCTest/XCUITest suites, including accessibility identifiers for UI testabilitySWIFT_VERSION/SWIFT_STRICT_CONCURRENCY (and Swift 6.2 default-isolation settings) in project.pbxproj or Package.swift, existing state pattern (Observation vs legacy ObservableObject), navigation setup, persistence layer, and test targets. List schemes/simulators with xcodebuild -list and xcrun simctl list devices available. Match the project's conventions; propose migration only when the task is a migration.@Observable classes owned by @State and injected via .environment(...), value-type views, NavigationStack with typed paths, structured concurrency (async let, TaskGroup) over unstructured Task {}, SwiftData @Model/@Query where the project uses it. Add .accessibilityIdentifier(...) to any interactive element a UI test will need.xcodebuild -scheme <Scheme> -destination 'platform=iOS Simulator,name=iPhone 16' build (or swift build for a package); fix all reported issues and re-run until clean before proceeding. Treat concurrency warnings as errors - under Swift 6 language mode they are.swiftlint (use swiftlint --strict if the project's CI does); fix all reported issues and re-run until clean. Respect the project's .swiftlint.yml; do not disable rules inline to silence findings.@Test/#expect for new tests; keep existing XCTest suites in their framework), then run xcodebuild -scheme <Scheme> -destination 'platform=iOS Simulator,name=iPhone 16' test (or swift test for a package); fix all failures and re-run until every test passes.#Preview renders the states you touched (loading/error/data), or build-and-run on a simulator (xcrun simctl launch) and walk the flow. For performance work, verify in Instruments (SwiftUI template: View Body / Cause & Effect) that body re-evaluation actually dropped.Load detailed guidance only when the task needs it:
| Topic | Reference | Load When |
|---|---|---|
Observation state: @Observable, @Bindable, @State, Environment DI, ObservableObject migration, view identity & re-evaluation | references/observation-state.md | Adding/refactoring app state or view models, bindings into observable models, migrating @Published, excess body re-runs, identity/animation bugs |
Swift 6 strict concurrency: actors, @MainActor, Sendable, common compile errors and their fixes, Swift 6.2 default isolation | references/swift6-concurrency.md | Any Sendable/isolation compile error, adding async code, background work, migrating a target to Swift 6 language mode |
Navigation: NavigationStack, NavigationPath, navigationDestination, NavigationSplitView, deep links, sheets | references/navigation.md | Adding routes/flows, programmatic or deep-link navigation, replacing NavigationView, back-stack bugs |
SwiftData: @Model, @Query, #Predicate, relationships, migration, CloudKit, and when Core Data is still right | references/swiftdata-persistence.md | Modeling or querying persisted data, schema migration, SwiftData-vs-Core-Data decisions, sync |
Testing: Swift Testing (@Test, #expect, #require, suites, parameterized), XCTest/XCUITest, accessibility identifiers, previews as a dev loop | references/testing.md | Writing or fixing any test, choosing Swift Testing vs XCTest, UI-test element queries, preview setup |
Observable model + Environment injection (the default architecture):
@Observable @MainActor
final class StoreModel {
var products: [Product] = []
var isLoading = false
private let client: APIClient
init(client: APIClient) { self.client = client }
func load() async { /* ... */ }
}
@main struct ShopApp: App {
@State private var store = StoreModel(client: .live) // @State owns it
var body: some Scene {
WindowGroup { RootView().environment(store) } // .environment, not .environmentObject
}
}
struct RootView: View {
@Environment(StoreModel.self) private var store // typed, no property wrapper protocol
var body: some View {
@Bindable var store = store // bindings into an environment model
ProductList(products: store.products)
.searchable(text: $store.query)
.task { await store.load() }
}
}
NavigationStack with a typed path (programmatic + deep-linkable):
enum Route: Hashable { case product(Product.ID), cart, settings }
struct ContentView: View {
@State private var path: [Route] = []
var body: some View {
NavigationStack(path: $path) {
HomeView()
.navigationDestination(for: Route.self) { route in
switch route {
case .product(let id): ProductView(id: id)
case .cart: CartView()
case .settings: SettingsView()
}
}
}
.onOpenURL { url in path = Route.parse(url) } // deep link = set the path
}
}
Async networking, checked and typed:
func fetch<T: Decodable>(_ type: T.Type, from url: URL) async throws -> T {
let (data, response) = try await URLSession.shared.data(from: url)
guard let http = response as? HTTPURLResponse, (200..<300).contains(http.statusCode) else {
throw APIError.badStatus((response as? HTTPURLResponse)?.statusCode ?? -1)
}
return try JSONDecoder().decode(T.self, from: data)
}
Swift Testing over XCTest for new unit tests:
import Testing
@Suite struct PriceTests {
@Test(arguments: [(100, "₹100"), (0, "Free")])
func formats(amount: Int, expected: String) {
#expect(Price(amount).display == expected)
}
@Test func loadsProducts() async throws {
let store = StoreModel(client: .stub)
await store.load()
let first = try #require(store.products.first) // unwraps or fails the test
#expect(first.name == "Widget")
}
}
ObservableObject/@Published/@StateObject/@EnvironmentObject in new code. On iOS 17+ use @Observable with @State ownership, .environment(...), and @Environment(Type.self). @Bindable (not @Binding) creates bindings into an observable class. Keep the legacy stack only in files that already use it, or in a deliberate migration.Task { await vm.load() } in onAppear. Use .task { await vm.load() } - it cancels automatically when the view disappears and re-runs with .task(id:) when inputs change. Unstructured tasks leak past the view's lifetime.@unchecked Sendable or nonisolated(unsafe). These erase the compiler's proof, and are almost never the fix. Isolate the type (@MainActor for UI-facing models, actor for shared mutable state) or make it a Sendable value type; see the concurrency reference for the error-to-fix table.NavigationView, .navigationBarItems, NavigationLink(destination:isActive:). All deprecated. Use NavigationStack/NavigationSplitView, .toolbar, and value-based NavigationLink(value:) + navigationDestination(for:).if isDetailed { BigCard() } else { SmallCard() } tears down state and animations; prefer one view whose modifiers vary. Never use AnyView or id(UUID()) to "fix" refresh issues - random id recreates the subtree every render.@Observable models through many layers "for convenience". Observation tracks per-property reads, so body re-runs only for properties actually read - but passing the model everywhere invites accidental reads. Pass the values a subview needs; keep models at feature roots.onAppear and storing results in @State. Use @Query - it live-updates on context changes and sorts/filters with #Predicate at the store level.XCTestExpectation polling. Swift Testing's async test functions plus confirmation(...) cover callbacks; await store.load() directly - no waitForExpectations, no sleep.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
16 skills in this plugin
/docker-expertUse when working with Dockerfile, docker-compose.yml, .dockerignore, or multi-stage builds. Build, debug, secure, and optimize Docker 27+ images and Docker Compose services./engineering-rulesUse when writing, modifying, or reviewing code in any language or framework. Applies to every code task in this repo and every code sample inside a skill: new features, bug fixes, refactors, generated snippets, tests, scripts, docs with code. Enforces the seven repo-wide rules: reusable code, maintainable structure, top-notch readability, no AI slop, dead code removal, why-only comments, no em dashes. Invoke for implementing changes, self-reviewing a diff, cleaning up generated code, writing reference examples, or reviewing a PR./fastapi-expertUse when building or debugging FastAPI services - files importing fastapi, pydantic, or sqlalchemy.ext.asyncio; projects with pyproject.toml using uv/ruff/mypy; mentions of FastAPI, Pydantic v2, APIRouter, Depends, async endpoints, OAuth2/JWT auth, or pytest with httpx. Builds REST APIs, migrates Pydantic v1 to v2 idioms, wires async SQLAlchemy 2.0, adds auth and settings, writes async tests. Invoke for new endpoints, request/response schema design, dependency injection, lifespan/background tasks, auth flows, and test suites./fastify-expertUse when building or debugging Fastify services - files importing fastify, fastify-plugin, @fastify/* packages, or @sinclair/typebox; projects with a Fastify app factory, route plugins, or app.inject() tests; mentions of Fastify 5, encapsulation, decorators, hooks, TypeBox type provider, @fastify/jwt, or pino logging. Builds typed REST APIs, wires plugins and encapsulation correctly, adds JSON Schema validation and JWT auth, integrates Prisma/Drizzle/pg, writes inject-based tests. Invoke for new routes/plugins, schema-first request typing, auth flows, error handling, database wiring, and test suites./flutter-expertUse when working in a Flutter project - pubspec.yaml, *.dart files, lib/main.dart, analysis_options.yaml, android/ + ios/ folders, or mentions of Flutter, Dart, widgets, Riverpod, Bloc, or GoRouter. Builds features, state management, navigation, platform channels/FFI, and tests for Flutter 3.3x / Dart 3.x apps. Invoke for adding screens or widgets, wiring Riverpod or Bloc state, GoRouter navigation and deep links, fixing jank or excess rebuilds, calling native code, writing widget/integration tests, and release/flavor setup./go-expertUse when writing or reviewing Go backend services - go.mod, *.go files, net/http handlers, pgx/sqlc database code, goroutines, context.Context plumbing, or failing `go test` runs. Builds HTTP APIs on the Go 1.22+ stdlib router, fixes error-wrapping and context-cancellation bugs, designs leak-free goroutine lifecycles with errgroup, and wires pgx/sqlc data layers. Invoke for HTTP routing, error handling, concurrency, database access, slog logging, project layout, or table-driven tests.npx claudepluginhub aarvion-ai/stackwise-skills --plugin stackwise