数据库迁移
- 作者仓库星标 977
- 叉子 74
- 许可证 MIT
- 作者更新于 2026年6月15日 03:09
- 作者仓库 Axiom
- 领域
- 文档
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 94 / 100 · 已通过审计
- 作者 / 版本 / 许可
- @CharlesWiltgen · MIT
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 底层运行要求
- 无特殊要求
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 网络行为
- 仅限本地
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: axiom-concurrency
description: Use when writing ANY async code, actors, threads, or seeing ANY concurrency error. Covers Swift…
category: 文档
runtime: 无特殊运行时
---
# axiom-concurrency 输出预览
## PART A: 任务判断
- 适用问题:PRD、RFC、README、项目说明或知识库整理。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“Quick Reference / Decision Tree / Conflict Resolution”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于PRD、RFC、README、项目说明或知识库整理,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“Quick Reference / Decision Tree / Conflict Resolution”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、执行终端命令、主要在本地完成、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、执行终端命令;主要在本地完成;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文出现了 `/axiom` 这类斜杠命令;如果你的 Agent 支持命令触发,优先用命令开场,再补充目标和边界。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、执行终端命令。
先用一个小任务确认它会围绕“Quick Reference / Decision Tree / Conflict Resolution”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: axiom-concurrency
description: Use when writing ANY async code, actors, threads, or seeing ANY concurrency error. Covers Swift…
category: 文档
source: CharlesWiltgen/Axiom
---
# axiom-concurrency
## 什么时候使用
- 并发错误和 Swift 6 迁移常因隔离规则难定位 适合处理README、PRD、RFC、教程和知识库文档,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查、可继续迭代的步骤…
- 面向PRD、RFC、README、项目说明或知识库整理,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「Quick Reference / Decision Tree / Conflict Resolution」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、执行终端命令;主要在本地完成;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "axiom-concurrency" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> Quick Reference / Decision Tree / Conflict Resolution
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> 无特殊运行时 | 读取文件、写入/修改文件、执行终端命令 | 主要在本地完成
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} Concurrency
You MUST use this skill for ANY concurrency, async/await, threading, or Swift 6 concurrency work.
Quick Reference
| Symptom / Task | Reference |
|---|---|
| async/await patterns, @MainActor, actors | See skills/swift-concurrency.md |
| Data race errors, Sendable conformance | See skills/swift-concurrency.md |
| Swift 6 migration, @concurrent attribute | See skills/swift-concurrency.md |
| Actor definition, reentrancy, global actors | See skills/swift-concurrency-ref.md |
| Task/TaskGroup/cancellation API | See skills/swift-concurrency-ref.md |
| AsyncStream, continuations | See skills/swift-concurrency-ref.md |
| DispatchQueue → actor migration | See skills/swift-concurrency-ref.md |
| Mutex (iOS 18+), OSAllocatedUnfairLock | See skills/synchronization.md |
| Atomic types, lock vs actor decision | See skills/synchronization.md |
| MainActor.assumeIsolated | See skills/assume-isolated.md |
| @preconcurrency protocol conformances | See skills/assume-isolated.md |
| Legacy delegate callbacks | See skills/assume-isolated.md |
Warning-free build crashes with _dispatch_assert_queue_fail |
See skills/isolation-inheritance-diag.md |
Crash signature _swift_task_checkIsolatedSwift |
See skills/isolation-inheritance-diag.md |
Core Data context.perform runtime crash inside @MainActor class |
See skills/isolation-inheritance-diag.md |
Combine .map/.sink crash from receive(on:) placement |
See skills/isolation-inheritance-diag.md |
| Delegate method crash from isolation inheritance (CLLocationManager, NSDocument, AVAudioPlayerDelegate, WKNavigationDelegate) | See skills/isolation-inheritance-diag.md |
| Actor reentrancy / stale state across await | See skills/isolation-inheritance-diag.md |
| Swift Concurrency Instruments template | See skills/concurrency-profiling.md |
| Actor contention diagnosis | See skills/concurrency-profiling.md |
| Thread pool exhaustion | See skills/concurrency-profiling.md |
Decision Tree
digraph concurrency {
start [label="Concurrency task" shape=ellipse];
what [label="What do you need?" shape=diamond];
start -> what;
what -> "skills/swift-concurrency.md" [label="async/await, actors,\nSendable, data races,\nSwift 6 migration"];
what -> "skills/swift-concurrency-ref.md" [label="API syntax lookup\n(TaskGroup, AsyncStream,\ncontinuations, migration)"];
what -> "skills/synchronization.md" [label="Mutex, locks,\natomic types"];
what -> "skills/assume-isolated.md" [label="assumeIsolated,\n@preconcurrency"];
what -> "skills/isolation-inheritance-diag.md" [label="warning-free build crashes\n_dispatch_assert_queue_fail\n_swift_task_checkIsolatedSwift"];
what -> "skills/concurrency-profiling.md" [label="profile async perf,\nactor contention"];
}
- Data races / actor isolation / @MainActor / Sendable / Swift 6 migration? →
skills/swift-concurrency.md1a. Need specific API syntax (actor definition, TaskGroup, AsyncStream, continuations)? →skills/swift-concurrency-ref.md - Writing async/await code? →
skills/swift-concurrency.md - assumeIsolated / @preconcurrency? →
skills/assume-isolated.md3a. Warning-free Swift 6 build that crashes in production with_dispatch_assert_queue_failor_swift_task_checkIsolatedSwift? →skills/isolation-inheritance-diag.md - Mutex / lock / synchronization? →
skills/synchronization.md - Profile async performance / actor contention? →
skills/concurrency-profiling.md - Value type / ARC / generic optimization? → See axiom-performance (skills/swift-performance.md)
- borrowing / consuming / ~Copyable? → See axiom-swift (skills/ownership-conventions.md)
- Combine / @Published / AnyCancellable / reactive streams? → See axiom-uikit (skills/combine-patterns.md)
- Want automated concurrency scan? → concurrency-auditor (Agent)
Concurrency in practice
- HealthKit queries with Swift Concurrency (canonical bridging example) → See axiom-health (skills/queries.md)
Conflict Resolution
concurrency vs axiom-performance: When app freezes or feels slow:
- Try concurrency FIRST — Main thread blocking is the #1 cause of UI freezes. Check for synchronous work on @MainActor before profiling.
- Only use axiom-performance if concurrency fixes don't help — Profile after ruling out obvious blocking.
- To pin a specific freeze to app code, see the Hang Window Workflow in axiom-performance (skills/hang-diagnostics.md) — re-scope
xcprof analyzeto the hang window with--start-ms/--end-ms --user-binaryto surface the app-owned frame on the main thread.
concurrency vs axiom-build: When seeing Swift 6 concurrency errors:
- Use concurrency, NOT axiom-build — Concurrency errors are CODE issues, not environment issues.
concurrency vs axiom-data: When concurrency errors involve Core Data or SwiftData:
- Core Data threading (NSManagedObjectContext thread confinement) → use axiom-data first
- SwiftData + @MainActor ModelContext → use concurrency
- General "background saves losing data" → use axiom-data first
- GRDB Sendable patterns (struct records,
databaseSelectionas computed property, Swift 6 conformance) → See axiom-data (skills/grdb-performance.md) §8
Critical Patterns
Swift Concurrency (skills/swift-concurrency.md):
- Progressive journey: single-threaded → async → concurrent → actors
- @concurrent attribute for forced background execution
- Isolated conformances, main actor mode
- 12 copy-paste patterns including delegate value capture, weak self in Tasks
- Comprehensive decision tree for 7 common error messages
API Reference (skills/swift-concurrency-ref.md):
- Actor definition, reentrancy, global actors, nonisolated
- Sendable patterns, @unchecked Sendable, sending parameter
- Task/TaskGroup/cancellation, async let, withDiscardingTaskGroup
- AsyncStream, continuations, buffering policies
- Isolation patterns (#isolation, @preconcurrency, nonisolated(unsafe))
- DispatchQueue/DispatchGroup/completion handler migration
Synchronization (skills/synchronization.md):
- Mutex (iOS 18+), OSAllocatedUnfairLock (iOS 16+), Atomic types
- Lock vs actor decision tree
- Danger patterns: locks across await, semaphores in async context
Profiling (skills/concurrency-profiling.md):
- Swift Concurrency Instruments template
- Diagnosing main thread blocking, actor contention, thread pool exhaustion
- Safe vs unsafe primitives for cooperative pool
Runtime Isolation Crashes (skills/isolation-inheritance-diag.md):
_dispatch_assert_queue_failand_swift_task_checkIsolatedSwiftsignatures- Closure isolation inheritance (Core Data
perform, Combine.map, NotificationCenter.sink) - Delegate method isolation inheritance (CLLocationManager, NSDocument, AVAudioPlayerDelegate, WKNavigationDelegate)
MainActor.assumeIsolatedmisuse- Actor reentrancy state staleness
Automated Scanning
Concurrency audit → Launch concurrency-auditor agent or /axiom:audit concurrency (5-phase semantic audit: maps isolation architecture, detects 8 anti-patterns, reasons about missing concurrency patterns, correlates compound risks, scores Swift 6.4 readiness)
Anti-Rationalization
| Thought | Reality |
|---|---|
| "Just add @MainActor and it'll work" | @MainActor has isolation inheritance rules. skills/swift-concurrency.md covers all patterns. |
| "I'll use nonisolated(unsafe) to silence the warning" | Silencing warnings hides data races. skills/swift-concurrency.md shows the safe pattern. |
| "It's just one async call" | Even single async calls have cancellation and isolation implications. |
| "I know how actors work" | Actor reentrancy and isolation rules changed in Swift 6.2. |
| "I'll fix the Sendable warnings later" | Sendable violations cause runtime crashes. Fix them now. |
| "My Swift 6 build has zero warnings, so isolation is correct" | Static checking can't see SDK callbacks. Runtime checks crash anyway. skills/isolation-inheritance-diag.md. |
"I'll wrap the crash in MainActor.assumeIsolated" |
assumeIsolated is a runtime trap, not a silencer. Wrong assumption = crash. |
| "Combine is dead, just use async/await" | Combine has no deprecation notice. Rewriting working pipelines wastes time. See See axiom-uikit (skills/combine-patterns.md). |
| "I'll use @unchecked Sendable to silence this" | You're hiding a data race from the compiler. It will crash in production. |
| "This async function runs on a background thread" | async suspends without blocking but resumes on the same actor. Use @concurrent to force background. |
Example Invocations
User: "I'm getting 'data race' errors in Swift 6"
→ Read: skills/swift-concurrency.md
User: "How do I use @MainActor correctly?"
→ Read: skills/swift-concurrency.md
User: "How do I create a TaskGroup?"
→ Read: skills/swift-concurrency-ref.md
User: "What's the AsyncStream API?"
→ Read: skills/swift-concurrency-ref.md
User: "How do I use assumeIsolated?"
→ Read: skills/assume-isolated.md
User: "Should I use Mutex or actor?"
→ Read: skills/synchronization.md
User: "My async code is slow, how do I profile it?"
→ Read: skills/concurrency-profiling.md
User: "My warning-free Swift 6 build crashes in production with _dispatch_assert_queue_fail"
→ Read: skills/isolation-inheritance-diag.md
User: "Core Data context.perform crashes inside an @MainActor view model"
→ Read: skills/isolation-inheritance-diag.md
User: "CLLocationManager delegate method is crashing with _swift_task_checkIsolatedSwift"
→ Read: skills/isolation-inheritance-diag.md
User: "My app is slow due to unnecessary copying" → See axiom-performance (skills/swift-performance.md)
User: "Check my code for Swift 6 concurrency issues"
→ Invoke: concurrency-auditor agent
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核