Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Swift concurrency patterns including Swift 6.2 approachable concurrency, structured concurrency, actors, continuations, and migration. Use when reviewing or building async code, fixing data race errors, or migrating to Swift 6.
.claude/skills/rshankras-concurrency-patterns/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | -3% | 0% |
| case-01 | ✓→✓ | = Same ✓ | 52% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 65% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 53% | 0% |
| case-06 | ✓→✓ | = Same ✓ | 88% | 0% |
Comprehensive guide for Swift concurrency covering async/await, structured concurrency, actors, and the Swift 6.2 "Approachable Concurrency" features. Focuses on patterns that prevent data races and common mistakes that cause crashes.
What concurrency problem are you solving?
│
├─ Swift 6 compiler errors / migration
│ └─ migration-guide.md
│
├─ Swift 6.2 new features (@concurrent, isolated conformances)
│ └─ swift62-concurrency.md
│
├─ Running work in parallel (async let, TaskGroup)
│ └─ structured-concurrency.md
│
├─ Thread safety for shared mutable state
│ └─ actors-and-isolation.md
│
├─ Bridging old APIs (delegates, callbacks) to async/await
│ └─ continuations-bridging.md
│
├─ Hangs, slow parallelism, thread-pool problems, profiling
│ └─ concurrency-internals.md
│
└─ General async/await patterns
└─ See macos/coding-best-practices/modern-concurrency.md for basics| Pattern | When to Use | Reference | |---------|-------------|-----------| | async let | Fixed number of parallel operations | structured-concurrency.md | | withTaskGroup | Dynamic number of parallel operations | structured-concurrency.md | | withDiscardingTaskGroup | Fire-and-forget parallel operations | structured-concurrency.md | | .task { } modifier | Load data when view appears | structured-concurrency.md | | .task(id:) modifier | Re-load when a value changes | structured-concurrency.md | | actor | Shared mutable state protection | actors-and-isolation.md | | @MainActor | UI-bound state and updates | actors-and-isolation.md | | @concurrent | Explicitly offload to background (6.2) | swift62-concurrency.md | | Isolated conformances | @MainActor type conforming to protocol (6.2) | swift62-concurrency.md | | withCheckedContinuation | Bridge callback API to async | continuations-bridging.md | | AsyncStream | Bridge delegate/notification API to async sequence | continuations-bridging.md | | @TaskLocal | Context (IDs, tracing) down the task tree | structured-concurrency.md | | Atomic / Mutex | Sendable wrappers for synchronous hot paths (Swift 6) | actors-and-isolation.md | | Custom actor executors | Bridge existing DispatchSerialQueue synchronization | concurrency-internals.md | | Swift Concurrency Instrument | Diagnose hangs, actor contention, continuation leaks | concurrency-internals.md | | Strict concurrency migration | Incremental Swift 6 adoption | migration-guide.md |
Read the user's code or error messages to determine:
Based on the problem, read from this directory:
swift62-concurrency.md — Swift 6.2 approachable concurrency features, Apple's adoption doctrine, Swift 6.3/6.4 additionsstructured-concurrency.md — async let, TaskGroup, .task modifier lifecycle, task-locals, cancellation semanticsactors-and-isolation.md — Actor patterns, reentrancy, @MainActor, Sendable, Atomic/Mutexconcurrency-internals.md — cooperative pool, unsafe primitives, actor scheduling, Swift Concurrency Instrumentcontinuations-bridging.md — withCheckedContinuation, AsyncStream, built-in async sequences, legacy bridgingmigration-guide.md — Incremental Swift 6 strict concurrency adoption (WWDC24 doctrine)@MainActor (use await for long operations)Sendable conformance correct for types crossing isolation boundariesTask.isCancelled or Task.checkCancellation())Task {} where structured concurrency (.task, TaskGroup) would workwithCheckedContinuation called exactly once (not zero, not twice).task(id:) used instead of manual onChange + cancel patternsmacos/coding-best-practices/modern-concurrency.mdgenerators/networking-layer/networking-patterns.mdmacos/swiftdata-architecture/repository-pattern.mdgenerators/auth-flow/auth-patterns.md~/Downloads/docs/Swift-Concurrency-Updates.md — read if present; skip silently if absent.| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | pass→pass | 8,263 | 5,046 | -39% | 1 | 1 | 0% | 1,496 | 2,271 | +52% | 0 | 0 | — |
case-02 | fail→pass | 15,037 | 5,639 | -62% | 1 | 1 | 0% | 2,502 | 2,419 | -3% | 0 | 0 | — |
case-03 | pass→pass | 8,842 | 4,960 | -44% | 1 | 1 | 0% | 1,404 | 2,315 | +65% | 0 | 0 | — |
case-04 | pass→pass | 9,781 | 8,518 | -13% | 1 | 1 | 0% | 1,877 | 2,874 | +53% | 0 | 0 | — |
case-05 | fail→fail | 8,410 | 5,531 | -34% | 1 | 1 | 0% | 1,459 | 2,433 | +67% | 0 | 0 | — |
case-06 | pass→pass | 6,417 | 3,333 | -48% | 1 | 1 | 0% | 1,110 | 2,086 | +88% | 0 | 0 | — |
case-07 | pass→pass | 9,806 | 4,880 | -50% | 1 | 1 | 0% | 1,576 | 2,116 | +34% | 0 | 0 | — |
case-08 | pass→pass | 10,716 | 5,057 | -53% | 1 | 1 | 0% | 1,824 | 2,270 | +24% | 0 | 0 | — |
case-09 | pass→pass | 7,822 | 5,401 | -31% | 1 | 1 | 0% | 1,354 | 2,334 | +72% | 0 | 0 | — |
case-10 | pass→pass | 10,033 | 7,268 | -28% | 1 | 1 | 0% | 1,772 | 2,673 | +51% | 0 | 0 | — |
case-11 | pass→pass | 6,716 | 5,656 | -16% | 1 | 1 | 0% | 1,098 | 2,362 | +115% | 0 | 0 | — |
case-12 | pass→pass | 8,338 | 4,880 | -41% | 1 | 1 | 0% | 1,366 | 2,174 | +59% | 0 | 0 | — |
case-13 | pass→pass | 10,511 | 9,504 | -10% | 1 | 1 | 0% | 1,801 | 2,867 | +59% | 0 | 0 | — |
case-14 | pass→pass | 5,751 | 5,987 | +4% | 1 | 1 | 0% | 1,004 | 1,963 | +96% | 0 | 0 | — |
case-15 | pass→pass | 17,651 | 16,648 | -6% | 1 | 1 | 0% | 3,005 | 4,201 | +40% | 0 | 0 | — |
case-16 | pass→pass | 8,906 | 8,124 | -9% | 1 | 1 | 0% | 1,628 | 2,893 | +78% | 0 | 0 | — |
case-17 | pass→pass | 8,615 | 5,577 | -35% | 1 | 1 | 0% | 1,508 | 2,422 | +61% | 0 | 0 | — |
case-18 | pass→pass | 7,493 | 5,790 | -23% | 1 | 1 | 0% | 1,221 | 2,368 | +94% | 0 | 0 | — |
case-19 | pass→pass | 5,377 | 4,047 | -25% | 1 | 1 | 0% | 855 | 2,059 | +141% | 0 | 0 | — |
case-20 | pass→pass | 4,494 | 4,425 | -2% | 1 | 1 | 0% | 676 | 2,117 | +213% | 0 | 0 | — |
case-21 | pass→pass | 8,838 | 6,809 | -23% | 1 | 1 | 0% | 1,478 | 2,506 | +70% | 0 | 0 | — |
case-22 | pass→pass | 19,395 | 22,112 | +14% | 1 | 1 | 0% | 4,212 | 6,025 | +43% | 0 | 0 | — |
case-23 | pass→pass | 15,276 | 21,058 | +38% | 1 | 1 | 0% | 3,512 | 6,237 | +78% | 0 | 0 | — |
case-24 | pass→pass | 14,466 | 13,008 | -10% | 1 | 1 | 0% | 2,693 | 4,030 | +50% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 24 cases were attempted. The headline lift of +4 percentage points is the difference between those two pass rates over the 24 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.