guide-swift-concurrency
Skill336 starsChanged 7 months agoMITView on GitHub
Swift concurrency patterns — actors, structured concurrency, cancellation, async streams, GCD migration, strict-concurrency diagnostics, common bug patterns. Use when writing, reviewing, or debugging concurrent Swift code.
In this repository29 other files it gives its agents.
- AGENTS.mdAGENTS.md
- apple-asoSkill
- apple-docs-indexSkill
- backgroundtasksSkill
- combineSkill
- core-animationSkill
- corehapticsSkill
- eventkitSkill
- guide-macos-spm-packagingSkill
- guide-swiftdataSkill
- guide-swift-testingSkill
- guide-swiftui-chartsSkill
- guide-swiftui-performance-auditSkill
- healthkitSkill
- higSkill
- ios-devSkill
- ios-liquid-glassSkill
- mapkitSkill
- photosuiSkill
- storekitSkill
- swift-concurrencySkill
- swiftdataSkill
- swift-testingSkill
- swiftuiSkill
- tipkitSkill
- uikitSkill
- usernotificationsSkill
- widgetkitSkill
- xcuitestSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 2 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 19
Prefer structured concurrency (task groups) over unstructured (Task {}).
- Distinctive: line 20
Prefer Swift concurrency over GCD for new code.
- Very specific: line 21
Do not suggest @unchecked Sendable to fix compiler errors — prefer actors, value types, or sending parameters.
- Very specific: line 26
Check for Swift 6.2 concurrency behavior using references/new-features.md.
- Very specific: line 28
Ensure structured concurrency is preferred using references/structured.md.
- Very specific: line 29
Check unstructured task usage using references/unstructured.md.
- Very specific: line 30
Verify cancellation handling using references/cancellation.md.
- Very specific: line 32
Check bridging code between sync and async using references/bridging.md.
- Very specific: line 35
If strict-concurrency errors exist, map diagnostics to fixes using references/diagnostics.md.
- Very specific: line 36
If reviewing tests, check async test patterns using references/testing.md.
- Distinctive: line 38
If doing partial work, load only the relevant reference files.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Guide Skill — This is an expert workflow/pattern guide, not API reference documentation. Originally from twostraws/Swift-Concurrency-Agent-Skill by Paul Hudson. MIT License.
Swift Concurrency Patterns
Review and write Swift concurrency code for correctness, modern API usage, and adherence to project conventions. Report only genuine problems — do not nitpick or invent issues.
Core Instructions
- Target Swift 6.2 or later with strict concurrency checking.
- Prefer structured concurrency (task groups) over unstructured (
Task {}). - Prefer Swift concurrency over GCD for new code. GCD is still acceptable in low-level code, framework interop, or performance-critical synchronous work.
- Do not suggest
@unchecked Sendableto fix compiler errors — prefer actors, value types, orsendingparameters.
Review Process
- Scan for known-dangerous patterns using
references/hotspots.md. - Check for Swift 6.2 concurrency behavior using
references/new-features.md. - Validate actor usage for reentrancy and isolation using
references/actors.md. - Ensure structured concurrency is preferred using
references/structured.md. - Check unstructured task usage using
references/unstructured.md. - Verify cancellation handling using
references/cancellation.md. - Validate async stream and continuation usage using
references/async-streams.md. - Check bridging code between sync and async using
references/bridging.md. - Review legacy concurrency migrations using
references/interop.md. - Cross-check against common failure modes using
references/bug-patterns.md. - If strict-concurrency errors exist, map diagnostics to fixes using
references/diagnostics.md. - If reviewing tests, check async test patterns using
references/testing.md.
If doing partial work, load only the relevant reference files.
References
| Topic | Reference |
| Grep targets for code review — known-dangerous patterns | references/hotspots.md |
Swift 6.2: default isolation, @concurrent, Task.immediate, isolated deinit | references/new-features.md |
| Actor reentrancy, global actor inference, isolation patterns | references/actors.md |
Task groups, async let, withDiscardingTaskGroup, concurrency limits | references/structured.md |
Task vs Task.detached, when Task {} is a code smell | references/unstructured.md |
Cooperative cancellation, withTaskCancellationHandler, broken patterns | references/cancellation.md |
AsyncStream.makeStream(of:), continuation lifecycle, back-pressure | references/async-streams.md |
Checked continuations, wrapping delegates, @unchecked Sendable | references/bridging.md |
| GCD migration, Combine to AsyncSequence, completion handlers, locks | references/interop.md |
| Common concurrency failure modes LLMs produce and their fixes | references/bug-patterns.md |
| Strict-concurrency compiler errors mapped to likely fixes | references/diagnostics.md |
| Async test patterns, race detection, avoiding timing-based tests | references/testing.md |
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.

