Install
$ agentstack add skill-dev869-swift-tothemax-swift-language ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo 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.
About
Swift to the Max
Expert-level guidance for modern Swift. The goal: code that a senior Swift engineer in 2026 would write — strict-concurrency-clean, value-semantic by default, expressive at the type level, and honest about performance.
Version landscape (mid-2026)
| Version | Status | Headline features | |---|---|---| | Swift 5.10 | legacy | last 5.x; complete strict-concurrency checking under -strict-concurrency=complete | | Swift 6.0 | 2024 | Swift 6 language mode (data-race safety by default), typed throws, count(where:), 128-bit ints | | Swift 6.1 | 2025 | trailing commas everywhere, nonisolated on types/extensions, package traits | | Swift 6.2 | 2025 | approachable concurrency: default MainActor isolation (opt-in), nonisolated(nonsending) / @concurrent, InlineArray, Span/MutableSpan, opt-in strict memory safety, Observations, backtraces on crash | | Swift 6.3 | Mar 2026, current stable | @c attribute (expose Swift to C), official Android SDK, Swift Build preview in SwiftPM, @specialized / @inline(always), module selector syntax (ModuleName::Type), completed Embedded Swift feature set | | Swift 6.4 | WWDC26 beta | await in defer, Iterable protocol (borrowing iteration), anyAppleOS availability shorthand, @diagnose, Swift Testing ↔ XCTest interop, unified URL implementation |
Default to Swift 6 language mode semantics unless the project's Package.swift / build settings say otherwise. Check // swift-tools-version: and swiftLanguageModes: before assuming. Never emit code using a beta-only (6.4) feature without flagging it as such.
Non-negotiable defaults
These apply to essentially all new Swift code; deviate only when the surrounding codebase clearly does otherwise, and say so.
- Value types first.
struct/enumunless you need identity, inheritance, or reference semantics. If you reach forclass, ask whether it should be anactororfinal class. - Strict concurrency clean. No
@unchecked Sendablewithout a written justification (a lock or immutability argument). NoDispatchQueuein new code — use actors,Task,TaskGroup,AsyncSequence,Mutex(Synchronization module, 6.0+). somebeforeany. Existentials (any P) cost dynamic dispatch and boxing; opaque types (some P) keep static dispatch. Useanyonly when you genuinely need heterogeneity.- Exhaustive
switchoverif-chains for enums; avoiddefault:when you can enumerate cases — it silences the compiler when new cases appear. - No force unwraps / force try in production paths.
!is acceptable only for programmer-error invariants, and then preferguard let ... else { preconditionFailure("why") }so the invariant is documented. - Typed throws (
throws(MyError)) for closed error domains (libraries, embedded); plainthrowsfor application-level composition. guardfor early exit, one happy path at low indentation.- API names follow the Swift API Design Guidelines — fluent at the call site, omit needless words (details in
references/api-design-and-errors.md).
Idiom translation table
When reviewing or migrating, rewrite the left column on sight:
| Legacy | Modern | |---|---| | DispatchQueue.global().async { ... } | Task { ... } / Task.detached (rare) / @concurrent func | | DispatchQueue.main.async { ... } | @MainActor function or MainActor.run | | completion handlers (Result) -> Void | async throws -> T (bridge with withCheckedThrowingContinuation) | | NSLock / os_unfair_lock | Mutex (Synchronization) or an actor | | class Foo: NSObject + KVO | @Observable (Observation framework) | | Array fixed-size hot buffers | InlineArray (6.2+) | | UnsafeBufferPointer parameters | Span / RawSpan (6.2+) | | NotificationCenter + selectors | AsyncSequence (notifications(named:)) or Observations | | stringly-typed keys | nested enums / RawRepresentable structs | | #if os(iOS) \|\| os(macOS) \|\| ... across all Apple OSes | anyAppleOS (6.4+, flag as beta) |
Workflow
- Detect the project's Swift version and language mode first (
Package.swift,.xcodeprojsettings,swift --version). Guidance shifts meaningfully between 5.x, 6.0/6.1, and 6.2+ (default MainActor isolation may be on). - Load the relevant reference file(s) below — they carry the depth; this file only carries defaults.
- Compile what you write when a toolchain is available (
swift build,swiftc -typecheck, orxcodebuild). Swift's type checker is the cheapest reviewer you have. For snippets, wrap in a scratch package orswiftc -typechecka single file. - Run the review checklist (bottom of this file) before declaring code done.
Reference routing
Read the file whose domain the task touches. Multiple may apply; read all that do.
| Topic | File | Read when… | |---|---|---| | Concurrency | references/concurrency.md | actors, async/await, Sendable errors, isolation, tasks, streams, migration to Swift 6 mode, 6.2 approachable-concurrency changes | | Types & generics | references/types-and-generics.md | protocols, some/any, associated types, parameter packs, noncopyable (~Copyable) & ~Escapable types, phantom types, result builders | | Memory & performance | references/memory-and-performance.md | ARC, retain cycles, COW, consuming/borrowing, InlineArray/Span, @specialized/@inline(always), allocation profiling, Instruments | | API design & errors | references/api-design-and-errors.md | naming, library ergonomics, typed throws, error architecture, availability, documentation comments | | Macros | references/macros.md | writing or debugging @attached/@freestanding macros, SwiftSyntax, macro testing | | SwiftPM & tooling | references/swiftpm-and-tooling.md | Package.swift authoring, traits, plugins, Swift Build, swiftly, CI setup, pinning toolchains | | Interop & platforms | references/interop-and-platforms.md | C/C++/ObjC bridging, @c, Android SDK, Linux/server, Embedded Swift, WASM | | Testing | references/testing.md | Swift Testing (@Test, #expect), parameterized tests, XCTest migration/interop, async testing |
Review checklist
Run through this before presenting any nontrivial Swift code:
- Does it compile under the project's language mode? (Actually check when possible.)
- Any data-race-safety diagnostics it would trip in Swift 6 mode? Any
@unchecked Sendable,nonisolated(unsafe), or@preconcurrencywithout justification? - Retain cycles: every escaping closure stored on a class/actor audited for
[weak self]need — and no cargo-cult[weak self]where the closure is short-lived (task bodies that finish quickly are fine holdingselfstrongly, if that lifetime is intended). - Force unwraps,
try!,as!— each one justified or removed. - Public API: names read as English phrases at the call site; parameters have sensible defaults; types are
Sendablewhere users will need them to be. - Errors: can callers distinguish the failures they need to handle? Is anything swallowed silently (
try?discarding actionable errors)? - Performance red flags in hot paths: unnecessary existentials, repeated
Arrayreallocation withoutreserveCapacity, string concatenation in loops, O(n)countchecks on lazy sequences. - Availability: does the code use symbols newer than the stated deployment target without
@availableguards?
When NOT to over-apply this skill
- Small scripts and prototypes: correctness and clarity beat architecture. Don't wrap a 30-line script in actors and protocols.
- Existing codebases: match local conventions first; propose modernization separately rather than mixing it into a feature diff.
- Beta features (6.4 as of mid-2026): mention, don't silently use.
Companions & orchestration
Part of the swift-tothemax plugin — apple-dev-conductor routes multi-facet tasks. Siblings: swiftui-max owns the view layer; hand UI questions there. This skill owns everything beneath it. Ecosystem companions (delegate the sub-task if installed, keep this skill's 2026 version facts): swift-concurrency / swift-concurrency-pro for concurrency-correctness review of diffs; swift-testing-pro / swift-testing-expert for test-suite review; swiftdata / swiftdata-pro for persistence layers. If both this skill and a companion produce a checklist, merge and run once.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: Dev869
- Source: Dev869/swift-tothemax
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.