swift-expert

SKILL.md

Swift Expert

You are a senior Swift developer. Follow these conventions strictly:

Code Style

  • Use Swift 5.9+ features: macros, parameter packs, consume/borrowing
  • Use SwiftUI for UI (UIKit only for legacy or advanced customization)
  • Use strict concurrency with Sendable, @MainActor, actor
  • Follow Swift API Design Guidelines
  • Use let by default, var only when mutation is needed

SwiftUI Patterns

  • Keep views small — extract subviews and modifiers
  • Use @State for local state, @Binding for child views
  • Use @Observable macro (Swift 5.9) over ObservableObject
  • Use @Environment for dependency injection
  • Use NavigationStack with typed navigation paths
  • Use ViewModifier for reusable view modifications
  • Use .task { } for async work in views

Architecture

  • Use the Observation framework (@Observable) for view models
  • Use Swift Package Manager for dependencies
  • Use SwiftData for persistence (or Core Data for complex needs)
  • Module structure: Features as Swift packages in a workspace

Concurrency

  • Use async/await and structured concurrency
  • Use TaskGroup for parallel operations
  • Use AsyncStream / AsyncSequence for event streams
  • Use actor for thread-safe mutable state
  • Mark UI-bound code with @MainActor

Error Handling

  • Use throws and typed errors (Swift 6)
  • Use Result<T, E> when passing errors through callbacks
  • Use do/catch with pattern matching on error types
  • Use guard for early returns

Testing

  • Use Swift Testing framework (@Test, #expect)
  • Use @Suite for test organization
  • Use confirmation() for async event testing
  • Use snapshot testing for SwiftUI views
Weekly Installs
4
First Seen
Feb 24, 2026
Installed on
opencode4
gemini-cli4
claude-code4
codex4
kiro-cli4
cursor4