swift-expert
Qué hace
Guía a la IA para escribir apps de Swift para las plataformas de Apple, con pantallas de SwiftUI y concurrencia segura. Está pensada para desarrolladores que crean apps para Apple.
Cuándo usarla
- ✓Cuando construyes una app de iPhone o Mac con SwiftUI.
- ✓Cuando necesitas código asíncrono, actors o datos seguros para hilos en una app de Swift.
- ✓Cuando quieres pruebas de XCTest escritas para un proyecto de Swift.
Link de la skill
https://github.com/Jeffallan/claude-skills/blob/main/skills/swift-expert/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“¿Me ayudas a construir una pantalla de SwiftUI que cargue datos de la red de forma segura?”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
La IA planifica los protocolos y la estructura, escribe el código de Swift y después compila y ejecuta las pruebas para detectar errores y advertencias de concurrencia.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de 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
Preguntas frecuentes
¿Qué versión de Swift apunta?
La habilidad menciona Swift 5.9 y posteriores, así que encaja con los proyectos modernos de Swift.
¿Cubre apps para reloj y televisión?
Sí. Menciona watchOS y tvOS junto a iOS y macOS.
¿Qué comprueba?
Ejecuta los comandos de compilación y de prueba, y vigila las advertencias de aislamiento de actors y de Sendable.
Detalles
Descripción original del autor
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
Popularidad
- Estrellas en GitHub
- 12 mil
- Posición en el ranking
- #11462
- Licencia
- MIT
- Actualizada
- 30/10/2026
Comentarios
- …
Más skills de este repositorio
angular-architect
12 milAyuda a tu agente a construir apps de Angular 17 y posteriores con componentes independientes, enrutamiento con carga diferida, estado con NgRx, patrones de RxJS y optimización del rendimiento.
api-designer
12 milAyuda a tu agente a diseñar APIs REST o GraphQL y a escribir especificaciones OpenAPI 3.1, con reglas para recursos, paginación, formatos de error y versionado.
architecture-designer
12 milAyuda a tu agente a diseñar la arquitectura de un sistema, comparar patrones y tecnologías, y escribir Registros de Decisiones de Arquitectura que expliquen cada elección.
atlassian-mcp
12 milAyuda a tu agente a buscar y actualizar incidencias de Jira y páginas de Confluence mediante MCP, incluidas las consultas JQL y CQL, los sprints y la sincronización de la documentación.
Skills parecidas
android-clean-architecture
280 milHace que tu agente organice proyectos de Android de forma eficiente. Estructura el código para facilitar el mantenimiento y el desarrollo de nuevas funciones.
compose-multiplatform-patterns
280 milAyuda a tu agente a usar patrones de Compose Multiplatform y Jetpack Compose en proyectos KMP, incluyendo estado, navegación, temas y rendimiento.
dart-flutter-patterns
280 milHace que tu agente escriba código para apps de Dart y Flutter. Usa patrones modernos para crear apps robustas y fáciles de mantener.