guide-swift-concurrency — скилл для Claude Code: как установить
Скилл настраивает проверку конкурентного кода на Swift 6.2 со strict concurrency. Он помогает находить гонки данных, изолировать акторы и заменять вызовы GCD на группы задач.
npx skills add Prisma-Labs-Dev/apple-skills --skill guide-swift-concurrency -a claude-codeЧто делает guide-swift-concurrency
Скилл обучает ассистента анализировать многопоточный код по правилам Swift 6.2 со строгой проверкой изоляции. В его основе лежат наработки Пола Хадсона из проекта twostraws. Вместо абстрактных замечаний агент сверяет архитектуру с 12 контрольными списками: от изоляции акторов до отмены задач через withTaskCancellationHandler.
Внутри заложен строгий запрет на заглушки: ассистент не предложит повесить @unchecked Sendable ради быстрого устранения ошибок компилятора. Вместо этого он требует переводить данные на структуры, применять акторы или передавать параметры через sending. Для новых участков кода приоритет отдаётся структурированной конкурентности через TaskGroup, тогда как неструктурированные блоки Task {} трактуются как подозрительный паттерн.
Гид рассчитан строго на Swift 6.2 и более новые версии. Если проект застрял на старых версиях языка без включённой строгой проверки изоляции, большинство рекомендаций по @concurrent, Task.immediate и деинициализаторам вызовут только ошибки компиляции.
Какие задачи решает
- исправить ошибки компилятора в режиме strict concurrency без
@unchecked Sendable - перевести устаревшие вызовы GCD и замыкания на современные async/await и группы задач
- найти гонки данных и проблемы реентерабельности в коде акторов
- проверить корректную обработку отмены операций в
AsyncStreamи фоновых задачах
Примеры запросов агенту
- Проверь этот файл с актором на проблемы реентерабельности и корректность изоляции в Swift 6.2
- Перепиши вызовы DispatchQueue на структурированную конкурентность с task groups
- Помоги убрать ошибку strict concurrency в этом типе без добавления @unchecked Sendable
Как установить guide-swift-concurrency
1Через Skills CLI (Vercel)
npx skills add Prisma-Labs-Dev/apple-skills --skill guide-swift-concurrency -a claude-code2Вручную: положить файлы
~/.claude/skills/guide-swift-concurrency/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/guide-swift-concurrency/
1Через Skills CLI (Vercel)
npx skills add Prisma-Labs-Dev/apple-skills --skill guide-swift-concurrency -a codex2Вручную: положить файлы
.agents/skills/guide-swift-concurrency/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add Prisma-Labs-Dev/apple-skills --skill guide-swift-concurrency -a cursor2Вручную: положить файлы
.cursor/skills/guide-swift-concurrency/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install Prisma-Labs-Dev/apple-skills guide-swift-concurrency2Вручную: положить файлы
.github/skills/guide-swift-concurrency/SKILL.md1Через Skills CLI (Vercel)
npx skills add Prisma-Labs-Dev/apple-skills --skill guide-swift-concurrency -a gemini-cli2Командой платформы
gemini skills install https://github.com/Prisma-Labs-Dev/apple-skills --path skills/guide-swift-concurrencyВручную: положить файлы
.devin/skills/guide-swift-concurrency/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add Prisma-Labs-Dev/apple-skills --skill guide-swift-concurrency -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о guide-swift-concurrency
Как установить guide-swift-concurrency в Claude Code?
Выполните команду npx skills add Prisma-Labs-Dev/apple-skills --skill guide-swift-concurrency -a claude-code. Агент получит правила проверки и справочные файлы.
Для какой версии Swift предназначен этот скилл?
Набор правил ориентирован на Swift 6.2 или более поздние релизы с включённым строгим режимом проверки (strict concurrency).
Разрешает ли скилл использовать GCD вместо async/await?
Для нового кода скилл требует использовать модель конкурентности Swift, однако оставляет GCD допустимым в низкоуровневом коде, при работе со сторонними библиотеками и в синхронных операциях.
Исходный текст
SKILL.md · MIT
---
name: guide-swift-concurrency
description: Swift concurrency patterns — actors, structured concurrency, cancellation, async streams, GCD migration, strict-concurrency diagnostics, common bug patterns. Use when writing, reviewing, or debugging concurrent Swift code.
type: guide
origin: https://github.com/twostraws/Swift-Concurrency-Agent-Skill
license: MIT
---
> **Guide Skill** — This is an expert workflow/pattern guide, not API reference documentation.
> Originally from [twostraws/Swift-Concurrency-Agent-Skill](https://github.com/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 Sendable` to fix compiler errors — prefer actors, value types, or `sending` parameters.
## Review Process
1. Scan for known-dangerous patterns using `references/hotspots.md`.
2. Check for Swift 6.2 concurrency behavior using `references/new-features.md`.
3. Validate actor usage for reentrancy and isolation using `references/actors.md`.
4. Ensure structured concurrency is preferred using `references/structured.md`.
5. Check unstructured task usage using `references/unstructured.md`.
6. Verify cancellation handling using `references/cancellation.md`.
7. Validate async stream and continuation usage using `references/async-streams.md`.
8. Check bridging code between sync and async using `references/bridging.md`.
9. Review legacy concurrency migrations using `references/interop.md`.
10. Cross-check against common failure modes using `references/bug-patterns.md`.
11. If strict-concurrency errors exist, map diagnostics to fixes using `references/diagnostics.md`.
12. 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` |
© Prisma-Labs-Dev · MIT · Prisma-Labs-Dev/apple-skills