Community编程与开发github.com

steipete/swift-concurrency-expert

审查并修复 Swift 并发问题:编译器错误、Sendable、隔离性及修复方案。

swift-concurrency-expert 是什么?

此技能专为需要处理 Swift 6.2+ 代码库中并发问题的开发者设计。它的核心能力是自动审查并修复与 Actor 隔离、Sendable 安全性以及现代并发模式相关的编译器错误和警告。技能会优先选择对现有行为影响最小的安全修复方案,例如为 UI 绑定类型添加 `@MainActor`、为主 Actor 类型的协议遵循添加隔离声明、用 Actor 保护全局或静态状态,以及通过 `@unchecked Sendable` 来证明线程安全。它适用于 Claude Code、Cursor 和 Codex 等 AI 代理平台,通过在 SKILL.md 文件中定义的严格工作流程来工作:先收集确切的编译器诊断信息和当前的 Actor 上下文,然后应用最小的安全修复。这意味着开发者只需提供代码和编译器错误,AI 代理就能自动分析并应用修复,从而显著提升开发效率并减少并发相关的运行时崩溃。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/steipete/agent-scripts/tree/main/skills/swift-concurrency-expert

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Swift 并发专家

属性:来源于 @Dimillian 的 Dimillian/Skills(2025-12-31)。

概述

审查并修复 Swift 6.2+ 代码库中的 Swift 并发问题,通过应用 Actor 隔离、Sendable 安全性和现代并发模式,并保持最小行为变更。

工作流程

1. 对问题进行分流

  • 捕获确切的编译器诊断信息和有问题的符号。
  • 识别当前的 Actor 上下文(@MainActor、actor、nonisolated)以及是否启用了默认的 Actor 隔离模式。
  • 确认代码是 UI 绑定的,还是打算在主 Actor 之外运行。

2. 应用最小的安全修复

优先选择能够保留现有行为同时满足数据竞争安全性的编辑。

常见修复:

  • UI 绑定类型:用 @MainActor 标注该类型或相关成员。
  • 主 Actor 类型上的协议遵循:使遵循隔离化(例如 extension Foo: @MainActor SomeProtocol)。
  • 全局/静态状态:使用 @MainActor 保护,或移入一个 Actor。
  • 后台工作:将耗时工作移入 nonisolated 类型上的 @concurrent 异步函数,或使用 actor 保护可变状态。
  • Sendable 错误:首选不可变/值类型;仅在正确时添加 Sendable 遵循;除非你能证明线程安全,否则避免使用 @unchecked Sendable。

参考资料

  • 有关 Swift 6.2 的变更、模式和示例,请参见 references/swift-6-2-concurrency.md。
  • 有关 SwiftUI 特定的并发指导,请参见 references/swiftui-concurrency-tour-wwdc.md。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

steipete/agent-transcript

GitHub PR/issue agent transcripts: redact, preview, and insert safely.

steipete/beeper

Beeper cache: contact hints, room lookup, WhatsApp/iMessage traces, FTS.

steipete/browser-use

Existing Chrome automation: Chrome plugin first, mcporter fallback.

steipete/clawsweeper-status

ClawSweeper status: URLs, workflow health, active workers, ops snapshot.

steipete/clickclack

ClickClack ops: chat app, Hetzner deploy, DNS/docs/app, Docker rollout.

steipete/cloudflare-registrar

Cloudflare Registrar: domain availability, prices, registration via mcporter.

steipete/codex-debugging

Codex debugging: codex-rs core/tui/exec/cli/app-server/config.

steipete/create-cli

CLI UX/spec: args, flags, help, output, errors, config, dry-run.

steipete/discord-clawd

Discord-backed OpenClaw agent/session relay; not archive search.

steipete/domain-dns-ops

DNS/domain ops: registrars, zones, redirects, DNS/HTTP verify, manager truth.

steipete/frontend-design

Frontend UI: pages, apps, components, polished non-generic design.

steipete/github-author-context

GitHub contributor context: identity, activity, trust, company/team signal.

steipete/github-cache-hygiene

GitHub quota/cache hygiene: gh, ghx, xcache, gitcrawl, mirrors, limits.

steipete/github-deep-review

GitHub deep review: bugs, PRs, best fix, stale-or-real, read code first.

steipete/github-project-triage

GitHub issue/PR triage: queues, CI, blockers, risk, proof, next actions.

steipete/hopper-debugger

Hopper debugging: macOS/iOS binaries, ObjC/Swift symbols, dyld, LLDB.

steipete/instruments-profiling

Instruments/xctrace profiling: macOS/iOS traces, binaries, args, exports.

steipete/mac-maintenance

Mac upkeep: brew update/upgrade, pull clean repos, empty Trash.

steipete/maintainer-orchestrator

Open-source maintainer orchestration: Codex app workers, work recovery, dependencies, vision, releases.

steipete/markdown-converter

Markdown conversion: PDF, Office, HTML, data, OCR, audio, ZIP, YouTube.

相关技能