К основному содержанию
скилл CX Codex

axiom-concurrency — скилл для Claude Code: Swift 6 и async/await

Скилл для работы с конкурентностью в приложениях на платформах Apple: акторы, @MainActor, Sendable, гонки данных.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add CharlesWiltgen/Axiom --skill axiom-concurrency -a claude-code
Открыть на GitHub

Что делает axiom-concurrency

Скилл включается, когда вы пишете асинхронный код, акторы или потоки в приложении под Apple-платформы, либо когда сборка ругается на конкурентность. Внутри — разбор Swift 6 concurrency, @MainActor, Sendable, гонок данных и паттернов async/await.

Устроен как роутер: по симптому или задаче он отправляет к нужному справочнику. Для async/await, акторов и миграции на Swift 6 — skills/swift-concurrency.md. Для синтаксиса API (TaskGroup, AsyncStream, continuations) — skills/swift-concurrency-ref.md. Для мьютексов и атомиков — skills/synchronization.md. Отдельная ветка — диагностика падений без предупреждений: _dispatch_assert_queue_fail, _swift_task_checkIsolatedSwift, краши Core Data context.perform внутри @MainActor класса.

Есть раздел про конфликты с другими скиллами. Если приложение подвисает, сначала проверяйте конкурентность: блокировка главного потока — частая причина фризов. Ошибки Swift 6 — это проблема кода, а не окружения, поэтому axiom-build тут не поможет. С Core Data и SwiftData сложнее: тред-конфайнмент NSManagedObjectContext уходит в axiom-data, а @MainActor ModelContext — сюда. На Codex аудиторы вызываются как скиллы, а не как агенты Claude; те, что запускают сборки, тесты и симуляторы, требуют доступа к shell.

Какие задачи решает

  • разобрать ошибку гонки данных в Swift 6
  • перевести DispatchQueue на акторы
  • найти причину краша _dispatch_assert_queue_fail
  • выбрать между мьютексом и актором
  • разобрать устаревшее состояние после await

Примеры запросов агенту

  • помоги разобраться с ошибкой Sendable в моём коде
  • переведи этот класс с DispatchQueue на актор
  • почему падает _swift_task_checkIsolatedSwift без предупреждений при сборке

Как установить axiom-concurrency

1Через Skills CLI (Vercel)

npx skills add CharlesWiltgen/Axiom --skill axiom-concurrency -a claude-code

2Вручную: положить файлы

~/.claude/skills/axiom-concurrency/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/axiom-concurrency/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о axiom-concurrency

Как установить axiom-concurrency в Claude?

Выполните npx skills add CharlesWiltgen/Axiom --skill axiom-concurrency -a claude-code. Скилл появится по пути ~/.claude/skills/axiom-concurrency/SKILL.md.

Что делает axiom-concurrency?

Помогает писать и чинить асинхронный код в приложениях под Apple-платформы: акторы, @MainActor, Sendable, async/await, миграция на Swift 6. По симптому или задаче направляет к нужному справочнику внутри скилла.

С какими скиллами axiom-concurrency пересекается?

С axiom-performance, axiom-build, axiom-data, axiom-swift и axiom-uikit. Для фризов сначала проверяйте конкурентность, ошибки Swift 6 остаются здесь, а тред-конфайнмент Core Data уходит в axiom-data.

Исходный текст

SKILL.md · MIT
---
name: axiom-concurrency
description: Use when writing ANY async code, actors, or threads in an Apple-platform app, or seeing ANY concurrency error. Covers Swift 6 concurrency, @MainActor, Sendable, data races, async/await patterns.
license: MIT
---

# Concurrency

**You MUST use this skill for ANY concurrency, async/await, threading, or Swift 6 concurrency work.**

**Bundled tools on Claude Code:** if `command -v <tool>` finds nothing (hooks off or `--bare`), use `<plugin-root>/tools/<tool>` in place of the bare name; `<plugin-root>` is two levels above this skill's `Base directory for this skill:` path.

<!-- AXIOM_AUDITOR_INLINE_BEGIN — rewritten for Codex by scripts/build-codex.ts; do not hand-edit -->
> **Auditors are skills here.** Where this router says "Launch `some-auditor` agent", invoke the
> matching Codex skill instead — same procedure, no Claude Code agent required.
>
> Available: `axiom-audit-concurrency`.
>
> The ones that shell out — builds, tests, simulators, crash symbolication — need shell access to run.
<!-- AXIOM_AUDITOR_INLINE_END -->

## 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, PHPhotoLibraryChangeObserver) | See `skills/isolation-inheritance-diag.md` |
| PhotoKit `performChanges` block traps on PhotoKit's queue | 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

```dot
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"];
}
```

1. Data races / actor isolation / @MainActor / Sendable / Swift 6 migration? → `skills/swift-concurrency.md`
1a. Need specific API syntax (actor definition, TaskGroup, AsyncStream, continuations)? → `skills/swift-concurrency-ref.md`
1b. NotificationCenter observer, `userInfo` casting, or Sendable errors unpacking a notification? → `skills/swift-concurrency-ref.md` (Typed Notifications — `MainActorMessage`/`AsyncMessage`, iOS 26+)
2. Writing async/await code? → `skills/swift-concurrency.md`
3. assumeIsolated / @preconcurrency? → `skills/assume-isolated.md`
3a. Warning-free Swift 6 build that crashes in production with `_dispatch_assert_queue_fail` or `_swift_task_checkIsolatedSwift`? → `skills/isolation-inheritance-diag.md`
4. Mutex / lock / synchronization? → `skills/synchronization.md`
5. Profile async performance / actor contention? → `skills/concurrency-profiling.md`
6. Value type / ARC / generic optimization? → See axiom-performance (skills/swift-performance.md)
7. borrowing / consuming / ~Copyable? → See axiom-swift (skills/ownership-conventions.md)
8. Combine / @Published / AnyCancellable / reactive streams? → See axiom-uikit (skills/combine-patterns.md)
9. 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:
1. **Try concurrency FIRST** — Main thread blocking is the #1 cause of UI freezes. Check for synchronous work on @MainActor before profiling.
2. **Only use axiom-performance** if concurrency fixes don't help — Profile after ruling out obvious blocking.
3. **To pin a specific freeze to app code**, see the Hang Window Workflow in axiom-performance (skills/hang-diagnostics.md) — re-scope `xcprof analyze` to the hang window with `--start-ms/--end-ms --user-binary` to 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, `databaseSelection` as 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_fail` and `_swift_task_checkIsolatedSwift` signatures
- Closure isolation inheritance (Core Data `perform`, Combine `.map`, NotificationCenter `.sink`)
- Delegate method isolation inheritance (CLLocationManager, NSDocument, AVAudioPlayerDelegate, WKNavigationDelegate)
- `MainActor.assumeIsolated` misuse
- Actor reentrancy state staleness

## Automated Scanning

**Concurrency audit** → `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" | Check its isolation, don't assume. A `@MainActor` async function runs entirely on the main actor, and `nonisolated async` runs on the caller's actor under `NonisolatedNonsendingByDefault` (Swift 6.2+; new Xcode projects set `SWIFT_APPROACHABLE_CONCURRENCY = YES`, the setting's own default is NO, and SwiftPM does not enable it) — those are the main-thread freezes. Without that setting `nonisolated async` hops to the global executor. `@concurrent` forces off-actor work either way. |

## 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

© CharlesWiltgen · MIT · CharlesWiltgen/Axiom

Похожие скиллы

Всё по теме «Мобильная разработка» →
guide-swift-concurrency Prisma-Labs-Dev Скилл настраивает проверку конкурентного кода на Swift 6.2 со strict concurrency. Он помогает находить гонки данных, изолировать акторы и заменять вызовы GCD на группы задач. CX Codex +1 431установок swift-expert https://github.com/Jeffallan Скилл для разработки на Swift: архитектура, SwiftUI, async/await, акторы и тесты. Пригодится, когда агент пишет или разбирает код приложения под iOS и macOS. CX Codex +1 4 100установок swift-concurrency AvdLee Помогает находить ошибки Swift Concurrency, переводить callback-код на async/await и готовить проект к Swift 6. Пригодится для диагностики изоляции и гонок данных. CX Codex +1 17 000установок swift-concurrency-expert Dimillian Скилл проверяет и исправляет проблемы параллелизма в Swift 6.2+: добавляет Sendable, применяет @MainActor, решает предупреждения об изоляции акторов и переводит completion handlers на async/await. CX Codex +1 2 000установок cmux-architecture manaflow-ai Скилл задаёт правила разделения кода cmux на пакеты Swift, инверсии зависимостей и многопоточности Swift 6. Помогает переносить модули без циклических связей. CX Codex +1 4 900установок swiftui-patterns affaan-m Задаёт правила современной разработки на SwiftUI: переход на @Observable, типобезопасная навигация и оптимизация рендеринга. Пригодится при верстке экранов под iOS и macOS. CX Codex +1 4 600установок

Из того же набора27

axiom-networking Скилл с правилами и справочниками для сетевого кода в Apple-приложениях. Внутри — маршрутизация по типу задачи, диагностика сбоев и паттерны для URLSession и Network.framework. CX Codex +1 1 500установок axiom-design Скилл помогает принимать решения по дизайну приложений Apple: сетки HIG, эффекты Liquid Glass, подбор SF Symbols, шрифты и переключение экранов авторизации. CX Codex +1 1 400установок axiom-xcode-mcp Помогает подключить Xcode к MCP-клиенту и работать с инструментами IDE: сборкой, тестами, файлами и предпросмотром. CX Codex +1 1 400установок axiom-shipping Скилл для публикации iOS-приложений: чек-листы перед отправкой, разбор отказов App Review, метаданные, privacy manifest и триаж крашей. CX Codex +1 1 400установок axiom-integration Маршрутизирует интеграции с системными службами Apple — от Siri, виджетов и StoreKit до фоновых задач и пушей. Помогает подключить нативные функции платформы к коду проекта. CX Codex +1 1 300установок axiom-data Скилл-роутер по хранению данных в Apple-приложениях: SwiftData, Core Data, GRDB, SQLiteData, CloudKit, миграции и Codable. CX Codex +1 1 300установок axiom-testing Скилл для написания и отладки тестов в Swift: подсказывает, когда брать Swift Testing, а когда XCTest, и разбирает причины падающих тестов. CX Codex +1 1 300установок axiom-build Маршрутизирует сбои сборки iOS и macOS, зависания симулятора и ошибки Xcode до разбора кода приложения. CX Codex +1 1 300установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой