swift-standards
Installation
SKILL.md
Swift Coding Standards
Authoritative for Swift work. The non-negotiables are inline below; each area has a reference with the full rules, rationale, and patterns — read the relevant reference before working in that area, and when reviewing code against it.
Non-negotiables (always apply)
Modern Swift — @Observable (+ @State in views), never
ObservableObject/@Published/@StateObject except when bridging old code.
Actors + await MainActor.run {} over DispatchQueue. async/await over
completion handlers and Combine (adapters for legacy APIs). Views take data
- action callbacks, not ViewModel blobs. Typed throws where they help.
SDK 27:
@Stateis now a macro — for any post-SDK-update compile error in a view using@State("used before being initialized", "invalid redeclaration of synthesized property", "extraneous argument label"), consult theswiftui-whats-new-27skill before fixing; the obvious fix (reordering init assignments) is wrong.