Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Swift Concurrency

ASecurity

Diagnoses and implements data-race-safe Swift concurrency with actor isolation, Sendable, structured tasks, cancellation, and synchronization. Use for compiler diagnostics or async behavior; when the requested deliverable is a PR or diff review, select swift-code-review first.

3 stars
0 votes
0 copies
0 views
Added 9/28/2026
developmentgoswifttestingcode-reviewapidocumentation

Works with

terminalapi

Security Analysis

A100/100

Scanned 9/28/2026

Install to Claude Code

$npx -y skills add thiennc-tesoglobal/ios-skills --skill swift-concurrency --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Swift Concurrency?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Swift Concurrency
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/thiennc-tesoglobal-swift-concurrency/badge)](https://www.skillsdirectory.com/skills/thiennc-tesoglobal-swift-concurrency)

More formats (shields.io, HTML) on the badges page.

Files
SKILL.md
---
name: swift-concurrency
description: "Diagnoses and implements data-race-safe Swift concurrency with actor isolation, Sendable, structured tasks, cancellation, and synchronization. Use for compiler diagnostics or async behavior; when the requested deliverable is a PR or diff review, select swift-code-review first."
---

# Swift Concurrency

Apply the smallest change that makes isolation and ownership correct while preserving observable behavior.

## Contents

- [Scope and Toolchain Preflight](#scope-and-toolchain-preflight)
- [Diagnostic Workflow](#diagnostic-workflow)
- [Isolation Decisions](#isolation-decisions)
- [Safety Rules](#safety-rules)
- [Interop and Streams](#interop-and-streams)
- [Common Mistakes](#common-mistakes)
- [Review Checklist](#review-checklist)
- [References](#references)

## Scope and Toolchain Preflight

This skill owns compiler concurrency diagnostics, actor isolation, `Sendable`, task structure, cancellation, reentrancy, async sequences, continuations, and synchronization. Route routine SwiftUI `.task` ownership to `swiftui-patterns`, app architecture to `swift-architecture`, and test syntax to `swift-testing`.

Before recommending versioned language features, inspect:

- Xcode and Swift toolchain version
- Swift language mode and strict-concurrency setting
- Approachable Concurrency setting
- Default Actor Isolation setting
- deployment target when a runtime API is involved

Do not change project-wide isolation or language settings unless the request includes migration or build configuration. Verify new language/API claims against Swift Evolution, release notes, SDK headers, or primary Apple/Swift documentation.

## Diagnostic Workflow

1. Capture the exact diagnostic and declaration involved.
2. Identify current isolation, mutation owner, call direction, and values crossing the boundary.
3. Decide whether the operation is UI-bound, stateful background work, stateless work, or legacy interop.
4. Apply the narrowest safe fix and avoid broad escape hatches.
5. Rebuild, inspect new diagnostics, and test cancellation/failure behavior affected by the change.

Use [Diagnostics](references/diagnostics.md) for compiler-message-specific remedies and [Approachable Concurrency](references/approachable-concurrency.md) for build-setting semantics.

## Isolation Decisions

| Situation | Prefer |
|---|---|
| UI-bound mutable state | Type or relevant member isolated to `@MainActor` |
| Cohesive mutable background state | A dedicated actor |
| Immutable value crossing tasks | A genuinely `Sendable` value type |
| Stateless CPU-heavy async operation | An appropriately isolated/nonisolated concurrent function supported by the toolchain |
| Synchronous shared state | A suitable lock or synchronization primitive with a documented invariant |
| Callback/delegate API | A checked continuation or stream with exactly-once completion and cancellation cleanup |

Default MainActor isolation does not make every operation appropriate for the main actor. Keep CPU-heavy work, blocking I/O, and non-UI services off it. Conversely, do not remove isolation merely to silence a compiler error.

## Safety Rules

- Prefer structured child tasks over detached tasks so priority, task-local values, and cancellation propagate.
- Treat cancellation as cooperative: check it at meaningful boundaries and clean up resources.
- Revalidate actor state after every suspension point when intervening work could change it.
- Add `Sendable` only when the stored graph and mutation model make the conformance true.
- Use `@unchecked Sendable` or `nonisolated(unsafe)` only with a local, documented invariant and targeted verification.
- Never hold a synchronous lock across `await`.
- Do not place locks inside an actor to protect the actor's own state.
- Avoid semaphores and blocking waits on cooperative executor threads.
- A manual task needs a clear owner, cancellation point, and lifetime.

Read [Synchronization Primitives](references/synchronization-primitives.md) for locks versus actors, and [Concurrency Patterns](references/concurrency-patterns.md) for task groups, actors, cancellation, and reentrancy examples.

## Interop and Streams

Use checked continuations for one-shot callbacks and resume exactly once on every terminal path. Use `AsyncStream`/`AsyncThrowingStream` for multiple values and install termination cleanup for delegates, observers, or underlying operations.

Read [Bridging and Interop](references/bridging-interop.md) before adapting delegates, GCD, unsafe buffers, or synchronous parallel loops. Read [Async Algorithms](references/async-algorithms.md) for debounce, throttle, merge, and related sequence operations.

## Common Mistakes

- Silencing compiler concurrency errors with `@unchecked Sendable` or removing isolation without an invariant.
- Holding an unfair lock or `NSLock` across an `await` suspension point.
- Spawning detached tasks (`Task.detached`) instead of structured child tasks (`async let`, `TaskGroup`).
- Assuming actor state is unchanged after `await` without revalidating invariants.
- Blocking cooperative executor threads with synchronous disk/network I/O or `Thread.sleep`.

## Review Checklist

- [ ] Exact toolchain and concurrency settings are known when they matter
- [ ] Every mutable state graph has a clear isolation owner
- [ ] Cross-isolation values are safely transferable
- [ ] No blocking work runs on the main actor or cooperative pool
- [ ] Structured tasks are preferred; detached/manual tasks are justified
- [ ] Cancellation, failure, and resource cleanup are tested
- [ ] Actor state assumptions are reconsidered after `await`
- [ ] No unjustified `@unchecked Sendable`, `nonisolated(unsafe)`, or `@preconcurrency` remains
- [ ] Locks are synchronous, local, and never held across suspension
- [ ] The compiler diagnostic is gone without changing unrelated behavior

## References

- [Concurrency patterns and migration](references/concurrency-patterns.md)
- [Approachable Concurrency](references/approachable-concurrency.md)
- [SwiftUI-specific concurrency](references/swiftui-concurrency.md)
- [Synchronization primitives](references/synchronization-primitives.md)
- [Callbacks, GCD, and unsafe interop](references/bridging-interop.md)
- [Compiler diagnostics](references/diagnostics.md)
- [Async algorithms](references/async-algorithms.md)

Attribution

thiennc-tesoglobalthiennc-tesoglobal
View sourceMore from thiennc-tesoglobal →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

284972 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2222 votes

Google Official Seo Guide

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

1862 votes

Tanstack Start

Build a full-stack TanStack Start app on Cloudflare Workers from scratch — SSR, file-based routing, server functions, D1+Drizzle, better-auth, Tailwind v4+shadcn/ui. Use whenever the user mentions TanStack Start, asks to scaffold a full-stack Cloudflare app with SSR, wants an SSR dashboard, or asks for a React 19 + Cloudflare Workers app with file-based routing and server functions — even if they don't name TanStack Start specifically. No template repo — Claude generates every file fresh per ...

10311 votes

Pentest

PTES-aligned adversarial security audit for backend, frontend, and mobile applications. Produces a CVSS-scored Hacker Report with verified PoCs and phased remediation.

5491 votes
View all in development →