| name | swift-concurrency |
| description | Implement or audit Swift 6.2 concurrency, MainActor default isolation, @concurrent work, Sendable dependencies, task ownership, cancellation, clocks, and race-free UI updates. |
| license | MIT |
| metadata | {"version":"1.0","provenance":"Adapted from twostraws Swift guidance and project-specific Swift 6 policy; see NOTICE.md."} |
Swift concurrency
Read Package.swift and references/concurrency-checklist.md. Every target uses Swift 6 language mode with MainActor default isolation, InferIsolatedConformances, and NonisolatedNonsendingByDefault. Use this skill for every asynchronous service, observable model, stream, task group, actor, sendability, nonisolated, or @concurrent change.
Workflow
- Identify mutable state and assign one isolation domain.
- Keep UI-facing state on
@MainActor.
- Make dependency protocols and cross-task values
Sendable.
- Prefer structured
async functions and task groups to callbacks or detached work.
- Define which scope owns each
Task and when cancellation occurs.
- Propagate cancellation; do not convert it into a user-facing failure accidentally.
- Prevent stale responses from overwriting newer state.
- Inject clocks or continuations for deterministic tests instead of sleeping.