axiom-swift-concurrency▌
charleswiltgen/axiom · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Purpose: Progressive journey from single-threaded to concurrent Swift code
- ›Swift Version: Swift 6.3 (strict concurrency by default). @concurrent requires Swift 6.2+.
- ›iOS Version: iOS 17+ (iOS 26+ for @concurrent)
- ›Xcode: Xcode 16+ (Xcode 26+ for @concurrent)
Swift 6 Concurrency Guide
Purpose: Progressive journey from single-threaded to concurrent Swift code
Swift Version: Swift 6.3 (strict concurrency by default). @concurrent requires Swift 6.2+.
iOS Version: iOS 17+ (iOS 26+ for @concurrent)
Xcode: Xcode 16+ (Xcode 26+ for @concurrent)
When to Use This Skill
✅ Use this skill when:
- Starting a new project and deciding concurrency strategy
- Debugging Swift 6 concurrency errors (actor isolation, data races, Sendable warnings)
- Deciding when to introduce async/await vs concurrency
- Implementing
@MainActorclasses or async functions - Converting delegate callbacks to async-safe patterns
- Deciding between
@MainActor,nonisolated,@concurrent, or actor isolation - Resolving "Sending 'self' risks causing data races" errors
- Making types conform to
Sendable - Offloading CPU-intensive work to background threads
- UI feels unresponsive and profiling shows main thread bottleneck
❌ Do NOT use this skill for:
- General Swift syntax (use Swift documentation)
- SwiftUI-specific patterns (use
axiom-swiftui-debuggingoraxiom-swiftui-performance) - API-specific patterns (use API documentation)
Core Philosophy: Think in Isolation Domains, Not Threads
"Your apps should start by running all of their code on the main thread, and you can get really far with single-threaded code." — Apple
Stop asking: "What thread should this run on?" Start asking: "What isolation domain should own this work?"
@MainActor→ UI state ownership- Custom
actor→ shared mutable state ownership nonisolated→ no ownership, caller decides@concurrent→ force background execution
Async does not mean background. An async function suspends without blocking, but resumes on the same actor it was called from. A @MainActor async function runs entirely on the main actor — await just yields control, it does not switch threads. Use @concurrent (Swift 6.2+) when you need to force work off the calling actor.
Prefer structured concurrency. Use async let and TaskGroup for parallel work — they propagate cancellation and errors automatically through the task tree. Unstructured Task {} is for bridging sync→async boundaries (event handlers, SwiftUI .task). Task.detached is a last resort.
GCD is a bridge pattern, not a default. In new code, do not use DispatchQueue, DispatchGroup, DispatchSemaphore, or completion handlers as primary architecture. Use them only to bridge legacy APIs that don't have async alternatives yet. Isolate bridge code and keep the rest of the codebase idiomatic Swift 6.
The Progressive Journey
Single-Threaded → Asynchronous → Concurrent → Actors
↓ ↓ ↓ ↓
Start here Hide latency Background Move data
(network) CPU work off main
When to advance:
- Stay single-threaded if UI is responsive and operations are fast
- Add async/await when high-latency operations (network, file I/O) block UI
- Add concurrency when CPU-intensive work (image processing, parsing) freezes UI
- Add actors when too much main actor code causes contention
Key insight: Concurrent code is more complex. Only introduce concurrency when profiling shows it's needed.
Step 1: Single-Threaded Code (Start Here)
With Main Actor Mode enabled (the default for new projects in Xcode 26+), all code runs on the main thread unless explicitly marked otherwise.
// ✅ Simple, single-threaded
class ImageModel {
var imageCache: [URL: Image] = [:]
func fetchAndDisplayImage(url: URL) throws {
let data = try Data(contentsOf: url) // Reads local file
let image = decodeImage(data)
view.displayImage(image)
}
func decodeImage(_ data: Data) -> Image {
// Decode image data
return Image()
}
}
Main Actor Mode (Xcode 26+)
- Enabled by default for new projects
- All code protected by
@MainActorunless explicitly marked otherwise - Access shared state safely without worrying about concurrent access
Build Setting (Xcode 26+)
Build Settings → Swift Compiler — Language
→ "Default Actor Isolation" = Main Actor
Build Settings → Swift Compiler — Upcoming Features
→ "Approachable Concurrency" = Yes
When this is enough: If all operations are fast (<16ms for 60fps), stay single-threaded!
Step 2: Asynchronous Tasks (Hide Latency)
Add async/await when waiting on data (network, file I/O) would freeze UI.
Problem: Network Access Blocks UI
// ❌ Blocks main thread until network completes
func fetchAndDisplayImage(url: URL) throws {
let data = try Data(contentsOf: url) // ❌ Synchronous network fetch, freezes UI!
let image = decodeImage(data)
view.displayImage(image)
}
Solution: Async/Await
// ✅ Suspends without blocking main thread
func fetchAndDisplayImage(url: URL) async throws {
let (data, _) = try await URLSession.shared.data(from: url) // ✅ Suspends here
let image = decodeImage(data) // ✅ Resumes here when data arrives
view.displayImage(image)
}
What happens:
- Function starts on main thread
awaitsuspends function without blocking main thread- URLSession fetches data on background thread (library handles this)
- Function resumes on main thread when data arrives
- UI stays responsive the entire time
Task Creation
Create tasks in response to user events:
class ImageModel {
var url: URL = URL(string: "https://swift.org")!
func onTapEvent() {
Task { // ✅ Create task for user action
do {
try await fetchAndDisplayImage(url: url)
} catch {
displayError(error)
}
}
}
}
Task Interleaving (Important Concept)
Multiple async tasks can run on the same thread by taking turns:
Task 1: [Fetch Image] → (suspend) → [Decode] → [Display]
Task 2: [Fetch News] → (suspend) → [Display News]
Main Thread Timeline:
[Fetch Image] → [Fetch News] → [Decode Image] → [Display Image] → [Display News]
Benefits:
- Main thread never sits idle
- Tasks make progress as soon as possible
- No concurrency yet—still single-threaded!
Critical: Both tasks above run on the main actor. The await keyword suspends the task and frees the thread, but when the task resumes, it returns to the same isolation domain (main actor). No background thread is involved unless the awaited API (like URLSession) handles that internally.
When to use tasks:
- High-latency operations (network, file I/O)
- Library APIs handle background work for you (URLSession, FileManager)
- Your own code stays on main thread
Step 3: Concurrent Code (Background Threads)
Add concurrency when CPU-intensive work blocks UI.
Problem: Decoding Blocks UI
Profiling shows decodeImage() takes 200ms, causing UI glitches:
func fetchAndDisplayImage(url: URL) async throws {
let (data, _) = try await URLSession.shared.data(from: url)
let image = decodeImage(data) // ❌ 200ms on main thread!
view.displayImage(image)
}
Solution 1: @concurrent Attribute (Swift 6.2+)
Forces function to always run on background thread:
func fetchAndDisplayImage(url: URL) async throws {
let (data, _) = try await URLSession.shared.data(from: url)
let image = await decodeImage(data) // ✅ Runs on background thread
view.displayImage(image)
}
@concurrent
func decodeImage(_ data: Data) async -> Image {
// ✅ Always runs on background thread pool
// Good for: image processing, file I/O, parsing
return Image()
}
What @concurrent does:
- Function always switches to background thread pool
- Compiler highlights main actor data access (shows what you need to fix)
- Cannot access
@MainActorproperties withoutawait
Requirements: Swift 6.2+, Xcode 26+, iOS 26+
Solution 2: nonisolated (Library APIs)
If providing a general-purpose API, use nonisolated instead:
// ✅ Stays on caller's actor
nonisolated
func decodeImage(_ data: Data) -> Image {
// Runs on whatever actor called it
// Main actor → stays on main actor
// Background → stays on background
return Image()
}
When to use nonisolated:
- Library APIs where caller decides where work happens
- Small operations that might be OK on main thread
- General-purpose code used in many contexts
When to use @concurrent:
- Operations that should always run on background (image processing, parsing)
- Performance-critical work that shouldn't block UI
Breaking Ties to Main Actor
When you mark a function @concurrent, compiler shows main actor access:
how to use axiom-swift-concurrencyHow to use axiom-swift-concurrency on Cursor
AI-first code editor with Composer
1Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add axiom-swift-concurrency
2Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
$npx skills add https://github.com/charleswiltgen/axiom --skill axiom-swift-concurrencyThe skills CLI fetches axiom-swift-concurrency from GitHub repository charleswiltgen/axiom and configures it for Cursor.
3Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
◆ Which agents do you want to install to?││ ── Universal (.agents/skills) ── always included ────│ • Amp│ • Antigravity│ • Cline│ • Codex│ ●Cursor(selected)│ • Cursor│ • Windsurf4Verify installation
Confirm successful installation by checking the skill directory location:
.cursor/skills/axiom-swift-concurrencyReload or restart Cursor to activate axiom-swift-concurrency. Access the skill through slash commands (e.g., /axiom-swift-concurrency) or your agent's skill management interface.
⚠Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
Additional Resources
List & Monetize Your Skill
Submit your Claude Code skill and start earning
GET_STARTED →Use Cases▌
User Story & Requirements Generation
Create detailed user stories, acceptance criteria, and feature specs
Example
Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios
✓Reduce spec writing time by 50%, ensure comprehensive coverage
Competitive Analysis
Research competitors, compare features, identify gaps
Example
Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities
✓Complete competitive research in 2 hours instead of 2 days
Roadmap Prioritization
Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs
Example
Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale
✓Make data-driven prioritization decisions faster
Stakeholder Communication
Draft PRDs, status updates, and stakeholder presentations
Example
Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement
✓Save 3-5 hours/week on communication overhead
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client
- ›Access to product documentation and roadmap tools (Jira, Notion, etc.)
- ›Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
- ›Stakeholder contact information and communication channels
Time Estimate
30-60 minutes to see productivity improvements
Installation Steps
- 1.Install product management skill
- 2.Start with user story generation for known feature
- 3.Progress to competitive analysis: research 2-3 competitors
- 4.Use for roadmap prioritization: apply RICE/ICE scoring
- 5.Draft stakeholder communications and refine based on feedback
- 6.Build template library for recurring PM tasks
- 7.Share effective prompts with product team
Common Pitfalls
- ⚠Not validating competitive research—verify facts before sharing
- ⚠Accepting user stories without involving engineering team
- ⚠Over-relying on frameworks without qualitative judgment
- ⚠Not customizing outputs to company culture and communication style
- ⚠Skipping stakeholder validation of generated requirements
Best Practices▌
✓ Do
- +Validate research and competitive analysis with real data
- +Collaborate with engineering when generating technical requirements
- +Customize frameworks and templates to your company context
- +Use skill for first drafts, refine with stakeholder input
- +Document successful prompt patterns for PM tasks
- +Combine AI efficiency with human judgment and intuition
✗ Don't
- −Don't publish competitive analysis without fact-checking
- −Don't finalize user stories without engineering review
- −Don't make prioritization decisions solely on AI scoring
- −Don't skip customer validation of generated requirements
- −Don't ignore company-specific context and culture
💡 Pro Tips
- ★Provide context: company goals, constraints, customer feedback
- ★Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
- ★Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
- ★Use skill for 70% generation + 30% customization to company needs
When to Use This▌
✓ Use When
Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.
✗ Avoid When
Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.
Learning Path▌
- 1Basic: user stories, feature specs, status updates
- 2Intermediate: competitive analysis, prioritization frameworks, PRDs
- 3Advanced: product strategy, go-to-market planning, OKR setting
- 4Expert: product vision, market positioning, business model innovation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
general reviewsRatings
4.5★★★★★70 reviews- ★★★★★Ava Diallo· Dec 20, 2024
axiom-swift-concurrency fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Diego Chawla· Dec 20, 2024
axiom-swift-concurrency reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Hiroshi White· Dec 16, 2024
axiom-swift-concurrency is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Valentina Abebe· Dec 12, 2024
We added axiom-swift-concurrency from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Neel Haddad· Dec 4, 2024
Registry listing for axiom-swift-concurrency matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Aarav Khanna· Nov 23, 2024
Useful defaults in axiom-swift-concurrency — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Ava Huang· Nov 11, 2024
axiom-swift-concurrency is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Lucas Sanchez· Nov 11, 2024
I recommend axiom-swift-concurrency for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Xiao Verma· Nov 7, 2024
Solid pick for teams standardizing on skills: axiom-swift-concurrency is focused, and the summary matches what you get after install.
- ★★★★★Mia Ramirez· Nov 7, 2024
axiom-swift-concurrency fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
showing 1-10 of 70
1 / 7