使用方法
- 复制安装命令,在自己的智能体环境安装前先检查源码包。
- 从原始文档核对所需工具、凭据和支持的宿主。
- 说明输入材料与期望交付物,并对照来源检查输出。
npx skills add https://github.com/prisma-labs-dev/apple-skills --skill guide-swift-concurrency开始前需了解
- 安装不包含模型订阅、API 额度或访问文件的权限。
- 仓库星数和安装量反映活跃情况,不等于独立质量或安全测试。
按源仓库内容呈现,保留标题、案例、代码、表格、链接以及原文引用的演示图片。
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 |




