Agent skill

Swift Concurrency 6 2

by affaan-m in affaan-m/ECC

Swift 6.2のアクセシブルな並行処理——デフォルトはシングルスレッド、@concurrentは明示的なバックグラウンドオフロードに使用し、分離の一貫性はMainActor型に使用する。

MITAuto-check passedMobile

Install Swift Concurrency 6 2

skills CLI
$ npx skills add affaan-m/ECC --skill swift-concurrency-6-2 -a claude-code

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

GitHub CLI
$ gh skill install affaan-m/ECC swift-concurrency-6-2 --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/affaan-m/ECC.git skills-src && mkdir -p .claude/skills && cp -r skills-src/docs/ja-JP/skills/swift-concurrency-6-2 .claude/skills/swift-concurrency-6-2 && 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-6-2
GitHub stars
276k
Token cost
~1.5k tokens
SKILL.md length
150 words
Files
1
Skills in repo
683
Repo updated
First seen
Licence
MIT

At a glance

Swift 6.2のアクセシブルな並行処理——デフォルトはシングルスレッド、@concurrentは明示的なバックグラウンドオフロードに使用し、分離の一貫性はMainActor型に使用する。

  • Works in 4 steps: コンテナとなる型に nonisolated をマークする → 関数に @concurrent を追加する → 関数がまだ非同期でない場合は async を追加する → …
  • Mobile work in your project
  • SKILL.md covers 起動条件, 核心的な問題:暗黙のバックグラウンドオフロード, コアパターン——分離の一貫性 and コアパターン——グローバル変数と静的変数, plus 6 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Swift Concurrency 6 2 is an agent skill from affaan-m/ECC. Swift 6.2のアクセシブルな並行処理——デフォルトはシングルスレッド、@concurrentは明示的なバックグラウンドオフロードに使用し、分離の一貫性はMainActor型に使用する。

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Mobile. It works with Swift. The repository describes itself as: The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond. The licence is MIT.

When your agent uses it

  • Mobile work in your project

Example prompts

  • “/swift-concurrency-6-2”

Workflow steps

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

  1. コンテナとなる型に nonisolated をマークする
  2. 関数に @concurrent を追加する
  3. 関数がまだ非同期でない場合は async を追加する
  4. 呼び出し側に await を追加する

What it can do on your machine

Read from SKILL.md and the folder at commit 4eb71d9. 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 6 2 loads about 1.5k tokens when it runs. Until then it costs about 29 tokens; SKILL.md has 150 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~29
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k

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 affaan-m/ECC at commit 4eb71d9, republished under its MIT licence (© affaan-m). 150 words, ~1,527 tokens.

Download SKILL.mdSave it as .claude/skills/swift-concurrency-6-2/SKILL.md (or your agent's skills folder).
name
swift-concurrency-6-2
description
Swift 6.2のアクセシブルな並行処理——デフォルトはシングルスレッド、@concurrentは明示的なバックグラウンドオフロードに使用し、分離の一貫性はMainActor型に使用する。

Swift 6.2 アクセシブルな並行処理

コードがデフォルトでシングルスレッドで実行され、並行処理が明示的に導入されるSwift 6.2の並行処理モデルを採用したパターン。パフォーマンスを犠牲にすることなく、よくあるデータ競合エラーを排除する。

起動条件

  • Swift 5.x または 6.0/6.1 プロジェクトを Swift 6.2 に移行する場合
  • データ競合安全性のコンパイラエラーを解決する場合
  • MainActorベースのアプリアーキテクチャを設計する場合
  • CPU集約的な処理をバックグラウンドスレッドにオフロードする場合
  • MainActor分離された型にプロトコル一貫性を実装する場合
  • Xcode 26で「アクセシブルな並行処理」ビルド設定を有効にする場合

核心的な問題:暗黙のバックグラウンドオフロード

Swift 6.1以前では、非同期関数が暗黙的にバックグラウンドスレッドにオフロードされ、一見安全に見えるコードでもデータ競合エラーを引き起こすことがあった:

swift
// Swift 6.1: 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 }

        // Error: Sending 'self.photoProcessor' risks causing data races
        return await photoProcessor.extractSticker(data: data, with: item.itemIdentifier)
    }
}

Swift 6.2ではこの問題が修正された:非同期関数はデフォルトで呼び出し元と同じActorに留まる。

swift
// Swift 6.2: OK — async stays on MainActor, no data race
@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 }
        return await photoProcessor.extractSticker(data: data, with: item.itemIdentifier)
    }
}

コアパターン——分離の一貫性

MainActor型が非分離プロトコルに安全に準拠できるようになった:

swift
protocol Exportable {
    func export()
}

// Swift 6.1: ERROR — crosses into main actor-isolated code
// Swift 6.2: OK with isolated conformance
extension StickerModel: @MainActor Exportable {
    func export() {
        photoProcessor.exportAsPNG()
    }
}

コンパイラはこの一貫性がMainActor上でのみ使用されることを保証する:

swift
// OK — ImageExporter is also @MainActor
@MainActor
struct ImageExporter {
    var items: [any Exportable]

    mutating func add(_ item: StickerModel) {
        items.append(item)  // Safe: same actor isolation
    }
}

// ERROR — nonisolated context can't use MainActor conformance
nonisolated struct ImageExporter {
    var items: [any Exportable]

    mutating func add(_ item: StickerModel) {
        items.append(item)  // Error: Main actor-isolated conformance cannot be used here
    }
}

コアパターン——グローバル変数と静的変数

MainActorを使用してグローバル/静的状態を保護する:

swift
// Swift 6.1: ERROR — non-Sendable type may have shared mutable state
final class StickerLibrary {
    static let shared: StickerLibrary = .init()  // Error
}

// Fix: Annotate with @MainActor
@MainActor
final class StickerLibrary {
    static let shared: StickerLibrary = .init()  // OK
}
MainActorデフォルト推論パターン

Swift 6.2ではMainActorをデフォルトで推論するパターンが導入された——手動の注釈なし:

swift
// With MainActor default inference enabled:
final class StickerLibrary {
    static let shared: StickerLibrary = .init()  // Implicitly @MainActor
}

final class StickerModel {
    let photoProcessor: PhotoProcessor
    var selection: [PhotosPickerItem]  // Implicitly @MainActor
}

extension StickerModel: Exportable {  // Implicitly @MainActor conformance
    func export() {
        photoProcessor.exportAsPNG()
    }
}

このパターンはオプトインで、アプリ、スクリプト、その他の実行可能ターゲットに推奨される。

コアパターン——@concurrent を使ったバックグラウンド処理

真の並列処理が必要な場合、@concurrent を使って明示的にオフロードする:

重要: この例は「アクセシブルな並行処理」ビルド設定——SE-0466 (MainActorデフォルト分離) と SE-0461 (デフォルト非分離非送信) の有効化が必要。これらの設定を有効にすると、extractSticker は呼び出し元のActorに留まり、可変状態へのアクセスが安全になる。これらの設定なしでは、このコードにはデータ競合がある——コンパイラがフラグを立てる。

swift
nonisolated final class PhotoProcessor {
    private var cachedStickers: [String: Sticker] = [:]

    func extractSticker(data: Data, with id: String) async -> Sticker {
        if let sticker = cachedStickers[id] {
            return sticker
        }

        let sticker = await Self.extractSubject(from: data)
        cachedStickers[id] = sticker
        return sticker
    }

    // Offload expensive work to concurrent thread pool
    @concurrent
    static func extractSubject(from data: Data) async -> Sticker { /* ... */ }
}

// Callers must await
let processor = PhotoProcessor()
processedPhotos[item.id] = await processor.extractSticker(data: data, with: item.id)

@concurrent を使用するには:

  1. コンテナとなる型に nonisolated をマークする
  2. 関数に @concurrent を追加する
  3. 関数がまだ非同期でない場合は async を追加する
  4. 呼び出し側に await を追加する

重要な設計上の決定

決定理由
デフォルトシングルスレッド最も自然なコードはデータ競合がない。並行処理はオプトイン
非同期関数は呼び出し元のActorに留まるデータ競合エラーを引き起こす暗黙のオフロードを排除
分離の一貫性MainActor型が安全でない回避策なしにプロトコルに準拠できる
@concurrent による明示的なオプトインバックグラウンド実行は偶発的なものではなく意図的なパフォーマンス選択
MainActorデフォルト推論アプリターゲットの定型的な @MainActor 注釈を削減
オプトイン採用非破壊的な移行パス——機能を段階的に有効化

移行手順

  1. Xcodeで有効化:ビルド設定のSwift Compiler > Concurrencyセクション
  2. SPMで有効化:パッケージマニフェストで SwiftSettings APIを使用
  3. 移行ツールを使用:swift.org/migrationを通じて自動コード変更
  4. MainActorデフォルトから始める:アプリターゲットの推論モードを有効化
  5. 必要な場所に @concurrent を追加:まずプロファイリングし、ホットパスをオフロード
  6. 徹底的にテスト:データ競合の問題はコンパイル時エラーになる

ベストプラクティス

  • MainActorから始める —— まずシングルスレッドコードを書き、後で最適化する
  • CPU集約的な処理のみに @concurrent を使用する —— 画像処理、圧縮、複雑な計算
  • 主にシングルスレッドのアプリターゲットのMainActor推論モードを有効にする
  • オフロード前にプロファイリングする —— Instrumentsで実際のボトルネックを見つける
  • グローバル変数を保護するために MainActor を使用する —— グローバル/静的な可変状態にはActor分離が必要
  • nonisolated 回避策や @Sendable ラッパーではなく分離の一貫性を使用する
  • 段階的に移行する —— ビルド設定で一度に1つの機能を有効化する

避けるべきアンチパターン

  • すべての非同期関数に @concurrent を適用する(ほとんどはバックグラウンド実行を必要としない)
  • 分離を理解せずにコンパイラエラーを抑制するために nonisolated を使用する
  • Actorが同じ安全性を提供できる場面でレガシーの DispatchQueue パターンを保持する
  • 並行処理関連のFoundation Modelsコードで model.availability チェックをスキップする
  • コンパイラと戦う——データ競合をレポートしている場合、コードには本当の並行処理の問題がある
  • すべての非同期コードがバックグラウンドで実行されると仮定する(Swift 6.2のデフォルト:呼び出し元のActorに留まる)

使用場面

  • すべての新しいSwift 6.2+プロジェクト(「アクセシブルな並行処理」は推奨されるデフォルト設定)
  • Swift 5.x または 6.0/6.1 の並行処理から既存のアプリを移行する場合
  • Xcode 26の採用中にデータ競合安全性のコンパイラエラーを解決する場合
  • MainActorを中心としたアプリアーキテクチャを構築する場合(ほとんどのUIアプリ)
  • パフォーマンス最適化——特定の重い計算をバックグラウンドにオフロードする場合

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

Files

Just SKILL.md in docs/ja-JP/skills/swift-concurrency-6-2 of affaan-m/ECC.

Open the folder on GitHubat commit 4eb71d9

Compare with similar skills

Swift Concurrency 6 2 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 6 2 compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Swift Concurrency 6 2 this skillaffaan-m/ECC276k—~1.5kAutomated safety check: PassMIT
Swift Concurrency Expertharperreed/dotfiles3345 repos~506Automated safety check: PassNone
Swift Concurrency Expertdavila7/claude-code-templates33k3 repos~1.1kAutomated safety check: PassMIT
Swift Concurrencydpearson2699/swift-ios-skills1.2k—~5kAutomated safety check: PassCustom licence
Memorygustavscirulis/snapgrid1161 repos~3kAutomated safety check: PassCustom licence
Swift Concurrency 6 2xu-xiang/everything-claude-code-zh2k—~1.4kAutomated safety check: PassMIT

Similar skills

  • Swift Concurrency Expert

    harperreed/dotfiles

    Swift Concurrency review and remediation for Swift 6.2+. An agent skill from harperreed/dotfiles.

    334 GitHub starsUsed in 5 repos~506 tokens
    MobileAuto-check passed
  • Swift Concurrency Expert

    davila7/claude-code-templates

    Review and fix Swift concurrency issues such as actor isolation and Sendable violations.

    33k GitHub starsUsed in 3 repos~1.1k tokens
    MobileAuto-check passed
  • Swift Concurrency

    dpearson2699/swift-ios-skills

    Resolve Swift concurrency compiler errors, adopt approachable concurrency (SE-0466), and write data-race-safe async code.

    1.2k GitHub stars~5k tokensUpdated 2 mo ago
    MobileAuto-check passed
  • Memory

    gustavscirulis/snapgrid

    Swift 6.2 InlineArray and Span types for zero-overhead memory access, fixed-size collections, and safe pointer alternatives.

    116 GitHub starsUsed in 1 repo~3k tokens
    MobileAuto-check passed
  • Swift Concurrency 6 2

    xu-xiang/everything-claude-code-zh

    Swift 6.2 易用的并发(Approachable Concurrency)—— 默认单线程,使用 @concurrent 进行显式后台卸载,针对主执行角色(Main Actor)类型的隔离一致性。

    2k GitHub stars~1.4k tokensUpdated 7 mo ago
    MobileAuto-check passed
  • Swift Concurrency Updates

    gustavscirulis/snapgrid

    Swift 6.2 concurrency updates including default MainActor inference, @concurrent for background work, isolated conformances, and approachable concurrency migration.

    116 GitHub starsUsed in 1 repo~5.1k tokens
    MobileAuto-check passed

More from affaan-m/ECC

All 682 skills in this repo
  • Skill Stocktake

    affaan-m/ECC

    Audits your installed Claude skills and commands for quality, with a quick mode for recently changed skills and a full mode that evaluates all of them through subagents.

    277k GitHub starsUsed in 5 repos~3.1k tokens
    Auto-check passed
  • Ingests, indexes, searches, edits and monitors video, audio and live streams through the VideoDB Python SDK, returning stream links, clips and timestamps.

    277k GitHub starsUsed in 3 repos~3.5k tokens
    Auto-check: notes
  • Docs Governance

    affaan-m/ECC

    Route broad documentation-governance requests to existing ECC skills and run an opt-in, read-only audit of mapped documentation roles, links, ADR indexes, and evidence references.

    277k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Rules Distillation

    affaan-m/ECC

    Scans installed skills for principles that recur across them and proposes rule-file changes: append, revise, add a section, create a file or leave as covered.

    277k GitHub starsUsed in 2 repos~2.3k tokens
    Auto-check passed
  • Builds DRAFT counterparty agreements from one markdown template and a small JSON spec per party, with clauses picked by the party's role.

    277k GitHub stars~2.9k tokensUpdated today
    Auto-check passed
  • Set an ECC-specific frontend design direction for production UI work.

    277k GitHub starsUsed in 1 repo~2.2k tokens
    Auto-check passed

Works with

Categories

Questions about Swift Concurrency 6 2

What does Swift Concurrency 6 2 do?

Swift 6.2のアクセシブルな並行処理——デフォルトはシングルスレッド、@concurrentは明示的なバックグラウンドオフロードに使用し、分離の一貫性はMainActor型に使用する。. Swift Concurrency 6 2 is an agent skill from affaan-m/ECC.

When should I use Swift Concurrency 6 2?

Swift Concurrency 6 2 fits situations like: mobile work in your project.

How do I install Swift Concurrency 6 2 in Claude Code?

Run `npx skills add affaan-m/ECC --skill swift-concurrency-6-2 -a claude-code`. Or copy the skill folder (docs/ja-JP/skills/swift-concurrency-6-2 in affaan-m/ECC) into .claude/skills/swift-concurrency-6-2 in your project. Claude Code loads it when a task matches its description.

How do I install Swift Concurrency 6 2 in Codex?

Run `npx skills add affaan-m/ECC --skill swift-concurrency-6-2 -a codex`. Or copy the skill folder (docs/ja-JP/skills/swift-concurrency-6-2 in affaan-m/ECC) into .agents/skills/swift-concurrency-6-2 in your project. Codex loads it when a task matches its description.

Can I use Swift Concurrency 6 2 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 affaan-m/ECC --skill swift-concurrency-6-2 -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-6-2, .gemini/skills/swift-concurrency-6-2, .github/skills/swift-concurrency-6-2 and .opencode/skills/swift-concurrency-6-2 in your project.

What does Swift Concurrency 6 2 need to run?

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

Does Swift Concurrency 6 2 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 6 2 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 6 2 use?

Swift Concurrency 6 2 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 6 2 use?

About 1.5k tokens (SKILL.md is roughly 6.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Swift Concurrency 6 2?

Skills that share tags, products or a category with Swift Concurrency 6 2: Swift Concurrency Expert (harperreed/dotfiles, 334 stars), Swift Concurrency Expert (davila7/claude-code-templates, 33k stars), Swift Concurrency (dpearson2699/swift-ios-skills, 1.2k stars) and Memory (gustavscirulis/snapgrid, 116 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Swift Concurrency 6 2?

affaan-m (a GitHub user) maintains it in affaan-m/ECC, which has 276,111 GitHub stars. The repository holds 683 skills in this directory. The repository was last updated on October 10, 2026.

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