From swiftui-pro
Reviews and refactors SwiftUI code for modern APIs, state management with @Observable, NavigationStack, layout, performance, and accessibility targeting iOS 26 / Swift 6.
How this skill is triggered — by the user, by Claude, or both
Slash command
/swiftui-pro:swiftui-proThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Write and review SwiftUI for correctness, modern APIs, and performance. Report real
Write and review SwiftUI for correctness, modern APIs, and performance. Report real problems only — no nitpicking.
Trigger: /swiftui-pro or natural language ("review this SwiftUI view").
Use @Observable (Observation framework), not ObservableObject/@Published.
❌ Legacy
final class CounterModel: ObservableObject {
@Published var count = 0
}
struct CounterView: View {
@StateObject private var model = CounterModel()
var body: some View { Text("\(model.count)") }
}
✅ Modern
@Observable
final class CounterModel {
var count = 0
}
struct CounterView: View {
@State private var model = CounterModel()
var body: some View { Text("\(model.count)") }
}
Rules:
@State. Pass it down plainly; use @Bindable only where you need
two-way bindings to its properties.@Environment for app-wide models, not singletons.foregroundStyle() not foregroundColor()..background { ... } / .overlay { ... } closure form, not deprecated overloads.Grid, ViewThatFits, and layout containers over manual GeometryReader math.❌
Text("Hi").foregroundColor(.red)
✅
Text("Hi").foregroundStyle(.red)
Use NavigationStack with a typed path. NavigationView is deprecated.
❌
NavigationView {
NavigationLink("Detail", destination: DetailView())
}
✅
NavigationStack(path: $path) {
List(items) { item in
NavigationLink(item.name, value: item.id)
}
.navigationDestination(for: Item.ID.self) { id in
DetailView(id: id)
}
}
LazyVStack/LazyHStack inside ScrollView for long content; plain VStack
renders everything eagerly.ForEach stable identity (Identifiable or id:), never array indices for
mutable collections.body cheap. Move expensive work out of body into the model or .task.❌ Index identity on a mutable list
ForEach(0..<items.count, id: \.self) { i in Row(items[i]) }
✅
ForEach(items) { item in Row(item) }
Use .task (auto-cancelled on disappear), not onAppear { Task { } }.
✅
.task { await model.load() }
.font(.body) etc..accessibilityLabel for icon-only controls.ObservableObject/@Published instead of @Observable.foregroundColor / NavigationView / other deprecated APIs.VStack where LazyVStack is needed.ForEach keyed by index on a mutable collection.body.Walk the code top to bottom. For each real problem give: the file:line, a one-line
statement of what's wrong, and a tight before → after snippet. Don't mention files that
are already fine. Close with the two or three fixes that matter most, in priority order.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub laxrajpurohit/swift-skills-pro --plugin swiftui-pro