swift-concurrency-patterns

Diagnose Swift concurrency bugs and data races in asynchronous code.

4|1|Updated Apr 2, 2026
One-click install
npx skills add https://github.com/AutisticAF/claude-code-apple-dev-plugin --skill swift-concurrency-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swift-concurrency-patterns
Source: https://github.com/AutisticAF/claude-code-apple-dev-plugin/tree/main/skills/swift-concurrency-patterns
Command: npx skills add https://github.com/AutisticAF/claude-code-apple-dev-plugin --skill swift-concurrency-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Developers face confusing compiler errors and runtime data races when adopting async/await, actors, and strict concurrency; this Skill diagnoses isolation issues, explains safe concurrency patterns, and provides migration guidance so code compiles and runs without data races or UI freezes.

Core Features & Use Cases

  • Pattern Library: Clear guidance for async/await, structured concurrency (async let, TaskGroup, withDiscardingTaskGroup), actor usage, reentrancy fixes, and safe use of MainActor.
  • Bridging Legacy APIs: Recipes for wrapping callbacks, delegates, and notification sources using withCheckedContinuation, AsyncStream, and AsyncThrowingStream.
  • Swift 6.2 Migration: Advice on default MainActor inference, @concurrent for background work, isolated conformances, and step-by-step migration checklists for converting code from Swift 6.0/6.1 to 6.2.
  • Runtime Safety & Best Practices: Checklists for Sendable conformance, Task cancellation, continuation exactly-once rules, avoiding heavy main-thread work, and replacing unsafe workarounds.
  • Use Case Example: Migrate an app target that fails strict concurrency checks, fix actor isolation compiler errors, and convert completion-handler APIs to async functions without introducing data races.

Quick Start

Analyze my Swift codebase for actor isolation and data race errors and produce a prioritized migration plan with code-level fixes to adopt Swift 6.2 concurrency features.

Frequently Asked Questions about swift-concurrency-patterns

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

FAQPage Schema
How do I fix Swift data races when migrating to strict concurrency?

Fix Swift data races by diagnosing actor isolation issues and applying Sendable conformances. This Skill provides actionable code-level refactors to satisfy strict concurrency compiler rules and ensure runtime safety across iOS, macOS, and other Apple platforms.

What is the best way to migrate completion handlers to async/await in Swift?

Migrate completion handlers to async/await by wrapping callbacks using withCheckedContinuation and AsyncStream. This Skill provides recipes for bridging legacy APIs safely without introducing data races or freezing the UI.

How do I resolve actor isolation compiler errors in Swift 6.2?

Resolve actor isolation compiler errors in Swift 6.2 by applying default MainActor inference and isolated conformances. This Skill provides a step-by-step migration checklist to convert code from Swift 6.0/6.1 to 6.2 safely.

Does this Skill support structured concurrency patterns like TaskGroup and async let?

Yes, this Skill supports structured concurrency patterns including TaskGroup, async let, and withDiscardingTaskGroup. It provides clear guidance on actor usage, reentrancy fixes, and safe MainActor usage for modern Swift codebases.

Why does my Swift continuation crash with an exactly-once violation?

Swift continuation crashes occur when continuation resumes more or less than exactly once. This Skill provides runtime safety checklists for Task cancellation and continuation rules to prevent these exact concurrency bugs during execution.