swift-concurrency
Skill8 starsChanged 6 days agoApache-2.0View on GitHub
Diagnose data races, convert callback-based code to async/await, implement actor isolation patterns, resolve Sendable conformance issues, 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) concurrent code architecture or performance optimization, (8) concurrency-related linter warnings (SwiftLint or similar; e.g. async_without_await, Sendable/actor isolation/MainActor lint).
26 other projects use a version of this, 16 of them edited.
Adopted by
Most recently taken up by
- tornikegomareli/Skillsedited, first seen Nov 8, 2026
- uinaf/slopwakeedited, first seen Nov 3, 2026
- igorkulman/pi-skillstheir own version, first seen Nov 1, 2026
- VelimirMueller/claude-skillsedited, first seen Nov 1, 2026
- VelimirMueller/ai-development-skillsedited, first seen Nov 1, 2026
- The-Artificer-of-Ciphers-LLC/skills-from-the-artificeredited, first seen Nov 1, 2026
Used with
Projects with it also use swiftdata, swift-testing and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
Prisma-Labs-DevSkillswiftdata
API reference: SwiftData. Query for @Model, ModelContext, @Query, schema migrations.
Also in 3 projects that use this
pluginagentmarketplaceSkillswift-testing
Test Swift applications - XCTest, Swift Testing, UI tests, mocking, TDD, CI/CD
Also in 4 projects that use this
xfstudioSkillswiftui-expert-skill
Write, review, or improve SwiftUI code following best practices for state management, view composition, performance, modern APIs, Swift concurrency, and iOS 26+ Liquid Glass adoption. Use when building new SwiftUI features, refactoring existing views, reviewing code quality, or adopting modern SwiftUI patterns.
Also in 8 projects that use this
AvdLeeSkillswift-testing-expert
Expert guidance for Swift Testing: test structure, #expect/#require macros, traits and tags, parameterized tests, test plans, parallel execution, async waiting patterns, and XCTest migration. Use when writing new Swift tests, modernizing XCTest suites, debugging flaky tests, or improving test quality and maintainability in Apple-platform or Swift server projects.
Also in 3 projects that use this
eugenepyvovarovSkillswift-concurrency-expert
Swift Concurrency review and remediation for Swift 6.2+. Use when asked to review Swift Concurrency usage, improve concurrency compliance, or fix Swift concurrency compiler errors in a feature or file.
Also in 4 projects that use this
dadederkSkillios-accessibility
Expert guidance on iOS accessibility best practices, patterns, and implementation. Use when developers mention: (1) iOS accessibility, VoiceOver, Dynamic Type, or assistive technologies, (2) accessibility labels, traits, hints, or values, (3) automated accessibility testing, auditing, or manual testing, (4) Switch Control, Voice Control, or Full Keyboard Access, (5) inclusive design or accessibility culture, (6) making apps work for users with disabilities.
Also in 3 projects that use this
Other versions26 projects use a version of this.
Word for word · 0
None found.
Edited · 16
- Provenance-Emu/Provenance★ 6.4k46% same
- pluk-inc/markdown-preview★ 3k34% same
- pluk-inc/md-preview.app★ 3k34% same
- AvdLee/Swift-Concurrency-Agent-Skill★ 1.7k31% same
- AFK-surf/OpenBridge★ 43058% same
- wendylabsinc/claude-skills★ 6236% same
- nonameplum/agent-skills★ 1758% same
- The-Artificer-of-Ciphers-LLC/skills-from-the-artificer★ 732% same
- VelimirMueller/ai-development-skills★ 731% same
- VelimirMueller/claude-skills★ 731% same
6 more not listed
Wrote their own version · 10
- Prisma-Labs-Dev/apple-skills★ 336same name
- jamesrochabrun/skills★ 209same name
- pepicrft/fuckingapproachableswiftconcurrency★ 156same name
- rusel95/ios-agent-skills★ 13same name
- thienqo/ios-skills★ 12same name
- pluginagentmarketplace/custom-plugin-swift★ 9same name
- igorkulman/pi-skills★ 3same name
- piemonte/skills★ 1same name
- apexbymanish/claude-ai-agents-ios★ 0same name
- Samueladewole/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository18 other files it gives its agents.
- codebase-designSkill
- principle-type-system-disciplineSkill
- swift-64-concurrencySkill
- swift-adversarial-pr-reviewSkill
- swift-api-design-guidelinesSkill
- swift-evaluate-paritySkill
- swift-functional-architectureSkill
- swift-functional-coreSkill
- swift-hexagonal-spmSkill
- swift-hook-xpcSkill
- swift-pr-orchestrationSkill
- swift-protocol-boundariesSkill
- swift-pr-reviewSkill
- swift-systems-safetySkill
- swift-testing-proSkill
- swift-thermo-nuclear-reviewSkill
- swift-type-system-architectureSkill
- swift-value-semanticsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
23 rules. 1 is common, 7 are distinctive, and 15 are very specific to this project.
1
Common
Most of the 25 edited versions we read keep these.
7
Distinctive
This author's own choices. Worth a look.
15
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Before proposing fixes, identify the isolation boundary: @MainActor, custom actor, actor instance isolation, or nonisolated.
- Very specific: line 11
Do not recommend @MainActor as a blanket fix.
- Very specific: line 12
Prefer structured concurrency (child tasks, task groups) over unstructured tasks.
- Very specific: line 13
If recommending @preconcurrency, @unchecked Sendable, or nonisolated(unsafe), require:
- Distinctive: line 27
Use Quick Fix Mode when:
- Distinctive: line 33
Default isolation or strict concurrency settings are unknown and likely affect behavior.
- Common: line 48
If any of these are unknown, ask the developer to confirm them before giving migration-sensitive guidance.
- Distinctive: line 52
Prefer edits that preserve behavior while satisfying data-race safety.
- Very specific: line 57
Sendable errors: prefer immutable/value types.
- Distinctive: line 79
Use the decision tree + references for the deeper fix.
- Distinctive: line 80
If behavior changes are possible, document the invariant and add tests/verification steps.
- Distinctive: line 84
When a developer needs concurrency guidance, follow this decision tree:
- Very specific: line 87
Read references/async-await-basics.md for foundational patterns
- Very specific: line 107
Read references/threading.md for thread/task relationship and isolation
- Very specific: line 110
Read references/memory-management.md for retain cycle prevention
- Very specific: line 115
Use references/linting.md for rule intent and preferred fixes.
- Very specific: line 117
Remove async if not required.
- Very specific: line 125
Use references/threading.md to avoid thread-centric debugging and rely on isolation + Instruments
- Very specific: line 130
Use references/testing.md (await fulfillment(of:) and Swift Testing patterns)
- Very specific: line 132
Use references/core-data.md (DAO/NSManagedObjectID, default isolation conflicts)
- Distinctive: line 187
If a fix introduces new warnings, resolve them before continuing.
- Very specific: line 215
Check Task.isCancelled in long-running operations.
- Very specific: line 216
Never use semaphores or locks in async contexts — use actors or Mutex instead.
“Common” is measured: kept by at least 6 in 10 of the 25 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Swift Concurrency
Agent Rules
- Analyze
Package.swiftor.pbxprojto determine Swift language mode (5.x vs 6) and toolchain before giving advice. - Before proposing fixes, identify the isolation boundary:
@MainActor, custom actor, actor instance isolation, or nonisolated. - Do not recommend
@MainActoras a blanket fix. Justify why main-actor isolation is correct for the code. - Prefer structured concurrency (child tasks, task groups) over unstructured tasks. Use
Task.detachedonly with a clear reason. - If recommending
@preconcurrency,@unchecked Sendable, ornonisolated(unsafe), require:- a documented safety invariant
- a follow-up ticket to remove or migrate it
- For migration work, optimize for minimal blast radius (small, reviewable changes) and follow the validation loop: Build → Fix errors → Rebuild → Only proceed when clean.
- Course references are for deeper learning only. Use them sparingly and only when they clearly help answer the developer's question.
Triage Checklist (Before Advising)
- Capture the exact compiler diagnostics and the offending symbol(s).
- Identify the current isolation boundary and module defaults (
@MainActor, custom actor, default isolation). - Confirm whether the code is UI-bound or intended to run off the main actor.
Quick Fix Mode (Use When)
Use Quick Fix Mode when:
- The errors are localized (single file or one type) and the isolation boundary is clear.
- The fix does not require API redesign or multi-module changes.
- You can explain the fix in 1–2 steps without changing behavior.
Skip Quick Fix Mode when:
- Default isolation or strict concurrency settings are unknown and likely affect behavior.
- The error crosses module boundaries or involves public API changes.
- The fix would require
@unchecked Sendable,@preconcurrency, ornonisolated(unsafe)without a clear invariant.
Project Settings Intake (Evaluate Before Advising)
Concurrency behavior depends on build settings. Before advising, determine these via Read on Package.swift or Grep in .pbxproj files:
| Setting | SwiftPM (Package.swift) | Xcode (.pbxproj) |
| Default isolation | .defaultIsolation(MainActor.self) | SWIFT_DEFAULT_ACTOR_ISOLATION |
| Strict concurrency | .enableExperimentalFeature("StrictConcurrency=targeted") | SWIFT_STRICT_CONCURRENCY |
| Upcoming features | .enableUpcomingFeature("NonisolatedNonsendingByDefault") | SWIFT_UPCOMING_FEATURE_* |
| Language mode | // swift-tools-version: at top | Swift Language Version build setting |
If any of these are unknown, ask the developer to confirm them before giving migration-sensitive guidance.
Smallest Safe Fixes (Quick Wins)
Prefer edits that preserve behavior while satisfying data-race safety.
- UI-bound types: isolate the type or specific members to
@MainActor(justify why UI-bound). - Global/static mutable state: move into an
actoror isolate to@MainActorif UI-only. - Background work: for work that should always hop off the caller’s isolation, move expensive work into an
asyncfunction marked@concurrent; for work that doesn’t touch isolated state but can inherit the caller’s isolation (for example withNonisolatedNonsendingByDefault), usenonisolatedwithout@concurrent, or use anactorto guard mutable state. - Sendable errors: prefer immutable/value types; avoid
@unchecked Sendableunless you can prove and document thread safety.
Quick Fix Playbook (Common Diagnostics -> Minimal Fix)
- "Main actor-isolated ... cannot be used from a nonisolated context"
- Quick fix: if UI-bound, make the caller
@MainActoror hop withawait MainActor.run { ... }. - Escalate if this is non-UI code or causes reentrancy; use
references/actors.md.
- Quick fix: if UI-bound, make the caller
- "Actor-isolated type does not conform to protocol"
- Quick fix: add isolated conformance (e.g.,
extension Foo: @MainActor SomeProtocol). - Escalate if the protocol requirements must be
nonisolated; usereferences/actors.md.
- Quick fix: add isolated conformance (e.g.,
- "Sending value of non-Sendable type ... risks causing data races"
- Quick fix: confine access inside an actor or convert to a value type with immutable (
let) state. - Escalate before
@unchecked Sendable; usereferences/sendable.mdandreferences/threading.md.
- Quick fix: confine access inside an actor or convert to a value type with immutable (
- SwiftLint
async_without_await- Quick fix: remove
asyncif not required; if required by protocol/override/@concurrent, use narrow suppression with rationale. Seereferences/linting.md.
- Quick fix: remove
- "wait(...) is unavailable from asynchronous contexts" (XCTest)
- Quick fix: use
await fulfillment(of:)or Swift Testing equivalents. Seereferences/testing.md.
- Quick fix: use
Escalation Path (When Quick Fixes Aren't Enough)
- Gather project settings (default isolation, strict concurrency level, upcoming features).
- Re-evaluate isolation boundaries and which types cross them.
- Use the decision tree + references for the deeper fix.
- If behavior changes are possible, document the invariant and add tests/verification steps.
Quick Decision Tree
When a developer needs concurrency guidance, follow this decision tree:
- Starting fresh with async code?
- Read
references/async-await-basics.mdfor foundational patterns - For parallel operations →
references/tasks.md(async let, task groups)
- Read
- Protecting shared mutable state?
- Need to protect class-based state →
references/actors.md(actors, @MainActor) - Need thread-safe value passing →
references/sendable.md(Sendable conformance)
- Need to protect class-based state →
- Managing async operations?
- Structured async work →
references/tasks.md(Task, child tasks, cancellation) - Streaming data →
references/async-sequences.md(AsyncSequence, AsyncStream)
- Structured async work →
- Working with legacy frameworks?
- Core Data integration →
references/core-data.md - General migration →
references/migration.md
- Core Data integration →
- Performance or debugging issues?
- Slow async code →
references/performance.md(profiling, suspension points) - Testing concerns →
references/testing.md(XCTest, Swift Testing)
- Slow async code →
- Understanding threading behavior?
- Read
references/threading.mdfor thread/task relationship and isolation
- Read
- Memory issues with tasks?
- Read
references/memory-management.mdfor retain cycle prevention
- Read
Triage-First Playbook (Common Errors -> Next Best Move)
- SwiftLint concurrency-related warnings
- Use
references/linting.mdfor rule intent and preferred fixes; avoid dummy awaits as “fixes”.
- Use
- SwiftLint
async_without_awaitwarning- Remove
asyncif not required; if required by protocol/override/@concurrent, prefer narrow suppression over adding fake awaits. Seereferences/linting.md.
- Remove
- "Sending value of non-Sendable type ... risks causing data races"
- First: identify where the value crosses an isolation boundary
- Then: use
references/sendable.mdandreferences/threading.md(especially Swift 6.2 behavior changes)
- "Main actor-isolated ... cannot be used from a nonisolated context"
- First: decide if it truly belongs on
@MainActor - Then: use
references/actors.md(global actors,nonisolated, isolated parameters) andreferences/threading.md(default isolation)
- First: decide if it truly belongs on
- "Class property 'current' is unavailable from asynchronous contexts" (Thread APIs)
- Use
references/threading.mdto avoid thread-centric debugging and rely on isolation + Instruments
- Use
- "Actor-isolated type does not conform to protocol" (protocol conformance errors)
- First: determine whether the protocol requirements must execute on the actor (for example, UI work on
@MainActor) or can safely benonisolated. - Then: follow the Quick Fix Playbook entry for actor-isolated protocol conformance and
references/actors.mdfor implementation patterns (isolated conformances,nonisolatedrequirements, and escalation steps).
- First: determine whether the protocol requirements must execute on the actor (for example, UI work on
- XCTest async errors like "wait(...) is unavailable from asynchronous contexts"
- Use
references/testing.md(await fulfillment(of:)and Swift Testing patterns)
- Use
- Core Data concurrency warnings/errors
- Use
references/core-data.md(DAO/NSManagedObjectID, default isolation conflicts)
- Use
Core Patterns Reference
Concurrency Tool Selection
| Need | Tool | Key Guidance |
| Single async operation | async/await | Default choice for sequential async work |
| Fixed parallel operations | async let | Known count at compile time; auto-cancelled on throw |
| Dynamic parallel operations | withTaskGroup | Unknown count; structured — cancels children on scope exit |
| Sync → async bridge | Task { } | Inherits actor context; use Task.detached only with documented reason |
| Shared mutable state | actor | Prefer over locks/queues; keep isolated sections small |
| UI-bound state | @MainActor | Only for truly UI-related code; justify isolation |
Common Scenarios
Network request with UI update
Task { @concurrent in
let data = try await fetchData()
await MainActor.run { self.updateUI(with: data) }
}Processing array items in parallel
await withTaskGroup(of: ProcessedItem.self) { group in
for item in items {
group.addTask { await process(item) }
}
for await result in group {
results.append(result)
}
}Swift 6 Migration Quick Guide
Key changes in Swift 6:
- Strict concurrency checking enabled by default
- Complete data-race safety at compile time
- Sendable requirements enforced on boundaries
- Isolation checking for all async boundaries
Migration Validation Loop
Apply this cycle for each migration change:
- Build — Run
swift buildor Xcode build to surface new diagnostics - Fix — Address one category of error at a time (e.g., all Sendable issues first)
- Rebuild — Confirm the fix compiles cleanly before moving on
- Test — Run the test suite to catch regressions (
swift testor Cmd+U) - Only proceed to the next file/module when all diagnostics are resolved
If a fix introduces new warnings, resolve them before continuing. Never batch multiple unrelated fixes — keep commits small and reviewable.
For detailed migration steps, see references/migration.md.
Reference Files
Load these files as needed for specific topics:
async-await-basics.md- async/await syntax, execution order, async let, URLSession patternstasks.md- Task lifecycle, cancellation, priorities, task groups, structured vs unstructuredthreading.md- Thread/task relationship, suspension points, isolation domains, nonisolatedmemory-management.md- Retain cycles in tasks, memory safety patternsactors.md- Actor isolation, @MainActor, global actors, reentrancy, custom executors, Mutexsendable.md- Sendable conformance, value/reference types, @unchecked, region isolationlinting.md- Concurrency-focused lint rules and SwiftLintasync_without_awaitasync-sequences.md- AsyncSequence, AsyncStream, when to use vs regular async methodscore-data.md- NSManagedObject sendability, custom executors, isolation conflictsperformance.md- Profiling with Instruments, reducing suspension points, execution strategiestesting.md- XCTest async patterns, Swift Testing, concurrency testing utilitiesmigration.md- Swift 6 migration strategy, closure-to-async conversion, @preconcurrency, FRP migration
Verification Checklist (When You Change Concurrency Code)
- Confirm build settings (default isolation, strict concurrency, upcoming features) before interpreting diagnostics.
- Build — Verify the project compiles without new warnings or errors.
- Test — Run tests, especially concurrency-sensitive ones (see
references/testing.md). - Performance — If performance-related, verify with Instruments (see
references/performance.md). - Lifetime — If lifetime-related, verify deinit/cancellation behavior (see
references/memory-management.md). - Check
Task.isCancelledin long-running operations. - Never use semaphores or locks in async contexts — use actors or
Mutexinstead.
Glossary
See references/glossary.md for quick definitions of core concurrency terms used across this skill.
Note: This skill is based on the comprehensive Swift Concurrency Course by Antoine van der Lee.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

