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 w
Security Assessment
About swift-language
This skill provides expertise in modern Swift language patterns and idioms for non-concurrency, non-SwiftUI code. It focuses on core language features introduced in Swift 5.9 through 6.3, helping developers write cleaner, more expressive Swift code using the latest syntax improvements. The skill covers if/switch expressions, typed throws, result builders, property wrappers, and the distinction between opaque and existential types.
Key capabilities include applying modern collection APIs like count(where:) and replacing(), implementing Regex builders for pattern matching, shaping Codable implementations with CodingKeys and custom decoding strategies, and using FormatStyle for basic formatting needs. The skill also addresses the type system's nuances with some vs any, guard patterns, the Never type, and string interpolation techniques. It includes guidance on C interop with @c attributes, module disambiguation, and performance optimizations through @specialized and @inline(always).
This skill is ideal for Swift developers working on core application logic, data models, utilities, and business logic layers. It's particularly valuable when implementing generics, protocols, enums, closures, or leveraging Swift's modern language features to reduce boilerplate and improve code clarity. The skill explicitly routes specialized topics like deep Codable work to swift-codable, detailed formatting to swift-formatstyle, API naming to swift-api-design-guidelines, and concurrency or SwiftUI concerns to their respective skills, ensuring focused and accurate guidance.
FAQ
What Swift versions does this skill target?
This skill targets Swift 5.9 through 6.3, with specific features like if/switch expressions (Swift 5.9+), typed throws (Swift 6+), and Regex builders (Swift 5.7+). It focuses on modern language patterns available in recent Swift releases.
When should I use this skill versus other Swift-related skills?
Use this skill for core Swift language features, generics, protocols, enums, closures, and basic Codable work. Route deep Codable/API decoding to swift-codable, detailed formatting to swift-formatstyle, API naming to swift-api-design-guidelines, concurrency patterns to swift-concurrency, and SwiftUI state management to swiftui-patterns.
Does this skill cover SwiftUI or concurrency patterns?
No, this skill explicitly excludes SwiftUI and concurrency topics. For SwiftUI state and view patterns, use swiftui-patterns. For async/await, actors, and structured concurrency, use swift-concurrency.
What are the main limitations when using @c for C interop?
The @c attribute cannot be used with Swift-only types including String, Array, UnsafeBufferPointer, closures, and generic placeholders. Only C-compatible types like primitive integers, floats, and unsafe pointers are supported.
What's the difference between 'some' and 'any' in Swift's type system?
The 'some' keyword creates opaque types with a single concrete type known at compile time, enabling better performance and protocol requirements with Self or associated types. The 'any' keyword creates existential types that can hold any conforming type at runtime, with some performance overhead and restrictions on Self usage.
Install swift-language
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
dpearson2699/swift-ios-skills