From swiftui
Audits SwiftUI code for data flow, shared state (@Observable, @State), bindings, and SwiftData best practices. Flags violations like missing @MainActor or improper state usage.
How this command is triggered — by the user, by Claude, or both
Slash command
/swiftui:dataswiftui-review/references/The summary Claude sees in its command listing — used to decide when to auto-load this command
# Data flow, shared state, and property wrappers It is important that SwiftUI body code and logic code be kept separate in order to make code easier to read, write, and maintain. That usually means placing code into methods rather than inline in the `body` property, but often also means carving functionality out into separate `@Observable` classes. These rules help ensure code is efficient and works well in the long term. ## Shared state - `@Observable` classes must be marked `@MainActor` unless the project has Main Actor default actor isolation. Flag any `@Observable` class missing th...
It is important that SwiftUI body code and logic code be kept separate in order to make code easier to read, write, and maintain. That usually means placing code into methods rather than inline in the body property, but often also means carving functionality out into separate @Observable classes.
These rules help ensure code is efficient and works well in the long term.
@Observable classes must be marked @MainActor unless the project has Main Actor default actor isolation. Flag any @Observable class missing this annotation.@Observable classes with @State (for ownership) and @Bindable / @Environment (for passing).ObservableObject, @Published, @StateObject, @ObservedObject, or @EnvironmentObject unless they are unavoidable, or if they exist in legacy/integration contexts when changing architecture would be complicated.@State should be marked private and only owned by the view that created it.CIContext, it can be stored using @State even though it is not an observable object. This effectively uses @State as a cache – storing something persistently, but not doing any change tracking on it since it's not an observable object.Binding(get:set:) in view body code. It is much cleaner and simpler to use a binding provided by @State, @Binding or similar, then use onChange() to trigger any effects.TextField, bind the TextField to a numeric value such as Int or Double, then use its format initializer like this: TextField("Enter your score", value: $score, format: .number). Apply either .keyboardType(.numberPad) (for integers) or .keyboardType(.decimalPad) (for floating-point numbers) as appropriate. Using the modifier alone is not sufficient.Identifiable rather than using id: \.someProperty in SwiftUI code.@AppStorage inside an @Observable class, even if marked @ObservationIgnored – it will not trigger view updates when a change happens.@Attribute(.unique).npx claudepluginhub fradser/dotclaude --plugin swiftui/create-viewGenerates a SwiftUI view file with MVVM architecture, property wrappers, layouts, navigation elements, states, accessibility, dark mode support, previews, and documentation.
/dataCreates example data for a domain (academic, finance, ecommerce, medical, customer_support) with optional nrows and vectorizer, then uploads to a Weaviate collection.
/dataProcesses and transforms data using jq, pandas, or SQL based on a natural language task description and optional tool specification.