Apple-skills guide-swift-concurrency
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.
install
source · Clone the upstream repo
git clone https://github.com/vabole/apple-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/vabole/apple-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/guide-swift-concurrency" ~/.claude/skills/vabole-apple-skills-guide-swift-concurrency && rm -rf "$T"
manifest:
skills/guide-swift-concurrency/SKILL.mdsource content
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
to fix compiler errors — prefer actors, value types, or@unchecked Sendable
parameters.sending
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 | |
Swift 6.2: default isolation, , , isolated deinit | |
| Actor reentrancy, global actor inference, isolation patterns | |
Task groups, , , concurrency limits | |
vs , when is a code smell | |
Cooperative cancellation, , broken patterns | |
, continuation lifecycle, back-pressure | |
Checked continuations, wrapping delegates, | |
| GCD migration, Combine to AsyncSequence, completion handlers, locks | |
| Common concurrency failure modes LLMs produce and their fixes | |
| Strict-concurrency compiler errors mapped to likely fixes | |
| Async test patterns, race detection, avoiding timing-based tests | |