/ai-swift:swift-concurrency-review [path or files; default = changed files vs git]from ai-swift
Reviews Swift 6 strict-concurrency and SwiftUI code for Sendability, actor isolation mismatches, and build-breaking issues. Reports file:line with fix and rationale.
Ships in ai-swift. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You review Swift source for Swift 6 strict-concurrency correctness and SwiftUI idiom on modern iOS / macOS. The focus is the class of issues the compiler will eventually reject (or that crash swift-frontend, or that pass lint but break at runtime), plus the architectural patterns that keep @Observable services and SwiftUI views clean.
Scope discipline: this is not a general bug hunt or a style cleanup. Hand general correctness to /code-review and reuse/simplification to /simplify. Stay on the Swift-6 / SwiftUI concerns below so the review stays sharp and non-duplicative.
The text typed after the command holds the arguments. In Claude Code it is inserted here: $ARGUMENTS. In other agents, read it from the user's message. It may be empty.
Default to the changed Swift files (git diff --name-only + staged + untracked *.swift). If the arguments name a path or files, review those. If the project has a knowledge base with Swift conventions (for example swift-6-patterns.md under .claude/rules/kb/, .claude/kb/ or docs/kb/), read it first - the project may have its own codified rules that supersede the generic ones here.
For each, report file:line, the issue, the concrete fix, and a one-line why. Cite the compiler diagnostic text where it helps the user recognize it.
body, a value captured into a detached Task, anything an actor method returns) must be Sendable. Endpoint bodies that cross the boundary need (any Encodable & Sendable)?, not bare any Encodable.Sendable (e.g. by adding a non-Sendable class field) break their Codable & Equatable & Sendable contract. Flag a new stored property that is a non-Sendable reference type.CFString and most CoreFoundation types are not Sendable. A struct holding kSec… constants (a keychain wrapper) cannot conform to Sendable; the right move is to drop the conformance when the only consumer is @MainActor, not @preconcurrency import Security.@MainActor witness vs nonisolated protocol requirement. A @MainActor type (including any static func/static let on a SwiftUI.View, which is @MainActor by default) cannot satisfy a non-isolated protocol requirement: "main actor-isolated instance method cannot be used to satisfy nonisolated requirement." Flag in-memory test fakes declared @MainActor that conform to a non-isolated seam - they must be a plain final class.View type read from a nonisolated context (e.g. a plain XCTestCase) warns under Swift 6. If the helper is pure math/string work, mark both the func and the static lets it reads nonisolated.nonisolated init() for default-param evaluation. A @MainActor class used as another @MainActor initializer's default-param value triggers "Call to main actor-isolated initializer in a synchronous nonisolated context." Fix: mark the producer's init() nonisolated when it only sets nonisolated-safe stored properties.extension MainActorClass: Identifiable crosses isolation ("conformance crosses into main actor-isolated code and can cause data races"). Use a plain Sendable struct as the sheet(item:) payload instead.import Combine, ObservableObject, @Published - replace with @Observable + @State/@Environment. Flag any reintroduction.DispatchQueue.main.async to hop to the UI - invisible to the concurrency checker; use Task { @MainActor in … } or await MainActor.run.@unchecked Sendable, nonisolated(unsafe), MainActor.assumeIsolated without a one-line justification comment naming the invariant that makes it safe. These are escape hatches, not defaults.URL(string: "…")! and other force-unwraps (SwiftLint force_unwrapping). Replace static URL literals with a guard let … else { preconditionFailure(…) } helper that crashes loudly if the literal rots.try! on ModelContainer(...) and similar - prefer do/catch + preconditionFailure("…: \(error)") so crash logs name the failure.[String: Any], raw JSON) leaking past the networking layer instead of being decoded into typed models immediately.#Predicate macro limits#Predicate rejects Optional<Date> nil-coalescing combined with other clauses ("cannot convert … to closure result type 'any StandardPredicateExpression'"). Narrow the predicate to clauses the macro accepts and finish the comparison in Swift on the fetch result.#Predicate rejects member access without an explicit base ("Member access without an explicit base … from macro 'Predicate'"). Write Date.distantFuture, not .distantFuture.Cached.from(apiView) over an existing #Unique row orphan @Relationship links - mutate the existing row in place instead.Binding(get: instanceMethod, set: instanceMethod) referencing @MainActor methods crashes swift-frontend on Swift 6.3.x (report_fatal_error in SyncCallEmission::setArgs). Lint passes; only xcodebuild shows it. Fix: closure literals Binding(get: { … }, set: { newValue in … }).#if os(iOS) at the smallest scope: .keyboardType, .textInputAutocapitalization, .navigationBarTitleDisplayMode, .tabViewBottomAccessory. (.textContentType, .autocorrectionDisabled, .scrollDismissesKeyboard are cross-platform - do not over-guard.).windowResizability(.contentMinSize) does nothing without a paired .frame(minWidth:minHeight:), both under #if os(macOS).import UIKit on a cross-platform file belongs inside #if os(iOS).@Environment.@State private var x = SomeService() expected to be shared across services - per-property @State initializers can diverge; construct shared services once and inject.Swift 6 / SwiftUI Review — 4 files
App/Services/AuthService.swift
:31 Force-unwrapped static URL → guard let url = URL(string: literal) else { preconditionFailure(…) }
Why: force_unwrapping fires under --strict and crashes opaquely if the literal rots.
:77 `@MainActor` fake conforms to non-isolated SessionTokenStoring → make it a plain `final class`
Why: a main-actor witness can't satisfy a nonisolated requirement; won't compile under Swift 6.
App/Views/ReaderView.swift
:120 `.keyboardType(.URL)` on a file that compiles for macOS → wrap in #if os(iOS)
Why: the modifier is unavailable on macOS; the file still type-checks for the Mac SDK.
Clean: App/Models/Article.swift, App/App.swift
Summary: 3 findings across 2 files. Run /swift-verify to confirm against the compiler.
This is a report-only review. Do not edit files. Where a finding is build-breaking, say so and recommend /swift-verify to confirm against xcodebuild (the authority over stale SourceKit diagnostics).
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
5 skills in this plugin
/swift-ci-scaffoldScaffold the repo side of Xcode Cloud for an XcodeGen or Tuist Swift project: generate ci_scripts/ci_post_clone.sh (regen plus guarded CI_BUILD_NUMBER stamping), propose a unit-test-only CI scheme, print the exact App Store Connect workflow checklist, and optionally install an opt-in .githooks/pre-push gate. Shows diffs and confirms before writing./swift-diagnoseDiagnose a Swift / Xcode Cloud / TestFlight failure from a pasted red build log, an ITMS App Store rejection email, or a bare error code. Maps symptoms to root cause (ITMS-90242/90296/90683, errSec keychain codes, ad-hoc entitlement rejections, missing ci_scripts, signing errors) and prescribes the exact fix./swift-preflightAudit a Swift, iOS or macOS repo for Xcode Cloud and TestFlight release blockers before upload, from pbxproj drift and static build numbers to signing entitlements and flaky UI tests that gate a release. Reports PASS/WARN/FAIL with file:line and fixes./swift-verifyRun the right local verification gate for a Swift project: detect XcodeGen vs plain .xcodeproj vs SwiftPM vs Tuist, then regenerate (if applicable), swiftformat --lint, swiftlint --strict, and xcodebuild test on the cheapest valid destination (macOS for pure-Swift) or swift build/test for SwiftPM. Reports each stage; --fix lets SwiftFormat rewrite.npx claudepluginhub charlesjones-dev/ai-agent-plugins --plugin ai-swiftOther plugins' skills for the same job