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

Swift Concurrency Pro

skill-laxrajpurohit-swift-skills-pro-swift-concurrency-pro · by laxrajpurohit

Use when writing async/await code, fixing Sendable or data-race errors, enabling strict concurrency, using actors, or migrating from completion handlers in Swift 6.

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

Install

$ agentstack add skill-laxrajpurohit-swift-skills-pro-swift-concurrency-pro

✓ 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-laxrajpurohit-swift-skills-pro-swift-concurrency-pro)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo 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 Swift Concurrency Pro? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Swift Concurrency Pro

Write correct, data-race-free concurrent Swift. Target Swift 6 strict concurrency.

When to use

  • Writing or reviewing async/await code.
  • Fixing Sendable / data-race / actor-isolation errors.
  • Migrating completion-handler APIs to async.

Trigger: /swift-concurrency-pro.

Core principles

  • Swift 6 enforces data isolation at compile time. Treat every concurrency warning as a

real bug, not noise.

  • UI and view models are @MainActor. Background work runs off the main actor.
  • Share mutable state through an actor, never a lock + global.
  • Make types crossing concurrency boundaries Sendable.

async/await over completion handlers

func loadUser(completion: @escaping (Result) -> Void) { ... }

func loadUser() async throws -> User { ... }

Wrap legacy callbacks with continuations:

func loadUser() async throws -> User {
    try await withCheckedThrowingContinuation { cont in
        legacyLoad { result in cont.resume(with: result) }
    }
}

Resume a continuation exactly once — never zero, never twice.

Actors for shared mutable state

❌ Lock around shared dictionary

final class Cache {
    private var store: [String: Data] = [:]
    private let lock = NSLock()
    func set(_ d: Data, _ k: String) { lock.lock(); store[k] = d; lock.unlock() }
}

actor Cache {
    private var store: [String: Data] = [:]
    func set(_ d: Data, for k: String) { store[k] = d }
    func get(_ k: String) -> Data? { store[k] }
}

Access is await cache.set(...). Don't expose var actor state directly across actors.

@MainActor for UI

@MainActor
@Observable
final class FeedModel {
    var posts: [Post] = []
    func refresh() async {
        let fetched = await api.posts()   // api hops off main as needed
        posts = fetched                   // back on main, safe
    }
}

Don't sprinkle DispatchQueue.main.async — annotate with @MainActor instead.

Sendable

  • struct/enum of Sendable members → automatically Sendable.
  • Final classes with immutable state → mark Sendable.
  • Mutable classes shared across actors → make it an actor, or isolate it.

class Settings { var theme = "light" }   // shared across tasks → data race

actor Settings { var theme = "light" }
// or, if truly immutable:
struct Settings: Sendable { let theme: String }

Structured concurrency

Use async let / TaskGroup for parallel work; they auto-cancel and propagate errors.

async let a = api.profile()
async let b = api.feed()
let (profile, feed) = try await (a, b)

Avoid unstructured Task { } for work tied to a view's lifetime — use .task so it cancels on disappear.

Common mistakes checklist

  • [ ] Resuming a continuation zero or multiple times.
  • [ ] DispatchQueue.main.async instead of @MainActor.
  • [ ] Lock-guarded shared state that should be an actor.
  • [ ] Non-Sendable type sent across a concurrency boundary.
  • [ ] Detached Task {} for view-scoped work (won't cancel).
  • [ ] Suppressing concurrency warnings instead of fixing isolation.

Output format (when reviewing)

Per issue: file:line, the isolation/Sendable rule violated, before/after fix. End with the highest-risk data races first.

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.