# Modernize Swift Concurrency Code

Swift Concurrency changes can create confusing warnings, data-race risks, and migration delays. This skill gives structured guidance for async/await, actors, Sendable, testing, performance, and Swift 6 adoption.

## Install

```bash
npx skillstore add avdlee/swift-concurrency
```

## Metadata

- - Slug: avdlee-swift-concurrency
- - Version: 1.0.0
- - Author: AvdLee
- - GitHub username: AvdLee
- - License: MIT
- - Repository: https://github.com/AvdLee/Swift-Concurrency-Agent-Skill/tree/main/swift-concurrency/
- - Ref: main
- - Supported tools: Claude, Codex, Claude Code
- - Risk level: low
- - Quality score: 76
- - Public page: https://skillstore.pages.dev/skills/avdlee-swift-concurrency
- - Manifest: https://skillstore.pages.dev/api/skills/avdlee-swift-concurrency/manifest

## Capabilities

- Explains async/await, async let, task groups, tasks, and AsyncSequence patterns.
- Guides actor isolation, @MainActor usage, custom actors, and nonisolated access decisions.
- Helps plan Swift 6 strict concurrency migrations with smaller reviewable changes.
- Reviews Sendable warnings and documents safe alternatives to risky escape hatches.
- Covers Core Data, testing, memory management, threading, and performance considerations.
- Provides decision trees, troubleshooting paths, and verification checklists.

## Use Cases

- Resolve Concurrency Diagnostics: Diagnose Swift compiler warnings about actor isolation, Sendable, @MainActor, and async boundaries.
- Plan Swift 6 Migration: Create a staged migration plan that limits blast radius and includes verification steps.
- Stabilize Async Tests: Improve XCTest or Swift Testing coverage for async code, cancellation, actors, and task groups.

## Prompt Templates

### Explain a Warning

```
Explain this Swift Concurrency warning in plain language. Identify the isolation boundary and suggest the smallest safe fix.
```

### Refactor Callback Code

```
Review this closure-based Swift API and propose an async/await version. Include cancellation, error handling, and testing notes.
```

### Audit Actor Isolation

```
Audit this actor and @MainActor usage. Point out reentrancy risks, unnecessary actor hops, and safer isolation choices.
```

### Design a Swift 6 Migration Plan

```
Build a Swift 6 strict concurrency migration plan for this module. Include settings to check, rollout order, escape-hatch rules, and verification steps.
```

## Limitations

- It does not run Xcode, compile Swift code, or execute tests by itself.
- Migration advice depends on project settings, Swift language mode, and toolchain version.
- Examples are educational and must be adapted to each codebase.
- External course links and package references may change outside the skill.

## Best Practices

- Confirm Swift version, strict concurrency settings, and default actor isolation before giving migration advice.
- Prefer structured concurrency and explain any use of unstructured tasks or escape hatches.
- Pair concurrency refactors with focused tests, cancellation checks, and performance verification when relevant.

## Anti Patterns

- Do not apply @MainActor everywhere without proving the code belongs on the main actor.
- Do not hide Sendable problems with @unchecked Sendable unless a safety invariant is documented.
- Do not block async contexts with semaphores, sleeps, or synchronous waits.

## Security Audit

- - Safe to publish: true
- - Audited at: 2026-06-28T11:39:06.326\+00:00
- - Summary: Static analysis reported many command, network, storage, reconnaissance, and weak-crypto patterns. Manual review found these are markdown code fences, Swift code examples, course links, and Swift terminology, with no executable scripts or prompt injection evidence. The skill is publishable with low risk because it is documentation-heavy and includes external educational links and sample network code.

## Stats

- - Views: 943
- - Downloads: 7
- - Favorites: 0
- - Popularity score: 0
