swift-expert
Was er macht
Dieser Skill führt die KI durch das Schreiben von Swift-Apps für Apple-Plattformen mit SwiftUI-Bildschirmen und sicherer Nebenläufigkeit. Er richtet sich an Entwickler von Apple-Apps.
Wann du ihn nutzt
- ✓Wenn du eine iPhone- oder Mac-App mit SwiftUI baust.
- ✓Wenn du asynchronen Code, Actors oder threadsichere Daten in einer Swift-App brauchst.
- ✓Wenn du XCTest-Tests für ein Swift-Projekt schreiben lassen willst.
Link zum Skill
https://github.com/Jeffallan/claude-skills/blob/main/skills/swift-expert/SKILL.mdKopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.
So nutzt du ihn
Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.
Fertige Nachricht zum Einfügen
Für Claude Code, Codex oder Cursor: Führe den Befehl in deinem Projektordner aus, dann wird der Skill installiert.
Lade die SKILL.md herunter und lege sie in den Skills-Ordner deines Agenten.
Beispielanfrage an deine KI
“Kannst du mir helfen, einen SwiftUI-Bildschirm zu bauen, der Daten sicher aus dem Netzwerk lädt?”
5 neue Skills pro Woche. 1 Minute Lesezeit.
So funktioniert es
Die KI plant Protokolle und Struktur, schreibt den Swift-Code und baut und testet ihn, um Fehler und Warnungen zur Nebenläufigkeit zu finden.
Technischer Inhalt (originale SKILL.md)
Originaltext des Autors, auf Englisch, direkt von GitHub.
Swift Expert
Core Workflow
- Architecture Analysis - Identify platform targets, dependencies, design patterns
- Design Protocols - Create protocol-first APIs with associated types
- Implement - Write type-safe code with async/await and value semantics
- Optimize - Profile with Instruments, ensure thread safety
- Test - Write comprehensive tests with XCTest and async patterns
Validation checkpoints: After step 3, run
swift buildto verify compilation. After step 4, runswift build -warnings-as-errorsto surface actor isolation and Sendable warnings. After step 5, runswift testand confirm all async tests pass.
Reference Guide
Load detailed guidance based on context:
| Topic | Reference | Load When |
|---|---|---|
| SwiftUI | references/swiftui-patterns.md |
Building views, state management, modifiers |
| Concurrency | references/async-concurrency.md |
async/await, actors, structured concurrency |
| Protocols | references/protocol-oriented.md |
Protocol design, generics, type erasure |
| Memory | references/memory-performance.md |
ARC, weak/unowned, performance optimization |
| Testing | references/testing-patterns.md |
XCTest, 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/awaitfor asynchronous operations (see pattern above) - Ensure
Sendablecompliance 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 unwr
Häufige Fragen
Welche Swift-Version zielt er an?
Der Skill nennt Swift 5.9 und neuer, passend zu modernen Swift-Projekten.
Deckt er Watch- und TV-Apps ab?
Ja. Er nennt watchOS und tvOS neben iOS und macOS.
Was prüft er?
Er führt Build- und Testbefehle aus und achtet auf Warnungen zur Actor-Isolation und zu Sendable.
Details
Originalbeschreibung des Autors
Builds iOS/macOS/watchOS/tvOS applications, implements SwiftUI views and state management, designs protocol-oriented architectures, handles async/await concurrency, implements actors for thread safety, and debugs Swift-specific issues. Use when building iOS/macOS applications with Swift 5.9+, SwiftUI, or async/await concurrency. Invoke for protocol-oriented programming, SwiftUI state management, actors, server-side Swift, UIKit integration, Combine, or Vapor.
repo: Jeffallan/claude-skills
Beliebtheit
- GitHub-Sterne
- 12k
- Platz im Ranking
- #11462
- Lizenz
- MIT
- Aktualisiert
- 30.10.2026
Kommentare
- …
Weitere Skills aus diesem Repository
angular-architect
12kHilft deinem Agenten, Angular-17-und-neuere Apps mit eigenständigen Komponenten, verzögert geladenem Routing, NgRx-Zustand, RxJS-Mustern und Leistungsoptimierung zu bauen.
api-designer
12kHilft deinem Agenten, REST- oder GraphQL-APIs zu entwerfen und OpenAPI-3.1-Spezifikationen zu schreiben, mit Regeln für Ressourcen, Paginierung, Fehlerformate und Versionierung.
architecture-designer
12kHilft deinem Agenten, Systemarchitekturen zu entwerfen, Muster und Technologien zu vergleichen und Architecture Decision Records zu schreiben, die jede Entscheidung erklären.
atlassian-mcp
12kHilft deinem Agenten, Jira-Tickets und Confluence-Seiten über MCP zu suchen und zu aktualisieren, einschließlich JQL- und CQL-Abfragen, Sprints und Dokumentationsabgleich.
Ähnliche Skills
android-clean-architecture
280kLässt deinen Agenten Android-Projekte effizient strukturieren. Der Code wird so organisiert, dass Wartung und neue Features leichter werden.
compose-multiplatform-patterns
280kHilft deinem Agenten, Compose Multiplatform und Jetpack Compose Patterns in KMP-Projekten einzusetzen. Abgedeckt sind State, Navigation, Theming und Performance.
dart-flutter-patterns
280kLässt deinen Agenten Code für Dart- und Flutter-Apps schreiben. Er nutzt moderne Patterns für robuste und gut wartbare Apps.