AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Concurrency Expert

skill-patrickserrano-skills-swift-concurrency-expert · by patrickserrano

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.

No reviews yet
0 installs
35 views
0.0% view→install

Install

$ agentstack add skill-patrickserrano-skills-swift-concurrency-expert

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-patrickserrano-skills-swift-concurrency-expert)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
8mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Concurrency Expert? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

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
  • Check if approachable concurrency (default actor isolation / main-actor-by-default) is enabled
  • Identify the current actor context (@MainActor, actor, nonisolated)
  • 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:

| Issue | Fix | |-------|-----| | UI-bound types | Annotate the type or members with @MainActor | | Protocol conformance on main actor types | Make conformance isolated: extension Foo: @MainActor SomeProtocol | | Global/static state | Protect with @MainActor or move into an actor | | Background work | Use @concurrent async function on a nonisolated type | | Sendable errors | Prefer immutable/value types; add Sendable only when correct |

Swift 6.2 Key Changes

Default Actor Isolation

Swift 6.2 stays single-threaded by default until you choose to introduce concurrency:

// In Swift 6.2 with approachable concurrency enabled,
// this no longer produces a data race error
@MainActor
final class StickerModel {
    let photoProcessor = PhotoProcessor()

    func extractSticker(_ item: PhotosPickerItem) async throws -> Sticker? {
        guard let data = try await item.loadTransferable(type: Data.self) else {
            return nil
        }
        // Safe - runs on main actor by default
        return await photoProcessor.extractSticker(data: data, with: item.itemIdentifier)
    }
}

Isolated Conformances

Conformances that need main actor state are now supported:

protocol Exportable {
    func export()
}

// Isolated conformance - safe because compiler ensures
// it's only used on the main actor
extension StickerModel: @MainActor Exportable {
    func export() {
        photoProcessor.exportAsPNG()
    }
}

Protecting Global State

// Protect with @MainActor
@MainActor
final class StickerLibrary {
    static let shared: StickerLibrary = .init()
}

// Or enable main-actor-by-default mode for the whole project

Offloading Work to Background

Use @concurrent to explicitly run code on the concurrent thread pool:

nonisolated struct PhotoProcessor {
    @concurrent
    func process(data: Data) async -> ProcessedPhoto? {
        // Runs on background thread
    }
}

// Caller adds await
processedPhotos[item.id] = await PhotoProcessor().process(data: data)

Migration Checklist

  1. Check Swift version in build settings (needs 6.2+)
  2. Enable approachable concurrency features in build settings
  3. Run Swift migration tooling: swift.org/migration
  4. Fix remaining compiler errors using patterns above
  5. Test thoroughly - concurrency bugs may surface at runtime

Common Patterns

UI-Bound Class

@MainActor
final class ViewModel {
    var items: [Item] = []

    func load() async {
        items = try await service.fetchItems()
    }
}

Background Processing

nonisolated struct ImageProcessor {
    @concurrent
    static func resize(_ image: UIImage, to size: CGSize) async -> UIImage {
        // Heavy work runs off main actor
    }
}

Actor for Shared Mutable State

actor Cache {
    private var storage: [String: Data] = [:]

    func get(_ key: String) -> Data? {
        storage[key]
    }

    func set(_ key: String, value: Data) {
        storage[key] = value
    }
}

Build Settings

Enable in Xcode under Swift Compiler - Concurrency:

  • SWIFT_STRICT_CONCURRENCY = complete
  • Approachable concurrency features (Swift 6.2+)

Or in Package.swift:

swiftSettings: [
    .enableExperimentalFeature("StrictConcurrency")
]

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.