Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
jeffallan avatar

Swift Expert

  • 3.1k installs
  • 10.8k repo stars
  • Updated May 20, 2026
  • jeffallan/claude-skills

swift-expert is an agent skill that implements Swift 5.9+ Apple platform apps with SwiftUI state, async await concurrency, protocol-oriented architecture, and XCTest validation.

About

swift-expert guides iOS, macOS, watchOS, and tvOS development with Swift 5.9+, SwiftUI, async await concurrency, actors, protocol-oriented architecture, UIKit integration, Combine, and Vapor server-side Swift. The core workflow runs architecture analysis, protocol-first API design, type-safe implementation, Instruments profiling for thread safety, and XCTest coverage including async test patterns. Validation checkpoints require swift build after implementation, swift build -warnings-as-errors after optimization to surface actor isolation and Sendable warnings, and swift test confirming async tests pass. Reference guides load by topic for SwiftUI patterns, async concurrency, protocol-oriented design, memory and performance, and testing strategies. Code patterns contrast correct async await error handling versus wrapping legacy completion handlers, @Observable view models versus ObservableObject boilerplate, and protocol repositories with associated types versus class inheritance. Developers invoke it for SwiftUI state management, actor thread safety, protocol-oriented modules, and debugging Swift-specific compiler issues.

  • Five-step workflow: architecture analysis, protocol design, implementation, Instruments profiling, XCTest.
  • Validation checkpoints use swift build, -warnings-as-errors, and swift test for async coverage.
  • Reference guides for SwiftUI, async concurrency, protocol-oriented design, memory, and testing.
  • Promotes @Observable view models and protocol repositories over legacy ObservableObject patterns.
  • Covers iOS, macOS, watchOS, tvOS, UIKit integration, Combine, and Vapor server-side Swift.

Swift Expert by the numbers

  • 3,076 all-time installs (skills.sh)
  • +77 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #45 of 1,048 Mobile Development skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

swift-expert capabilities & compatibility

Capabilities
swiftui state and @observable view models · async await and actor concurrency patterns · protocol oriented repository design · xctest async testing and build validation
Use cases
frontend · testing · debugging
From the docs

What swift-expert says it does

Builds iOS/macOS/watchOS/tvOS applications, implements SwiftUI views and state management
SKILL.md
run `swift build -warnings-as-errors` to surface actor isolation and Sendable warnings
SKILL.md
use @Observable (Swift 5.9+) for view models
SKILL.md
npx skills add https://github.com/jeffallan/claude-skills --skill swift-expert

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs3.1k
repo stars10.8k
Security audit3 / 3 scanners passed
Last updatedMay 20, 2026
Repositoryjeffallan/claude-skills

How do I structure SwiftUI apps with modern async await, actors, and protocol-oriented design while catching concurrency warnings early?

Implement Swift 5.9+ iOS and macOS apps with SwiftUI state, async await concurrency, protocol-oriented design, and XCTest validation checkpoints.

Who is it for?

Developers building iOS or macOS apps with Swift 5.9+, SwiftUI, async await, or UIKit integration needs.

Skip if: Skip for non-Apple platforms, Objective-C-only codebases, or backend services outside Swift and Vapor scope.

When should I use this skill?

User builds iOS or macOS SwiftUI apps, debugs actor isolation, or needs protocol-oriented Swift architecture guidance.

What you get

Type-safe Swift code with @Observable view models, protocol-first APIs, and passing swift build and swift test checkpoints.

  • SwiftUI views and view models
  • Protocol-oriented modules
  • Passing build and test checkpoints

Files

SKILL.mdMarkdownGitHub ↗

Swift Expert

Core Workflow

1. Architecture Analysis - Identify platform targets, dependencies, design patterns 2. Design Protocols - Create protocol-first APIs with associated types 3. Implement - Write type-safe code with async/await and value semantics 4. Optimize - Profile with Instruments, ensure thread safety 5. Test - Write comprehensive tests with XCTest and async patterns

Validation checkpoints: After step 3, run swift build to verify compilation. After step 4, run swift build -warnings-as-errors to surface actor isolation and Sendable warnings. After step 5, run swift test and confirm all async tests pass.

Reference Guide

Load detailed guidance based on context:

TopicReferenceLoad When
SwiftUIreferences/swiftui-patterns.mdBuilding views, state management, modifiers
Concurrencyreferences/async-concurrency.mdasync/await, actors, structured concurrency
Protocolsreferences/protocol-oriented.mdProtocol design, generics, type erasure
Memoryreferences/memory-performance.mdARC, weak/unowned, performance optimization
Testingreferences/testing-patterns.mdXCTest, async tests, mocking strategies

Code Patterns

async/await — Correct vs. Incorrect

// ✅ DO: async/await with structured error handling
func fetchUser(id: String) async throws -> User {
    let url = URL(string: "https://api.example.com/users/\(id)")!
    let (data, _) = try await URLSession.shared.data(from: url)
    return try JSONDecoder().decode(User.self, from: data)
}

// ❌ DON'T: mixing completion handlers with async context
func fetchUser(id: String) async throws -> User {
    return try await withCheckedThrowingContinuation { continuation in
        // Avoid wrapping existing async APIs this way when a native async version exists
        legacyFetch(id: id) { result in
            continuation.resume(with: result)
        }
    }
}

SwiftUI State Management

// ✅ DO: use @Observable (Swift 5.9+) for view models
@Observable
final class CounterViewModel {
    var count = 0
    func increment() { count += 1 }
}

struct CounterView: View {
    @State private var vm = CounterViewModel()

    var body: some View {
        VStack {
            Text("\(vm.count)")
            Button("Increment", action: vm.increment)
        }
    }
}

// ❌ DON'T: reach for ObservableObject/Published when @Observable suffices
class LegacyViewModel: ObservableObject {
    @Published var count = 0  // Unnecessary boilerplate in Swift 5.9+
}

Protocol-Oriented Architecture

// ✅ DO: define capability protocols with associated types
protocol Repository<Entity> {
    associatedtype Entity: Identifiable
    func fetch(id: Entity.ID) async throws -> Entity
    func save(_ entity: Entity) async throws
}

struct UserRepository: Repository {
    typealias Entity = User
    func fetch(id: UUID) async throws -> User { /* … */ }
    func save(_ user: User) async throws { /* … */ }
}

// ❌ DON'T: use classes as base types when a protocol fits
class BaseRepository {  // Avoid class inheritance for shared behavior
    func fetch(id: UUID) async throws -> Any { fatalError("Override required") }
}

Actor for Thread Safety

// ✅ DO: isolate mutable shared state in an actor
actor ImageCache {
    private var cache: [URL: UIImage] = [:]

    func image(for url: URL) -> UIImage? { cache[url] }
    func store(_ image: UIImage, for url: URL) { cache[url] = image }
}

// ❌ DON'T: use a class with manual locking
class UnsafeImageCache {
    private var cache: [URL: UIImage] = [:]
    private let lock = NSLock()  // Error-prone; prefer actor isolation
    func image(for url: URL) -> UIImage? {
        lock.lock(); defer { lock.unlock() }
        return cache[url]
    }
}

Constraints

MUST DO

  • Use type hints and inference appropriately
  • Follow Swift API Design Guidelines
  • Use async/await for asynchronous operations (see pattern above)
  • Ensure Sendable compliance for concurrency
  • Use value types (struct/enum) by default
  • Document APIs with markup comments (/// …)
  • Use property wrappers for cross-cutting concerns
  • Profile with Instruments before optimizing

MUST NOT DO

  • Use force unwrapping (!) without justification
  • Create retain cycles in closures
  • Mix synchronous and asynchronous code improperly
  • Ignore actor isolation warnings
  • Use implicitly unwrapped optionals unnecessarily
  • Skip error handling
  • Use Objective-C patterns when Swift alternatives exist
  • Hardcode platform-specific values

Output Templates

When implementing Swift features, provide: 1. Protocol definitions and type aliases 2. Model types (structs/classes with value semantics) 3. View implementations (SwiftUI) or view controllers 4. Tests demonstrating usage 5. Brief explanation of architectural decisions

Documentation

Related skills

How it compares

Modern Swift and SwiftUI implementation specialist, not a generic mobile marketing brief.

FAQ

What validation checkpoints does swift-expert require?

swift build after implementation, swift build -warnings-as-errors after optimization, and swift test for async tests.

Which reference topics are available?

SwiftUI patterns, async concurrency, protocol-oriented design, memory performance, and testing patterns in references/.

Is Swift Expert safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.