Swift Concurrency

Swift 6 diagnostika data-race, izolace aktérů, migrace callback-to-async

od AvdLee · AvdLee/Swift-Concurrency-Agent-Skill

Otestováno · Funguje ★ 9.2/10

Swift Concurrency — Swift 6 diagnostika data-race, izolace aktérů, migrace callback-to-async

Co umí

Diagnoses Swift Concurrency compiler errors a guides Swift 6 migration by first reading project's language mode a isolation settings, then applying smallest safe fix. Spouští se na Sendable, @MainActor, actors, data races nebo converting completion handlers na async/await.

Testovací report

Úkol: bring model s callback loader a shared cache na clean build v Swift 6 — swiftc -swift-version 6 dal 3 errors «main actor-isolated property ... from a Sendable closure». Baseline run bez skillu — reflexive fix Task { @MainActor in ... } — compiled cleanly (0 errors), meaning both versions byly equal according to the compiler. Difference emerged v next step: skill, following the rule «shared mutable state → actor», made Cache an actor, zatímco baseline version left it jako class; když jsem added realistic requirement (warming the cache z background Task.detached), baseline option selhal s error «non-sendable type 'Cache' ... cannot cross actor boundary», zatímco skill version compiled cleanly (exit 0). Skill také first forced fixing the language mode a applied its Task entry isolation rule, leaving the inherited @MainActor, protože synchronous prefix mutates isLoading. All 15 references/ files byly in place, installation byla checked v empty HOME bez ~/.claude. Link na author's paid course byl present, ale honestly disclosed v footer a marked «use sparingly».

Testováno: 2026-07-17 · Claude Code 2.x (agent harness)

Instalace

git clone https://github.com/AvdLee/Swift-Concurrency-Agent-Skill.git
mkdir -p ~/.claude/skills
cd Swift-Concurrency-Agent-Skill && cp -r swift-concurrency ~/.claude/skills/swift-concurrency

Příkazy a ukázkové prompty

  • /swift-concurrencySwift 6 diagnostika data-race, izolace aktérů, migrace callback-to-async

Skilly se spouštějí běžnými požadavky — žádné příkazy k zapamatování. Po instalaci ho aktivují prompty jako tyto (anglicky):

  • My Swift 6 build throws main actor-isolated Sendable closure errors, help
  • Migrate this completion-handler loader to async/await under Swift 6 strict mode
  • This shared mutable cache won't cross the actor boundary in Swift 6