Agent skill · software engineering · dpearson2699
swift-language
Apply modern Swift language patterns and idioms for non-concurrency, non-SwiftUI code. Covers if/switch expressions (Swift 5.9+), typed throws (Swift 6+), result builders, property wrappers, opaque and existential types (some vs any), guard patterns, Never type, Regex builders (Swift 5.7+), basic Codable shaping (CodingKeys, custom decoding, nested containers), modern collection APIs (count(where:), contains(where:), replacing()), basic FormatStyle usage, and string interpolation patterns. Use when writing core Swift code involving generics, protocols, enums, closures, or modern language features; route deep Codable to swift-codable, detailed formatting/localization to swift-formatstyle, and API naming to swift-api-design-guidelines.
Why this skill is useful
Provides modern Swift language patterns and idioms that enhance the AI's ability to generate idiomatic Swift code, particularly for advanced features and best practices.
What it needs
About 8k tokens when loaded. Last updated 2026-07-31. 973 stars on the source repository.
What this skill does
Swift Language Patterns Apply current Swift language syntax without changing behavior or evaluation order. Route deep decoding to swift-codable, formatting to swift-formatstyle, naming to swift-api-design-guidelines, concurrency to swift-concurrency, and SwiftUI state/view work to swiftui-patterns. Contents If/Switch Expressions Typed Throws Result Builders Property Wrappers Opaque and Existential Types Guard Patterns Never Type Regex Builders Codable Best Practices Modern Collection APIs FormatStyle String Interpolation Common Mistakes Review Checklist References If/Switch Expressions For modernization, pin current behavior and evaluation order, make one semantic rewrite, compile the affected module, and run focused fixtures/tests. Fix any change before continuing; repeat until behavior is preserved. Swift 5.9+ allows if and switch as expressions that return values. Use them to assign, return, or initialize directly. Rules: Every branch must produce a value of the same type. Multi-statement branches are not allowed -- each branch is a single expression. Wrap in parentheses when used as a function argument to avoid ambiguity. Typed Throws Swift 6+ allows specifying the error type a function throws. Rules: Use throws(SomeError) only when callers benefit from exhaustive error handling. For mixed error sources, use untyped throws. When modernizing a helper with one local error enum, prefer throws(ErrorEnum) and note Swift 6+. throws(Never) marks a function that syntactically throws but never actually does -- useful in generic contexts. Typed throws propagate: a function calling throws(A) and throws(B) must itself throw a type that covers both (or use untyped throws). Result Builders @resultBuilder enables DSL-style syntax. SwiftUI's @ViewBuilder is the most common example, but you can create custom builders for any domain. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills dpearson2699/swift-language