/major-ai-skills:swiftfrom major-ai-skills
Write Swift with optionals, value types, protocols, async/await, and actors; manage state in SwiftUI workflows.
Ships in major-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Swift emphasizes safe value semantics (struct/enum), optionals instead of null, and structured concurrency (async/await, Task, actor). Agents prefer value types for models, isolate mutable shared state in actors, avoid force-unwraps, and keep SwiftUI views thin by moving logic into models/observables.
Task / async call
|
await suspension
|
actor-isolated state (optional)
|
UI update on MainActor
struct + Codable for models; use class when identity/sharing is required.@MainActor when they publish to SwiftUI.async throws APIs; map errors at the boundary for user display.! force unwraps; use guard let / if let / nil-coalescing deliberately.struct Item: Identifiable, Codable, Sendable {
let id: String
let sku: String
let qty: Int
}
enum ItemsError: Error {
case invalidResponse
}
actor ItemStore {
private var cache: [Item] = []
func load(from url: URL) async throws -> [Item] {
let (data, response) = try await URLSession.shared.data(from: url)
guard let http = response as? HTTPURLResponse, http.statusCode == 200 else {
throw ItemsError.invalidResponse
}
let items = try JSONDecoder().decode([Item].self, from: data)
cache = items
return items
}
}
swift build
swift test
xcodebuild -scheme Inventory -destination 'platform=iOS Simulator,name=iPhone 16' test
| Pitfall | Why it hurts | Fix |
|---|---|---|
| UI updates off main actor | Crashes / warnings | @MainActor |
| Retain cycles in closures | Leaks | [weak self] |
| Overusing classes | Unexpected sharing | Value types |
| Swallowing errors as optional | Silent failures | Propagate throws |
Result only when bridging non-throwing APIs; prefer throws in new code.internal/public) intentional for modules.@xcode-ios - Xcode signing, schemes, archives@kotlin - peer language for Android@firebase - common iOS backend SDKsWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub alivirgo/major-ai-skills --plugin major-ai-skills412 skills in this plugin
/3d-slicerAutomate 3D Slicer research workflows with MRML, VTK/ITK, DICOM data, and Segment Editor. Use for software workflows, not clinical interpretation./abbreviated-git-statusInspect Git branch, staging, and working-tree changes with short or porcelain status output when a compact repository check is needed./ableton-liveAutomate Ableton Live sessions with Python MIDI Remote Scripts, Max for Live, AbletonOSC, and Link synchronization./act-as-a-personal-tutorExplain a subject step by step, assess prior knowledge, and use short exercises to check understanding before advancing.Other plugins' skills for the same job