SwiftConcurrency

Reviews and guides Swift 6 concurrency code for actors, reentrancy, tasks, Sendable, and MainActor correctness.

Updated Jul 10, 2026
One-click install
npx skills add https://github.com/Kaleb-Rupe/aurora --skill swiftconcurrency-kaleb-rupe
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: SwiftConcurrency
Source: https://github.com/Kaleb-Rupe/aurora/tree/main/claude/skills/SwiftConcurrency
Command: npx skills add https://github.com/Kaleb-Rupe/aurora --skill swiftconcurrency-kaleb-rupe

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Swift 6 concurrency introduces subtle bugs that are hard to spot: data races across isolation boundaries, stale state after an await, leaked unstructured tasks, and UI updates made off the main actor. This Skill applies a structured rule set to catch those defects while writing code and during a dedicated review pass. ## Core Features & Use Cases - Structured review pass: Runs a five-area checklist (actors/isolation, reentrancy, structured tasks and cancellation, Sendable boundaries, MainActor UI hops) and reports findings by file with before/after fixes. - Focus-area reviews: Load only the relevant reference (e.g., reentrancy.md) when the user names a specific concern like a race after an await. - Write-time guidance: Apply best practices while authoring actors, task groups, AsyncStream pipelines, and @Sendable dependency injection. - Use Case: Ask it to review a process-supervisor actor; it checks fetch-await-act patterns, identity/generation guards, task ownership and cancellation, and MainActor hops, then prioritizes data-race and reentrancy defects. ## Quick Start Ask the assistant to review your Swift actor or async code for concurrency bugs, optionally naming a focus area such as reentrancy, sendable, or mainactor.

Frequently Asked Questions about SwiftConcurrency

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

FAQPage Schema
How do I review Swift actor code for data races?

Run a structured review that checks three questions in order: which isolation domain owns each mutable value, what crosses between domains (must be Sendable), and what happens at each await. Findings are reported by file with before/after fixes, prioritizing data-race and reentrancy defects.

What is reentrancy in Swift actors and why does it cause bugs?

Reentrancy means an actor can run other queued messages at every await suspension point, so state read before the await may be stale after it. The fix is to re-validate after every await and use identity or generation guards to drop actions against replaced resources.

How do I stream updates from a background actor to SwiftUI?

Have the producing actor yield Sendable values into an AsyncStream, and consume that stream from a task on the MainActor that updates the view. Hop across the boundary once with an @MainActor method or await MainActor.run rather than hopping per update.

Why does my Swift task keep running after cancellation?

A call like try? await clock.sleep swallows CancellationError, so the loop continues. Add guard !Task.isCancelled after the sleep, store every spawned Task handle, and cancel it in close() or deinit so the work can actually be stopped.

When should a Swift type be marked Sendable?

Mark a type Sendable whenever it crosses an isolation boundary between actors or tasks. Structs and enums of Sendable members qualify, while mutable classes should have their state moved into an actor instead of being shared across domains.