From swift-modern-dev
Use when reviewing Swift code for outdated patterns, modernizing a project, running architecture health checks, or grepping for ObservableObject, DispatchQueue.main, NavigationView, or Core Data.
How this skill is triggered — by the user, by Claude, or both
Slash command
/swift-modern-dev:swift-anti-pattern-guardThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Detect and replace the highest-impact forbidden patterns. Advisory unless hooks already block them.
Detect and replace the highest-impact forbidden patterns. Advisory unless hooks already block them.
| ALWAYS | NEVER |
|---|---|
| Report file + pattern + replacement | Auto-rewrite entire modules without review |
| Align with repository guidance and deployment targets | Treat “legacy file” as a permanent exemption without explanation |
Forbidden: ObservableObject, @Published, @StateObject, @ObservedObject, @EnvironmentObject
Replace: @Observable + plain properties; own with @State / inject via @Environment
Forbidden: DispatchQueue.main.async, asyncAfter
Replace: @MainActor, await MainActor.run, Task { @MainActor in }
Forbidden: NavigationView
Replace: NavigationStack or NavigationSplitView
Forbidden: NSManagedObject, @FetchRequest, NSPersistentContainer
Replace: SwiftData @Model, @Query, ModelContext
rg -n "ObservableObject|@Published|@StateObject|@ObservedObject|DispatchQueue\\.main|NavigationView|NSManagedObject|@FetchRequest" --glob '*.swift' .
| Excuse | Reality |
|---|---|
| "Only one ObservableObject" | In greenfield Observation code, consistency avoids two state models |
| "DispatchQueue is clearer" | @MainActor is clearer under Swift 6 |
| "Core Data already works" | New code is SwiftData; migrate when touching area |
npx claudepluginhub pstuart/pstuart --plugin swift-modern-devUse when writing Swift or SwiftUI code, designing iOS/macOS architecture, modernizing legacy patterns, or choosing ViewModels, SwiftData, navigation, or concurrency APIs.
Guides iOS app architecture using Swift 6, iOS 18+, SwiftUI, SwiftData, Observation framework, and concurrency. Modernizes legacy patterns like Core Data, ObservableObject, and GCD.
Reviews Swift code for concurrency safety (async/await, actors, Sendable), error handling, memory management, force unwraps, and retain cycles. Use for .swift files and SwiftUI @Observable.