‹ 首页

swift-concurrency

@notque · 收录于 1 周前

Swift concurrency: async/await, Actor, Task, Sendable patterns.

适合你,如果正在用 Swift 开发并发应用

/ 下载安装
swift-concurrency.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add notque/vexjoy-agent/swift-concurrency
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- notque/vexjoy-agent/swift-concurrency
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify notque/vexjoy-agent/swift-concurrency
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
407GitHub stars
待重算上下文体积
镜像托管

怎么用

技能原文 SKILL.md作者撰写 · MIT · f27fa0e

Swift Structured Concurrency

Pattern catalog for Swift's structured concurrency model: async/await, Actors, TaskGroups, AsyncSequence, Sendable, and cancellation. Load the reference file matching the developer's question.

Reference Loading Table

| Signal | Reference File | Content | |--------|---------------|---------| | async/await, Task, Sendable | references/fundamentals.md | async/await patterns, Task/Task.detached, Sendable/@Sendable | | Actor, @MainActor, nonisolated | references/actor-isolation.md | Actor isolation, MainActor UI confinement, nonisolated opt-out | | TaskGroup, AsyncSequence, AsyncStream, cancellation | references/task-patterns.md | Structured concurrency, rate-limited groups, streams, cancellation | | Failure modes, common mistakes | references/preferred-patterns.md | Blocking MainActor, task leaking, actor reentrancy hazard |

Key Conventions
  • Prefer structured concurrency -- use TaskGroup over loose Task { } whenever possible; structured tasks propagate cancellation and errors automatically.
  • Mark types Sendable -- enable strict concurrency checking (-strict-concurrency=complete) and resolve all warnings before they become errors in Swift 6.
  • Use actors for shared mutable state -- avoid manual locks; actors provide compiler-verified safety.
  • Cancel what you create -- every Task stored in a property should have a corresponding cancellation path.
  • Minimize @MainActor surface -- isolate only the UI layer; keep business logic and networking off the main actor.
References
  • references/fundamentals.md -- async/await, Task, Sendable basics
  • references/actor-isolation.md -- Actor, @MainActor, nonisolated
  • references/task-patterns.md -- TaskGroup, AsyncSequence, AsyncStream, cancellation
  • references/preferred-patterns.md -- blocking, leaking, reentrancy mistakes
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。