Agent skill

Swift Concurrency

by nimblehq in nimblehq/ios-templates

Write, review, or fix Swift 6 concurrency code using actors, Sendable, structured concurrency, and the strict data-race-safety model.

MITAuto-check passedDevelopment

Install Swift Concurrency

skills CLI
$ npx skills add nimblehq/ios-templates --skill swift-concurrency -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install nimblehq/ios-templates swift-concurrency --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/nimblehq/ios-templates.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/swift-concurrency .claude/skills/swift-concurrency && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
swift-concurrency
GitHub stars
110
Token cost
~1.7k tokens
SKILL.md length
551 words
Files
5 (incl. references)
Skills in repo
5
Repo updated
First seen
Licence
MIT

At a glance

Write, review, or fix Swift 6 concurrency code using actors, Sendable, structured concurrency, and the strict data-race-safety model.

  • Works in 10 steps: Never suppress concurrency errors with… → In async contexts, actor is the default… → Use @MainActor for all UI-bound state.… → …
  • Working with async/await
  • SKILL.md covers Overview, Agent Behavior Contract, Quick Triage and Canonical Patterns, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Swift Concurrency is an agent skill from nimblehq/ios-templates. Write, review, or fix Swift 6 concurrency code using actors, Sendable, structured concurrency, and the strict data-race-safety model. Use when working with async/await, actors, data race compiler errors, Sendable conformance, TaskGroup, AsyncSequence, or migrating Swift 5 code to Swift 6 strict concurrency. Triggers on: "actor", "Sendable", "data race", "MainActor", "async let", "TaskGroup", "AsyncStream", "concurrency warning", "strict concurrency", "Swift 6 concurrency", "nonisolated", "Mutex".

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. The skill folder holds 5 other files, including reference files (for example `references/actors.md`, `references/async-sequences.md` and `references/sendability.md`).

It sits in Development, covering Async programming and iOS development. It works with Swift and iOS. The repository describes itself as: Our optimized iOS templates used in our projects. The licence is MIT.

When your agent uses it

  • Working with async/await
  • Data race compiler errors
  • Sendable conformance
  • Migrating Swift 5 code to Swift 6 strict concurrency

Example prompts

  • “Sendable”
  • “data race”
  • “MainActor”
  • “/swift-concurrency”

Workflow steps

10 steps, taken from the first numbered list in SKILL.md.

  1. Never suppress concurrency errors with nonisolated(unsafe) without explicit user approval. Investigate and fix the isolation root cause…
  2. In async contexts, actor is the default for shared mutable state. In synchronous contexts, prefer refactoring to async and using an actor…
  3. Use @MainActor for all UI-bound state. Apply it to ObservableObject view models and @Observable types that drive the view hierarchy.
  4. Prefer structured concurrency (async let, TaskGroup) over unstructured Task { }. Attach work to a parent task whenever possible.
  5. Mark types Sendable explicitly when they cross isolation boundaries. Prefer value types (struct, enum) — they are implicitly Sendable when…
  6. Propagate task cancellation. Check Task.isCancelled or call try Task.checkCancellation() inside loops or long-running operations.
  7. Avoid @unchecked Sendable unless integrating a third-party type that is thread-safe but lacks annotation. Always add a comment explaining…
  8. Use @preconcurrency import when adopting a framework not yet fully annotated for Swift 6, to suppress false-positive warnings at the…
  9. No DispatchQueue in new Swift 6 code. Use actor for shared mutable state. Mutex is acceptable for short synchronous critical sections, but…
  10. Never call MainActor.assumeIsolated outside of truly non-async contexts (e.g., UIKit delegate callbacks). In async code, just annotate or…

What it can do on your machine

Read from SKILL.md and the folder at commit f009d02. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are swift).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Swift Concurrency loads about 1.7k tokens when it runs, and up to ~9k if it reads all its reference files. Until then it costs about 130 tokens; SKILL.md has 551 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~130
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from nimblehq/ios-templates at commit f009d02, republished under its MIT licence (© nimblehq). 551 words, ~1,654 tokens.

Download SKILL.mdSave it as .claude/skills/swift-concurrency/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
swift-concurrency
description
Write, review, or fix Swift 6 concurrency code using actors, Sendable, structured concurrency, and the strict data-race-safety model. Use when working with async/await, actors, data race compiler errors, Sendable conformance, TaskGroup, AsyncSequence, or migrating Swift 5 code to Swift 6 strict concurrency. Triggers on: "actor", "Sendable", "data race", "MainActor", "async let", "TaskGroup", "AsyncStream", "concurrency warning", "strict concurrency", "Swift 6 concurrency", "nonisolated", "Mutex".

Swift 6 Concurrency

Overview

Write, review, and fix Swift 6 concurrency code in this iOS project. Swift 6 enforces complete data race safety at compile time — every piece of mutable state that crosses a concurrency domain boundary must be protected by actors, Sendable conformance, or Mutex. This skill applies to all modules: App, Data, Domain, and Model.

Agent Behavior Contract

  1. Never suppress concurrency errors with nonisolated(unsafe) without explicit user approval. Investigate and fix the isolation root cause first.
  2. In async contexts, actor is the default for shared mutable state. In synchronous contexts, prefer refactoring to async and using an actor; reach for Mutex (from Synchronization) only when async refactoring is not feasible, the critical section has no await, or fine-grained locking over a single value is needed.
  3. Use @MainActor for all UI-bound state. Apply it to ObservableObject view models and @Observable types that drive the view hierarchy.
  4. Prefer structured concurrency (async let, TaskGroup) over unstructured Task { }. Attach work to a parent task whenever possible.
  5. Mark types Sendable explicitly when they cross isolation boundaries. Prefer value types (struct, enum) — they are implicitly Sendable when all stored properties are Sendable.
  6. Propagate task cancellation. Check Task.isCancelled or call try Task.checkCancellation() inside loops or long-running operations.
  7. Avoid @unchecked Sendable unless integrating a third-party type that is thread-safe but lacks annotation. Always add a comment explaining why it is safe.
  8. Use @preconcurrency import when adopting a framework not yet fully annotated for Swift 6, to suppress false-positive warnings at the boundary.
  9. No DispatchQueue in new Swift 6 code. Use actor for shared mutable state. Mutex is acceptable for short synchronous critical sections, but never as a default replacement for actors.
  10. Never call MainActor.assumeIsolated outside of truly non-async contexts (e.g., UIKit delegate callbacks). In async code, just annotate or await MainActor.run { }.
Show full SKILL.md (246 more words)Show less

Quick Triage

Before writing or reviewing concurrency code, clarify:

  1. Which isolation domain? Main actor (UI), custom actor (domain/data service), or nonisolated?
  2. What mutability pattern? Value type passed by copy, reference type shared by reference, or actor-protected state?
  3. Structured or unstructured? Is there a parent async context to attach the child task to?
  4. Concurrency mode? Check SWIFT_STRICT_CONCURRENCY in build settings — complete is Swift 6 mode.

Canonical Patterns

Actor protecting shared mutable state
swift
actor TokenStore {

    private var accessToken: String?
    private var refreshToken: String?

    func store(access: String, refresh: String) {
        accessToken = access
        refreshToken = refresh
    }

    func retrieveAccessToken() -> String? {
        accessToken
    }
}
@MainActor view model
swift
@MainActor
final class HomeViewModel: ObservableObject {

    @Published private(set) var items: [HomeItem] = []
    @Published private(set) var isLoading = false

    private let repository: any HomeRepository

    init(repository: some HomeRepository) {
        self.repository = repository
    }

    func load() async {
        isLoading = true
        defer { isLoading = false }
        do {
            items = try await repository.fetchItems()
        } catch {
            items = []
        }
    }
}
Structured concurrency with async let
swift
func loadDashboard() async throws -> Dashboard {
    async let user = userRepository.fetchCurrentUser()
    async let orders = orderRepository.fetchRecentOrders()
    async let banners = bannerRepository.fetchActiveBanners()

    return try await Dashboard(
        user: user,
        orders: orders,
        banners: banners
    )
}
TaskGroup for dynamic fan-out
swift
func fetchDetails(for ids: [String]) async throws -> [ItemDetail] {
    try await withThrowingTaskGroup(of: ItemDetail.self) { group in
        for id in ids {
            group.addTask {
                try await self.repository.fetchDetail(id: id)
            }
        }
        return try await group.reduce(into: []) { $0.append($1) }
    }
}
Mutex for synchronous shared state (no async)
swift
import Synchronization

final class RequestCounter: Sendable {

    private let _count = Mutex(0)

    func increment() {
        _count.withLock { $0 += 1 }
    }

    var count: Int {
        _count.withLock { $0 }
    }
}

Routing to References

Load the appropriate reference file based on the task:

TaskReference
Actor design, actor isolation, nonisolated, global actorsreferences/actors.md
Sendable, @Sendable closures, crossing isolation boundariesreferences/sendability.md
async let, Task, TaskGroup, task cancellationreferences/structured-concurrency.md
AsyncSequence, AsyncStream, for await loopsreferences/async-sequences.md

Verification Checklist

Before finishing, confirm:

  • All mutable state shared across concurrency domains is actor-isolated or Sendable
  • @MainActor is applied to all ObservableObject / @Observable view models
  • async let or TaskGroup used instead of a chain of sequential await calls where parallelism is possible
  • No Task.detached unless genuinely required — if used, explain why in a comment
  • Long loops call try Task.checkCancellation() at each iteration
  • Mutex only used when the critical section is short, purely synchronous, and has no await — actor is the default otherwise
  • AsyncStream / AsyncThrowingStream continuations call .finish() in all exit paths including errors
  • No DispatchQueue in new code
  • nonisolated(unsafe) absent (or signed off by the user with a safety comment)

© nimblehq, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 4 other files (references) in skills/swift-concurrency of nimblehq/ios-templates.

  • SKILL.md
  • references/actors.md
  • references/async-sequences.md
  • references/sendability.md
  • references/structured-concurrency.md

Open the folder on GitHubat commit f009d02

Compare with similar skills

Swift Concurrency next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Swift Concurrency compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Swift Concurrency this skillnimblehq/ios-templates110—~1.7kAutomated safety check: PassMIT
Swift ConcurrencyHoangNguyen0403/agent-skills-standard572—~545Automated safety check: PassMIT
Stellar iOS Mac SDKSoneso/stellar-ios-mac-sdk132—~4.3kAutomated safety check: PassApache-2.0
Swift Concurrencyhenrypldev/react-native-nitro-mlx1003 repos~3.1kAutomated safety check: PassMIT
Core Data ExpertAvdLee/Core-Data-Agent-Skill315—~1.2kAutomated safety check: PassMIT
Swift Concurrencyjamesrochabrun/skills216—~1.9kAutomated safety check: PassMIT

Similar skills

  • Swift Concurrency

    HoangNguyen0403/agent-skills-standard

    Implement async/await, Actors, and structured concurrency in Swift.

    572 GitHub stars~545 tokensUpdated yesterday
    MobileAuto-check passed
  • Stellar iOS Mac SDK

    Soneso/stellar-ios-mac-sdk

    Guides Stellar blockchain development in Swift using stellar-ios-mac-sdk.

    132 GitHub stars~4.3k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Swift Concurrency

    henrypldev/react-native-nitro-mlx

    Diagnose Swift Concurrency issues, refactor callback-based code to async/await, and guide Swift 6 migration when working with tasks, actors, @MainActor, Sendable, data races, thread safety, or…

    100 GitHub starsUsed in 3 repos~3.1k tokens
    DevelopmentAuto-check passed
  • Core Data Expert

    AvdLee/Core-Data-Agent-Skill

    Expert Core Data guidance (iOS/macOS): stack setup, fetch requests & NSFetchedResultsController, saving/merge conflicts, threading & Swift Concurrency, batch operations & persistent history…

    315 GitHub stars~1.2k tokensUpdated 26 days ago
    DevelopmentAuto-check passed
  • Swift Concurrency

    jamesrochabrun/skills

    Guide for building, auditing, and refactoring Swift code using modern concurrency patterns (Swift 6+).

    216 GitHub stars~1.9k tokensUpdated 8 mo ago
    DevelopmentAuto-check passed
  • Concurrency Patterns

    gustavscirulis/snapgrid

    Swift concurrency patterns including Swift 6.2 approachable concurrency, structured concurrency, actors, continuations, and migration.

    116 GitHub starsUsed in 1 repo~1.2k tokens
    DevelopmentAuto-check passed

More from nimblehq/ios-templates

  • Swift Testing

    nimblehq/ios-templates

    Write, review, or migrate unit tests using Swift Testing (@Test, @Suite, expect, require).

    110 GitHub stars~1.3k tokensUpdated 2 mo ago
    Auto-check passed
  • Tophat Build Install

    nimblehq/ios-templates

    Find, build, and install mobile artifacts for the current repository through GitHub Actions and Tophat.

    110 GitHub stars~1k tokensUpdated 2 mo ago
    Auto-check passed
  • Commit

    nimblehq/ios-templates

    Generate and create a git commit following Nimble's Compass convention ([ID] Verb message).

    110 GitHub stars~790 tokensUpdated 2 mo ago
    Auto-check passed
  • Resolve PR Comments

    nimblehq/ios-templates

    Guided workflow to address, reply to, and resolve GitHub PR review threads — one at a time, collaboratively.

    110 GitHub stars~1.7k tokensUpdated 2 mo ago
    Auto-check passed

Works with

Questions about Swift Concurrency

What does Swift Concurrency do?

Write, review, or fix Swift 6 concurrency code using actors, Sendable, structured concurrency, and the strict data-race-safety model. Swift Concurrency is an agent skill from nimblehq/ios-templates. Write, review, or fix Swift 6 concurrency code using actors, Sendable, structured concurrency, and the strict data-race-safety model.

When should I use Swift Concurrency?

Swift Concurrency fits situations like: working with async/await; data race compiler errors; sendable conformance; migrating Swift 5 code to Swift 6 strict concurrency.

How do I install Swift Concurrency in Claude Code?

Run `npx skills add nimblehq/ios-templates --skill swift-concurrency -a claude-code`. Or copy the skill folder (skills/swift-concurrency in nimblehq/ios-templates) into .claude/skills/swift-concurrency in your project. Claude Code loads it when a task matches its description.

How do I install Swift Concurrency in Codex?

Run `npx skills add nimblehq/ios-templates --skill swift-concurrency -a codex`. Or copy the skill folder (skills/swift-concurrency in nimblehq/ios-templates) into .agents/skills/swift-concurrency in your project. Codex loads it when a task matches its description.

Can I use Swift Concurrency in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add nimblehq/ios-templates --skill swift-concurrency -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/swift-concurrency, .gemini/skills/swift-concurrency, .github/skills/swift-concurrency and .opencode/skills/swift-concurrency in your project.

What does Swift Concurrency need to run?

SKILL.md names no scripts, command-line tools or credentials: Swift Concurrency is instructions for the agent only.

Does Swift Concurrency access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Swift Concurrency safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Swift Concurrency use?

Swift Concurrency is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Swift Concurrency use?

About 1.7k tokens (SKILL.md is roughly 6.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 7.4k tokens, read only when the agent opens those files.

What are the alternatives to Swift Concurrency?

Skills that share tags, products or a category with Swift Concurrency: Swift Concurrency (HoangNguyen0403/agent-skills-standard, 572 stars), Stellar iOS Mac SDK (Soneso/stellar-ios-mac-sdk, 132 stars), Swift Concurrency (henrypldev/react-native-nitro-mlx, 100 stars) and Core Data Expert (AvdLee/Core-Data-Agent-Skill, 315 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Swift Concurrency?

nimblehq (a GitHub organization) maintains it in nimblehq/ios-templates, which has 110 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on July 27, 2026.

Source: nimblehq/ios-templates on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.