Use when writing async/await code, enabling strict concurrency, fixing Sendable errors, migrating from completion handlers, managing shared state with actors, or using Task/TaskGroup for concurrency.
View on GitHubjohnrogers/claude-swift-engineering
swift-engineering
February 5, 2026
Select agents to install to:
npx add-skill https://github.com/johnrogers/claude-swift-engineering/blob/main/plugins/swift-engineering/skills/modern-swift/SKILL.md -a claude-code --skill modern-swiftInstallation paths:
.claude/skills/modern-swift/# Modern Swift (6.2+) Swift 6.2 introduces strict compile-time concurrency checking with async/await, actors, and Sendable constraints that prevent data races at compile time instead of runtime. This is the foundation of safe concurrent Swift. ## Overview Modern Swift replaces older concurrency patterns (completion handlers, DispatchQueue, locks) with compiler-enforced safety. The core principle: if it compiles with strict concurrency enabled, it cannot have data races. ## Quick Reference | Need | Use | NOT | |------|-----|-----| | Async operation | `async/await` | Completion handlers | | Main thread work | `@MainActor` | `DispatchQueue.main` | | Shared mutable state | `actor` | Locks, serial queues | | Parallel tasks | `TaskGroup` | `DispatchGroup` | | Thread safety | `Sendable` | `@unchecked` everywhere | ## Core Workflow When writing async Swift code: 1. Mark async functions with `async`, call with `await` 2. Apply `@MainActor` to view models and UI-updating code 3. Use `actor` instead of locks for shared mutable state 4. Check `Task.isCancelled` or call `Task.checkCancellation()` in loops 5. Enable strict concurrency in Package.swift for compile-time safety ## Reference Loading Guide **ALWAYS load reference files if there is even a small chance the content may be required.** It's better to have the context than to miss a pattern or make a mistake. | Reference | Load When | |-----------|-----------| | **[Concurrency Essentials](references/concurrency-essentials.md)** | Writing async code, converting completion handlers, using `await` | | **[Swift 6 Concurrency](references/swift6-concurrency.md)** | Using `@concurrent`, `nonisolated(unsafe)`, or actor patterns | | **[Task Groups](references/task-groups.md)** | Running multiple async operations in parallel | | **[Task Cancellation](references/task-cancellation.md)** | Implementing long-running or cancellable operations | | **[Strict Concurrency](references/strict-concurrency.md)** | Enabling Swift 6 stric