← ClaudeAtlas

swift-concurrencylisted

Diagnose data races, convert callback-based code to async/await, implement actor isolation patterns, resolve Sendable conformance issues, fix @Observable + @MainActor interaction problems, and guide Swift 6 migration. Use when developers mention: (1) Swift Concurrency, async/await, actors, or tasks, (2) "use Swift Concurrency" or "modern concurrency patterns", (3) migrating to Swift 6, (4) data races or thread safety issues, (5) refactoring closures to async/await, (6) @MainActor, Sendable, or actor isolation, (7) @Observable with concurrency or actor isolation, (8) concurrent code architecture or performance optimization, (9) concurrency-related linter warnings (SwiftLint or similar), (10) SwiftUI view model patterns with Observation framework.
pszypowicz/claude-skills · ★ 0 · Code & Development · score 72
Install: claude install-skill pszypowicz/claude-skills
# Swift Concurrency ## Fast Path Before proposing a fix: 1. Analyze `Package.swift` or `.pbxproj` to determine Swift language mode, strict concurrency level, default isolation, and upcoming features. Do this always, not only for migration work. 2. Capture the exact diagnostic and offending symbol. 3. Determine the isolation boundary: `@MainActor`, custom actor, actor instance isolation, or `nonisolated`. 4. Confirm whether the code is UI-bound or intended to run off the main actor. 5. Check if `@Observable` is in play - it changes how isolation inference works on the type. Project settings that change concurrency behavior: | Setting | SwiftPM (`Package.swift`) | Xcode (`.pbxproj`) | |---|---|---| | Language mode | `swiftLanguageVersions` or `-swift-version` (`// swift-tools-version:` is not a reliable proxy) | Swift Language Version | | Strict concurrency | `.enableExperimentalFeature("StrictConcurrency=targeted")` | `SWIFT_STRICT_CONCURRENCY` | | Default isolation | `.defaultIsolation(MainActor.self)` | `SWIFT_DEFAULT_ACTOR_ISOLATION` | | Upcoming features | `.enableUpcomingFeature("NonisolatedNonsendingByDefault")` | `SWIFT_UPCOMING_FEATURE_*` | If any of these are unknown, ask the developer to confirm them before giving migration-sensitive guidance. Do not guess. Guardrails: - Do not recommend `@MainActor` as a blanket fix. Justify why the code is truly UI-bound. - Prefer structured concurrency over unstructured tasks. Use `Task.detached` only with a clear reason.