swift-concurrency-pro
Qué hace
Esta skill hace que tu IA revise código Swift que usa async y await, buscando errores que pueden causar fallos o condiciones de carrera. Está pensada para desarrolladores de Swift que quieren código concurrente más seguro.
Cuándo usarla
- ✓Cuando escribes o cambias código Swift que usa async y await o actores.
- ✓Cuando ves advertencias de concurrencia estricta y necesitas que te las expliquen.
- ✓Cuando quieres revisar pruebas asíncronas o el manejo de cancelaciones en Swift.
Link de la skill
https://github.com/jacklandrin/OnlySwitch/blob/main/doc/skills/swift-concurrency-pro/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
“Revisa mi código de red en Swift por errores de async y dime qué debo arreglar.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
El agente busca patrones de riesgo y revisa actores, tareas, cancelaciones y flujos según las buenas prácticas de Swift 6.2, informando solo de problemas reales.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
Review Swift concurrency code for correctness, modern API usage, and adherence to project conventions. Report only genuine problems - do not nitpick or invent issues.
Review process:
- Scan for known-dangerous patterns using
references/hotspots.mdto prioritize what to inspect. - Check for recent Swift 6.2 concurrency behavior using
references/new-features.md. - Validate actor usage for reentrancy and isolation correctness using
references/actors.md. - Ensure structured concurrency is preferred over unstructured where appropriate using
references/structured.md. - Check unstructured task usage for correctness using
references/unstructured.md. - Verify cancellation is handled correctly using
references/cancellation.md. - Validate async stream and continuation usage using
references/async-streams.md. - Check bridging code between sync and async worlds using
references/bridging.md. - Review any legacy concurrency migrations using
references/interop.md. - Cross-check against common failure modes using
references/bug-patterns.md. - If the project has strict-concurrency errors, map diagnostics to fixes using
references/diagnostics.md. - If reviewing tests, check async test patterns using
references/testing.md.
If doing a partial review, load only the relevant reference files.
Core Instructions
- Target Swift 6.2 or later with strict concurrency checking.
- If code spans multiple targets or packages, compare their concurrency build settings before assuming behavior should match.
- Prefer structured concurrency (task groups) over unstructured (
Task {}). - Prefer Swift concurrency over Grand Central Dispatch for new code. GCD is still acceptable in low-level code, framework interop, or performance-critical synchronous work where queues and locks are the right tool – don't flag these as errors.
- If an API offers both
async/awaitand closure-based variants, always preferasync/await. - Do not introduce third-party concurrency frameworks without asking first.
- Do not suggest
@unchecked Sendableto fix compiler errors. It silences the diagnostic without fixing the underlying race. Prefer actors, value types, orsendingparameters instead. The only legitimate use is for types with internal locking that are provably thread-safe.
Output Format
Organize findings by file. For each issue:
- State the file and relevant line(s).
- Name the rule being violated.
- Show a brief before/after code fix.
Skip files with no issues. End with a prioritized summary of the most impactful changes to make first.
Example output:
DataLoader.swift
Line 18: Actor reentrancy – state may have changed across the await.
// Before
actor Cache {
var items: [String: Data] = [:]
func fetch(_ key: String) async throws -> Data {
if items[key] == nil {
items[key] = try await download(key)
}
return items[key]!
}
}
// After
actor Cache {
var items: [String: Data] = [:]
func fetch(_ key: String) async throws -> Data {
if let existing = items[key] { return existing }
let data = try await download(key)
items[key] = data
return data
}
}
Line 34: Use withTaskGroup instead of creating tasks in a loop.
// Before
for url in urls {
Task { try await fetch(url) }
}
// After
try await withThrowingTaskGroup(of: Data.self) { group in
for url in urls {
group.addTask { try await fetch(url) }
}
for try await result in group {
process(result)
}
}
Summary
- Correctness (high): Actor reentrancy bug on line 18 may cause duplicate downloads and a force-unwrap crash.
- Structure (medium): Unstructured tasks in loop on line 34 lose cancellation propagation.
End of example.
References
references/hotspots.md- Grep targets for code review: known-dangerous patterns and what to check for each.references/new-features.md- Swift 6.2 changes that alter review advice: default actor isolation, isolated conformances, caller-actor async behavior,@concurrent,Task.immediate, task naming, and priority escalation.references/actors.md- Actor reentrancy, shared-state annotations, global actor inference, and isolation patterns.references/structured.md- Task groups over loops, discarding task groups, concurrency limits.references/unstructured.md- Task vs Task.detached, when Task {} is a code smell.- `refere
Preguntas frecuentes
¿Informará de problemas de estilo menores?
No. Solo informa de problemas reales y evita las observaciones triviales.
¿Qué versión de Swift toma como referencia?
Toma como referencia Swift 6.2 o posterior.
¿Puede ayudar a arreglar las advertencias de concurrencia?
Sí. Relaciona los errores de concurrencia estricta con posibles soluciones.
Detalles
Descripción original del autor
Reviews Swift code for concurrency correctness, modern API usage, and common async/await pitfalls. Use when reading, writing, or reviewing Swift concurrency code.
repo: jacklandrin/OnlySwitch
Popularidad
- Estrellas en GitHub
- 6,0 mil
- Posición en el ranking
- #14451
- Licencia
- MIT
- Actualizada
- 1/11/2026
Comentarios
- …
Más skills de este repositorio
onlyswitch-deeplink
6,0 milPermite que tu agente active acciones de OnlySwitch en un Mac, como vaciar la papelera, mantener el equipo despierto o cambiar al modo oscuro, mediante un enlace profundo.
app-store-review
6,0 milAyuda a tu agente a revisar el código de tu app de Apple según las normas de App Store para detectar posibles problemas de rechazo antes de enviarla.
swift-testing-pro
6,0 milAyuda a tu agente a escribir y revisar código de Swift Testing, usando APIs de pruebas modernas, patrones de pruebas asíncronas y una estructura de pruebas limpia.
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.