Swift Refactor
pproenca/dot-skills
Swift and SwiftUI refactoring patterns aligned with the iOS 26 / Swift 6.2 clinic modular MVVM-C architecture (Airbnb + OLX SPM layout).
Guide for building, auditing, and refactoring Swift code using modern concurrency patterns (Swift 6+).
$ npx skills add jamesrochabrun/skills --skill swift-concurrency -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install jamesrochabrun/skills swift-concurrency --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/jamesrochabrun/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/swift-concurrency .claude/skills/swift-concurrency && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "swift-concurrency" agent skill from https://github.com/jamesrochabrun/skills/tree/main/skills/swift-concurrency into .claude/skills/swift-concurrency/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "swift-concurrency", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/jamesrochabrun/skills/tree/main/skills/swift-concurrencyType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add jamesrochabrun/skills --skill swift-concurrency -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install jamesrochabrun/skills swift-concurrency --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/jamesrochabrun/skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/swift-concurrency .agents/skills/swift-concurrency && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "swift-concurrency" agent skill from https://github.com/jamesrochabrun/skills/tree/main/skills/swift-concurrency into .agents/skills/swift-concurrency/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "swift-concurrency", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add jamesrochabrun/skills --skill swift-concurrency -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install jamesrochabrun/skills swift-concurrency --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/jamesrochabrun/skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/swift-concurrency .cursor/skills/swift-concurrency && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "swift-concurrency" agent skill from https://github.com/jamesrochabrun/skills/tree/main/skills/swift-concurrency into .cursor/skills/swift-concurrency/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "swift-concurrency", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/jamesrochabrun/skills.git --path skills/swift-concurrency--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add jamesrochabrun/skills --skill swift-concurrency -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install jamesrochabrun/skills swift-concurrency --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/jamesrochabrun/skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/swift-concurrency .gemini/skills/swift-concurrency && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "swift-concurrency" agent skill from https://github.com/jamesrochabrun/skills/tree/main/skills/swift-concurrency into .gemini/skills/swift-concurrency/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "swift-concurrency", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install jamesrochabrun/skills swift-concurrencyInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add jamesrochabrun/skills --skill swift-concurrency -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/jamesrochabrun/skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/swift-concurrency .github/skills/swift-concurrency && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "swift-concurrency" agent skill from https://github.com/jamesrochabrun/skills/tree/main/skills/swift-concurrency into .github/skills/swift-concurrency/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "swift-concurrency", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add jamesrochabrun/skills --skill swift-concurrency -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install jamesrochabrun/skills swift-concurrency --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/jamesrochabrun/skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/swift-concurrency .opencode/skills/swift-concurrency && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "swift-concurrency" agent skill from https://github.com/jamesrochabrun/skills/tree/main/skills/swift-concurrency into .opencode/skills/swift-concurrency/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "swift-concurrency", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
swift-concurrencyGuide for building, auditing, and refactoring Swift code using modern concurrency patterns (Swift 6+).
Swift Concurrency is an agent skill from jamesrochabrun/skills. Guide for building, auditing, and refactoring Swift code using modern concurrency patterns (Swift 6+). This skill should be used when working with async/await, Tasks, actors, MainActor, Sendable types, isolation domains, or when migrating legacy callback/Combine code to structured concurrency. Covers Approachable Concurrency settings, isolated parameters, and common pitfalls.
Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including reference files (for example `references/common-mistakes.md`, `references/fundamentals.md` and `references/glossary.md`).
It sits in Development, covering Async programming, iOS development and Refactoring. It works with Swift and SwiftUI. The licence is MIT.
4 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 2482c17. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are swift).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Swift Concurrency loads about 1.9k tokens when it runs, and up to ~9.9k if it reads all its reference files. Until then it costs about 99 tokens; SKILL.md has 429 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from jamesrochabrun/skills at commit 2482c17, republished under its MIT licence (© jamesrochabrun). 429 words, ~1,934 tokens.
.claude/skills/swift-concurrency/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.This skill provides guidance for writing thread-safe Swift code using modern concurrency patterns. It covers three main workflows: building new async code, auditing existing code for issues, and refactoring legacy patterns to Swift 6+.
Core principle: Isolation is inherited by default. With Approachable Concurrency, code starts on MainActor and propagates through the program automatically. Opt out explicitly when needed.
What are you doing?
│
├─► BUILDING new async code
│ └─► See "Building Workflow" below
│
├─► AUDITING existing code
│ └─► See "Auditing Checklist" below
│
└─► REFACTORING legacy code
└─► See "Refactoring Workflow" belowWhen writing new async code, follow this decision process:
Does this type manage UI state or interact with UI?
│
├─► YES → Mark with @MainActor
│
└─► NO → Does it have mutable state shared across contexts?
│
├─► YES → Consider: Can it live on MainActor anyway?
│ │
│ ├─► YES → Use @MainActor (simpler)
│ │
│ └─► NO → Use a custom actor (requires justification)
│
└─► NO → Leave non-isolated (default with Approachable Concurrency)// PREFER: Inherit caller's isolation (works everywhere)
func fetchData(isolation: isolated (any Actor)? = #isolation) async throws -> Data {
// Runs on whatever actor the caller is on
}
// USE WHEN: CPU-intensive work that must run in background
@concurrent
func processLargeFile() async -> Result { }
// AVOID: Non-isolated async without explicit choice
func ambiguousAsync() async { } // Where does this run?// For known number of independent operations
async let avatar = fetchImage("avatar.jpg")
async let banner = fetchImage("banner.jpg")
let (a, b) = await (avatar, banner)
// For dynamic number of operations
try await withThrowingTaskGroup(of: Void.self) { group in
for id in userIDs {
group.addTask { try await fetchUser(id) }
}
try await group.waitForAll()
}struct ProfileView: View {
@State private var avatar: Image?
var body: some View {
avatar
.task { avatar = await downloadAvatar() } // Auto-cancels on disappear
.task(id: userID) { /* Reloads when userID changes */ }
}
}
// For user actions
Button("Save") {
Task { await saveProfile() } // Inherits MainActor isolation
}When reviewing Swift concurrency code, check for these issues:
DispatchSemaphore.wait(), DispatchGroup.wait(), or similar blocking calls inside async contextsMainActor.run: Should usually be @MainActor on the function insteadTask { } instead of async let or TaskGroupTask.isCancelled@MainActor (or use @Observable)// BEFORE: Callback-based
func fetchUser(id: Int, completion: @escaping (Result<User, Error>) -> Void) {
URLSession.shared.dataTask(with: url) { data, _, error in
if let error { completion(.failure(error)); return }
// ...
}.resume()
}
// AFTER: async/await with continuation
func fetchUser(id: Int) async throws -> User {
try await withCheckedThrowingContinuation { continuation in
fetchUser(id: id) { result in
continuation.resume(with: result)
}
}
}// BEFORE: Queue-based protection
class BankAccount {
private let queue = DispatchQueue(label: "account")
private var _balance: Double = 0
var balance: Double {
queue.sync { _balance }
}
func deposit(_ amount: Double) {
queue.async { self._balance += amount }
}
}
// AFTER: Actor (if truly needs own isolation)
actor BankAccount {
var balance: Double = 0
func deposit(_ amount: Double) {
balance += amount
}
}
// BETTER: MainActor class (if doesn't need concurrent access)
@MainActor
class BankAccount {
var balance: Double = 0
func deposit(_ amount: Double) {
balance += amount
}
}// BEFORE: Combine publisher
cancellable = NotificationCenter.default
.publisher(for: .userDidLogin)
.sink { notification in /* ... */ }
// AFTER: AsyncSequence
for await _ in NotificationCenter.default.notifications(named: .userDidLogin) {
// Handle notification
}| Keyword | Purpose |
|---|---|
async | Function can suspend |
await | Suspension point |
Task { } | Start async work, inherits isolation |
Task.detached { } | Start async work, no inheritance |
@MainActor | Runs on main thread |
actor | Type with isolated mutable state |
nonisolated | Opts out of actor isolation |
nonisolated(nonsending) | Inherits caller's isolation |
@concurrent | Always run on background (Swift 6.2+) |
Sendable | Safe to cross isolation boundaries |
sending | One-way transfer of non-Sendable |
async let | Start parallel work |
TaskGroup | Dynamic parallel work |
For new Xcode 26+ projects, these are enabled by default:
SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor
SWIFT_APPROACHABLE_CONCURRENCY = YESEffects:
nonisolated async functions stay on caller's actor instead of hopping to backgroundFor detailed technical reference, consult:
references/fundamentals.md - async/await, Tasks, structured concurrencyreferences/isolation.md - Actors, MainActor, isolation domains, inheritancereferences/sendable.md - Sendable protocol, non-Sendable patterns, isolated parametersreferences/common-mistakes.md - Detailed examples of what to avoidreferences/glossary.md - Complete terminology referenceSearch patterns for references:
grep -i "isolation\|actor\|mainactor\|nonisolated"grep -i "sendable\|sending\|boundary"grep -i "task\|taskgroup\|async let\|structured"© jamesrochabrun, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 5 other files (references) in skills/swift-concurrency of jamesrochabrun/skills.
Open the folder on GitHubat commit 2482c17
Swift Concurrency next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Swift Concurrency this skilljamesrochabrun/skills | 216 | — | ~1.9k | Automated safety check: Pass | MIT | |
| Swift Refactorpproenca/dot-skills | 215 | — | ~3k | Automated safety check: Pass | MIT | |
| Swift Datapproenca/dot-skills | 215 | — | ~3.4k | Automated safety check: Pass | MIT | |
| Swift Concurrencyhenrypldev/react-native-nitro-mlx | 100 | 3 repos | ~3.1k | Automated safety check: Pass | MIT | |
| Swift Concurrencynimblehq/ios-templates | 110 | — | ~1.7k | Automated safety check: Pass | MIT | |
| cmux Swift Package Architecturemanaflow-ai/cmux | 28k | 1 repos | ~4.2k | Automated safety check: Pass | Custom licence |
pproenca/dot-skills
Swift and SwiftUI refactoring patterns aligned with the iOS 26 / Swift 6.2 clinic modular MVVM-C architecture (Airbnb + OLX SPM layout).
pproenca/dot-skills
SwiftData persistence and data-layer architecture for iOS 26 / Swift 6.2 clinic modular MVVM-C apps.
henrypldev/react-native-nitro-mlx
Diagnose Swift Concurrency issues, refactor callback-based code to async/await, and guide Swift 6 migration when working with tasks, actors, @MainActor, Sendable, data races, thread safety, or…
nimblehq/ios-templates
Write, review, or fix Swift 6 concurrency code using actors, Sendable, structured concurrency, and the strict data-race-safety model.
manaflow-ai/cmux
Architecture rules for cmux's move to Swift Packages: acyclic whole-domain packages, minimal public API, group folders, Xcode project wiring and Swift 6 concurrency.
gustavscirulis/snapgrid
Swift concurrency patterns including Swift 6.2 approachable concurrency, structured concurrency, actors, continuations, and migration.
jamesrochabrun/skills
Generate comprehensive Product Requirements Documents (PRDs) for product managers.
jamesrochabrun/skills
Plan and execute technical product launches for developer tools, APIs, and technical products.
jamesrochabrun/skills
Generate comprehensive design briefs for design projects. An agent skill from jamesrochabrun/skills.
jamesrochabrun/skills
Manage Git worktrees for parallel Claude Code development. An agent skill from jamesrochabrun/skills.
jamesrochabrun/skills
Generate comprehensive content briefs for writers, ensuring clarity, alignment, and strategic content creation across all formats.
jamesrochabrun/skills
This skill should be used when users want to route LLM requests to different AI providers (OpenAI, Grok/xAI, Groq, DeepSeek, OpenRouter) using SwiftOpenAI-CLI.
Categories
Guide for building, auditing, and refactoring Swift code using modern concurrency patterns (Swift 6+). Swift Concurrency is an agent skill from jamesrochabrun/skills. Guide for building, auditing, and refactoring Swift code using modern concurrency patterns (Swift 6+).
Swift Concurrency fits situations like: tasks that involve Async programming; tasks that involve iOS development; tasks that involve Refactoring.
Run `npx skills add jamesrochabrun/skills --skill swift-concurrency -a claude-code`. Or copy the skill folder (skills/swift-concurrency in jamesrochabrun/skills) into .claude/skills/swift-concurrency in your project. Claude Code loads it when a task matches its description.
Run `npx skills add jamesrochabrun/skills --skill swift-concurrency -a codex`. Or copy the skill folder (skills/swift-concurrency in jamesrochabrun/skills) into .agents/skills/swift-concurrency in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jamesrochabrun/skills --skill swift-concurrency -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/swift-concurrency, .gemini/skills/swift-concurrency, .github/skills/swift-concurrency and .opencode/skills/swift-concurrency in your project.
SKILL.md names no scripts, command-line tools or credentials: Swift Concurrency is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Swift Concurrency is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.9k tokens (SKILL.md is roughly 7.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 8k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Swift Concurrency: Swift Refactor (pproenca/dot-skills, 215 stars), Swift Data (pproenca/dot-skills, 215 stars), Swift Concurrency (henrypldev/react-native-nitro-mlx, 100 stars) and Swift Concurrency (nimblehq/ios-templates, 110 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
jamesrochabrun (a GitHub user) maintains it in jamesrochabrun/skills, which has 216 GitHub stars. The repository holds 23 skills in this directory. The repository was last updated on January 14, 2026.
Source: jamesrochabrun/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.