swift-concurrency

Guides Swift developers through async/await, actors, Sendable, and Swift 6 concurrency migration.

70|4|Updated Jul 22, 2025
One-click install
npx skills add https://github.com/AlexW00/Zettel --skill swift-concurrency-alexw00
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: swift-concurrency
Source: https://github.com/AlexW00/Zettel/tree/main/.agents/skills/swift-concurrency
Command: npx skills add https://github.com/AlexW00/Zettel --skill swift-concurrency-alexw00

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing correct concurrent Swift code is hard: data races, actor isolation errors, Sendable violations, and Swift 6 migration warnings can stall development. This Skill provides structured expert guidance for diagnosing and fixing Swift Concurrency issues with minimal, reviewable changes. ## Core Features & Use Cases - Decision-tree guidance: Routes questions to focused reference docs covering async/await, tasks, actors, Sendable, async sequences, threading, memory management, testing, performance, Core Data, and migration. - Build-settings intake: Instructs the agent to inspect Package.swift and project.pbxproj for strict concurrency levels, default actor isolation, and upcoming features before giving advice. - Triage playbook: Maps common compiler and SwiftLint errors (e.g., async_without_await, non-Sendable sending warnings, MainActor isolation errors) to the right fix strategy. - Use Case: A developer migrating an app to Swift 6 hits "Sending value of non-Sendable type risks causing data races" and gets a step-by-step fix that identifies the isolation boundary and applies the correct Sendable or actor pattern. ## Quick Start Ask the agent to review your Swift file for data-race safety and explain how to fix the concurrency warnings using Swift 6 patterns.

Frequently Asked Questions about swift-concurrency

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix 'Sending value of non-Sendable type risks causing data races' in Swift?▼

First identify where the value crosses an isolation boundary, then either make the type Sendable, transfer it safely using region-based isolation, or restructure so the value never leaves its isolation domain. The skill's sendable and threading references cover Swift 6.2 behavior changes in detail.

When should I use an actor vs @MainActor vs Mutex in Swift?▼

Use an actor for shared mutable state in async contexts, @MainActor only for genuinely UI-related code like view models, and Mutex for synchronous fine-grained locking or legacy code integration. The skill includes a decision tree covering async versus synchronous contexts.

How do I migrate Swift closures and completion handlers to async/await?▼

Add a new async method alongside the old one, replace completion handlers with return values or throws, and bridge remaining callback APIs with withCheckedContinuation or AsyncStream. The migration reference covers @preconcurrency and minimal-blast-radius strategies.

Does Swift 6 strict concurrency checking break existing code?▼

Swift 6 enables complete data-race safety at compile time, which surfaces Sendable and isolation diagnostics in older code. The skill recommends checking SWIFT_STRICT_CONCURRENCY and upcoming feature flags first, then migrating incrementally with small reviewable changes.

Why does my SwiftLint async_without_await warning appear and how do I fix it?▼

The warning fires when an async function contains no await calls. Remove async if it is not required; if it is required by a protocol, override, or @concurrent attribute, prefer a narrow suppression over adding fake awaits.

Can I use Core Data safely with Swift Concurrency actors?▼

Yes, but NSManagedObject is not Sendable, so pass only NSManagedObjectID between contexts and use context.perform for access. The skill recommends a simple CoreDataStore pattern with @MainActor for the view context and @concurrent for background work over custom executors.