From swift-language-pro
Reviews and guides idiomatic Swift — value vs reference types, optionals, error handling, generics, protocols, and API naming conventions.
How this skill is triggered — by the user, by Claude, or both
Slash command
/swift-language-pro:swift-language-proThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Write idiomatic, safe, modern Swift. Follow Apple's API Design Guidelines.
Write idiomatic, safe, modern Swift. Follow Apple's API Design Guidelines.
Trigger: /swift-language-pro.
struct/enum) by default; use class only for identity or
reference semantics.❌
class Point { var x = 0.0; var y = 0.0 } // accidental shared mutation
✅
struct Point { var x = 0.0; var y = 0.0 }
❌ Two bools that allow impossible states
struct State { var isLoading: Bool; var error: Error? } // loading + error?
✅
enum LoadState<Value> { case idle, loading, loaded(Value), failed(Error) }
if let / guard let; avoid force-unwrap ! outside tests.guard for early exit, keeping the happy path unindented.❌
func name(_ u: User?) -> String { return u!.name }
✅
func name(_ u: User?) -> String {
guard let u else { return "Guest" }
return u.name
}
❌ Boolean failure
func save() -> Bool
✅
enum SaveError: Error { case diskFull, notAuthorized }
func save() throws // call sites use try/catch; errors carry meaning
❌
func insertObject(_ obj: Element, atIndex i: Int)
list.insertObject(x, atIndex: 0)
✅
func insert(_ element: Element, at index: Int)
list.insert(x, at: 0)
where; prefer protocols with associated types over Any.✅
func max<C: Collection>(of items: C) -> C.Element? where C.Element: Comparable {
items.max()
}
class where a struct would do.! in app code.Bool/nil for failures instead of throws.Any/type-erasure where a generic constraint fits.Per issue: file:line, the guideline violated, before/after. Lead with safety (force-unwraps, impossible states) before style.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub laxrajpurohit/swift-skills-pro --plugin swift-language-pro