swift-guide
Installation
SKILL.md
Swift Guide
Applies to: Swift 5.9+, iOS/macOS/Server-Side, SPM, Concurrency
Core Principles
- Value Semantics First: Prefer structs over classes; use classes only when identity or inheritance is required
- Protocol-Oriented Design: Compose behavior through protocols and extensions rather than class hierarchies
- Safe Optionals: Unwrap explicitly with
guard letorif let; force-unwrap (!) is forbidden outside tests - Structured Concurrency: Use async/await and task groups; avoid raw GCD queues for new code
- Compiler as Ally: Enable strict concurrency checking; treat warnings as errors in CI
Guardrails
Version & Dependencies
- Use Swift 5.9+ with Swift Package Manager (Package.swift)
- Pin package versions with
.upToNextMinor(from:)for libraries - Run
swift package resolvebefore committing after dependency changes
Related skills