SW

swift-concurrency-expert

Automates the remediation of Swift Concurrency diagnostics, ensuring safety and compliance in modern Swift codebases.

Install

mkdir -p .claude/skills/swift-concurrency-expert && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/1572" && unzip -o skill.zip -d .claude/skills/swift-concurrency-expert && rm skill.zip

Installs to .claude/skills/swift-concurrency-expert

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Swift Concurrency review and remediation for Swift 6.2+. Use when asked to review Swift Concurrency usage, improve concurrency compliance, or fix Swift concurrency compiler errors in a feature or file. Concrete actions include adding Sendable conformance, applying @MainActor annotations, resolving actor isolation warnings, fixing data race diagnostics, and migrating completion handlers to async/await.
404 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Advanced

Key capabilities

  • Identifies actor isolation violations
  • Resolves compiler data race warnings
  • Migrates legacy completion handlers to async/await
  • Adds Sendable conformance
  • Annotates UI types with MainActor

How it works

Analyzes compiler diagnostics to apply specific language-level concurrency annotations that satisfy Swift 6.2+ safety checks.

Inputs & outputs

You give it
Swift file with concurrency compiler errors
You get back
Refactored code with isolation and safety fixes

When to use swift-concurrency-expert

  • Fixing Swift compiler warnings
  • Migrating callbacks to async/await
  • Resolving data race diagnostics
  • Annotating UI-bound types for main actor

About this skill

Swift Concurrency Expert

Overview

Review and fix Swift Concurrency issues in Swift 6.2+ codebases by applying actor isolation, Sendable safety, and modern concurrency patterns with minimal behavior changes.

Workflow

1. Triage the issue

  • Capture the exact compiler diagnostics and the offending symbol(s).
  • Check project concurrency settings: Swift language version (6.2+), strict concurrency level, and whether approachable concurrency (default actor isolation / main-actor-by-default) is enabled.
  • Identify the current actor context (@MainActor, actor, nonisolated) and whether a default actor isolation mode is enabled.
  • Confirm whether the code is UI-bound or intended to run off the main actor.

2. Apply the smallest safe fix

Prefer edits that preserve existing behavior while satisfying data-race safety.

Common fixes:

  • UI-bound types: annotate the type or relevant members with @MainActor.
  • Protocol conformance on main actor types: make the conformance isolated (e.g., extension Foo: @MainActor SomeProtocol).
  • Global/static state: protect with @MainActor or move into an actor.
  • Background work: move expensive work into a @concurrent async function on a nonisolated type or use an actor to guard mutable state.
  • Sendable errors: prefer immutable/value types; add Sendable conformance only when correct; avoid @unchecked Sendable unless you can prove thread safety.

3. Verify the fix

  • Rebuild and confirm all concurrency diagnostics are resolved with no new warnings introduced.
  • Run the test suite to check for regressions — concurrency changes can introduce subtle runtime issues even when the build is clean.
  • If the fix surfaces new warnings, treat each one as a fresh triage (return to step 1) and resolve iteratively until the build is clean and tests pass.

Examples

UI-bound type — adding @MainActor

// Before: data-race warning because ViewModel is accessed from the main thread
// but has no actor isolation
class ViewModel: ObservableObject {
    @Published var title: String = ""
    func load() { title = "Loaded" }
}

// After: annotate the whole type so all stored state and methods are
// automatically isolated to the main actor
@MainActor
class ViewModel: ObservableObject {
    @Published var title: String = ""
    func load() { title = "Loaded" }
}

Protocol conformance isolation

// Before: compiler error — SomeProtocol method is nonisolated but the
// conforming type is @MainActor
@MainActor
class Foo: SomeProtocol {
    func protocolMethod() { /* accesses main-actor state */ }
}

// After: scope the conformance to @MainActor so the requirement is
// satisfied inside the correct isolation context
@MainActor
extension Foo: SomeProtocol {
    func protocolMethod() { /* safely accesses main-actor state */ }
}

Background work with @concurrent

// Before: expensive computation blocks the main actor
@MainActor
func processData(_ input: [Int]) -> [Int] {
    input.map { heavyTransform($0) }   // runs on main thread
}

// After: hop off the main actor for the heavy work, then return the result
// The caller awaits the result and stays on its own actor
nonisolated func processData(_ input: [Int]) async -> [Int] {
    await Task.detached(priority: .userInitiated) {
        input.map { heavyTransform($0) }
    }.value
}

// Or, using a @concurrent async function (Swift 6.2+):
@concurrent
func processData(_ input: [Int]) async -> [Int] {
    input.map { heavyTransform($0) }
}

Reference material

  • See references/swift-6-2-concurrency.md for Swift 6.2 changes, patterns, and examples.
  • See references/approachable-concurrency.md when the project is opted into approachable concurrency mode.
  • See references/swiftui-concurrency-tour-wwdc.md for SwiftUI-specific concurrency guidance.

When not to use it

  • General Swift feature development without concurrency issues
  • Non-Swift codebases

Prerequisites

Swift 6.2+ environment

Limitations

  • Cannot resolve logic bugs underlying data races
  • Requires human review for complex threading logic

How it compares

Focuses on minimizing behavior changes while prioritizing strict compiler-enforced safety.

Compared to similar skills

swift-concurrency-expert side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
swift-concurrency-expert (this skill)44moNo flagsAdvanced
swift-concurrency-developer13moNo flagsIntermediate
swift-concurrency42moNo flagsAdvanced
instruments-profiling32moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

More by Dimillian

View all by Dimillian

swiftui-liquid-glass

Dimillian

Implement, review, or improve SwiftUI features using the iOS 26+ Liquid Glass API. Use when asked to adopt Liquid Glass in new SwiftUI UI, refactor an existing feature to Liquid Glass, or review Liquid Glass usage for correctness, performance, and design alignment.

1567

ios-debugger-agent

Dimillian

Use XcodeBuildMCP to build, run, launch, and debug the current iOS project on a booted simulator. Trigger when asked to run an iOS app, interact with the simulator UI, inspect on-screen state, capture logs/console output, or diagnose runtime behavior using XcodeBuildMCP tools.

214

react-component-performance

Dimillian

Analyze and optimize React component performance issues (slow renders, re-render thrash, laggy lists, expensive computations). Use when asked to profile or improve a React component, reduce re-renders, or speed up UI updates in React apps.

25

app-store-changelog

Dimillian

Create user-facing App Store release notes by collecting and summarizing all user-impacting changes since the last git tag (or a specified ref). Use when asked to generate a comprehensive release changelog, App Store "What's New" text, or release notes based on git history or tags.

14

macos-spm-app-packaging

Dimillian

Scaffold, build, and package SwiftPM-based macOS apps without an Xcode project. Use when you need a from-scratch macOS app layout, SwiftPM targets/resources, a custom .app bundle assembly script, or signing/notarization/appcast steps outside Xcode.

17

swiftui-ui-patterns

Dimillian

Best practices and example-driven guidance for building SwiftUI views and components. Use when creating or refactoring SwiftUI UI, designing tab architecture with TabView, composing screens, or needing component-specific patterns and examples.

13

You might also like

swift-concurrency-developer

anyproto

Expert guidance on Swift concurrency using the Office Building mental model. Use when working with actors, isolation, Sendable, TaskGroups, or fixing concurrency warnings and data race issues.

11

swift-concurrency

AvdLee

Expert guidance on Swift Concurrency best practices, patterns, and implementation. Use when developers mention: (1) Swift Concurrency, async/await, actors, or tasks, (2) "use Swift Concurrency" or "modern concurrency patterns", (3) migrating to Swift 6, (4) data races or thread safety issues, (5) refactoring closures to async/await, (6) @MainActor, Sendable, or actor isolation, (7) concurrent code architecture or performance optimization, (8) concurrency-related linter warnings (SwiftLint or similar; e.g. async_without_await, Sendable/actor isolation/MainActor lint).

433

instruments-profiling

steipete

Use when profiling native macOS or iOS apps with Instruments/xctrace. Covers correct binary selection, CLI arguments, exports, and common gotchas.

327

perf-optimizer

OneKeyHQ

Systematic performance optimization and regression debugging for OneKey mobile app (iOS). Use when: (1) Fixing performance regressions - when metrics like tokensStartMs, tokensSpanMs, or functionCallCount have regressed and need to be brought back to normal levels, (2) Improving baseline performance - when there's a need to optimize cold start time or reduce function call overhead, (3) User requests performance optimization/improvement/debugging for the app's startup or home screen refresh flow.

513

ios-debugger-agent

Dimillian

Use XcodeBuildMCP to build, run, launch, and debug the current iOS project on a booted simulator. Trigger when asked to run an iOS app, interact with the simulator UI, inspect on-screen state, capture logs/console output, or diagnose runtime behavior using XcodeBuildMCP tools.

214

ios-dev-guidelines

anyproto

Context-aware routing to Swift/iOS development patterns, architecture, and best practices. Use when working with .swift files, ViewModels, Coordinators, refactoring, or discussing Swift/SwiftUI patterns.

37

Search skills

Search the agent skills registry