swift · margelo — Claude Code skill: Swift API design and concurrency
A skill for Swift work: type-safe API design, concurrency choices, Apple-platform integration. Fires when edits touch .swift files, async/await, DispatchQueue, or Nitro Modules.
no license 1,300 installs ★ 181 updated 2026-08-21
npx skills add margelo/react-native-skills --skill swift -a claude-codeWhat swift does
The skill sets a workflow for Swift code: read local files and generated protocols first, then pick a public type model, then commit to one concurrency model. Synchronous properties and methods stay cheap and nonblocking. Queue hops, I/O, and fallible work belong in the API, not behind it.
Type-safe design is the core. States should be expressed through types, not clusters of optionals. Closed sets get an enum with associated values; shared contracts get protocols with conforming structs. Related fields live on the same variant, so the compiler rejects meaningless combinations before they happen.
On concurrency the rule is blunt: either Swift concurrency or DispatchQueue, not both interleaved. DispatchQueue.sync is treated as a bug, especially inside getters and setters. Quick local work does not get wrapped in Task just because async exists. For Nitro Modules, the skill points to build-nitro-modules for generated specs and Promise mapping.
What it helps with
- design a Swift state model without optional-field clusters
- commit to one concurrency model before implementation
- stop getters from running expensive or fallible work
- cut redundant hops between main, background, and JS queues
- review Nitro Module Swift code for thread boundaries
Example prompts for the agent
- Design the type model for the scanner: text, barcode, and face as separate variants
- Check this Swift class for unnecessary queue hops
- Rework the getter that triggers a hardware scan into an async method
How to install swift
1Skills CLI (Vercel)
npx skills add margelo/react-native-skills --skill swift -a claude-code2Manually: put the files in place
~/.claude/skills/swift/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/swift/
1Skills CLI (Vercel)
npx skills add margelo/react-native-skills --skill swift -a codex2Manually: put the files in place
.agents/skills/swift/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add margelo/react-native-skills --skill swift -a cursor2Manually: put the files in place
.cursor/skills/swift/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install margelo/react-native-skills skills/swift2Manually: put the files in place
.github/skills/swift/SKILL.md1Skills CLI (Vercel)
npx skills add margelo/react-native-skills --skill swift -a gemini-cli2Platform CLI
gemini skills install https://github.com/margelo/react-native-skills --path skills/swiftManually: put the files in place
.devin/skills/swift/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add margelo/react-native-skills --skill swift -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about swift
How do I install swift in Claude Code?
Run npx skills add margelo/react-native-skills --skill swift -a claude-code. The skill lands in ~/.claude/skills/swift/SKILL.md.
What does the swift skill do?
It gives rules for Swift API design and threading. It pushes type-safe state modeling, one concurrency model per feature, and no expensive work hidden behind properties.
How is it different from build-nitro-modules?
swift covers plain Swift: types, async/await, queues. build-nitro-modules handles generated specs, Promise mapping, and HybridObject constraints. Pair them for Nitro Module work.
Similar skills
All skills for Programming languages →swift by other authors comes first.