# swift

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.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 1300 installs · ★ 181 repo stars
- Author: margelo
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/margelo/react-native-skills/tree/HEAD/skills/swift/SKILL.md
- Updated: 2026-08-21
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/margelo-swift

## What it 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.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add margelo/react-native-skills --skill swift -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/swift/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/swift/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add margelo/react-native-skills --skill swift -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/swift/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add margelo/react-native-skills --skill swift -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/swift/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install margelo/react-native-skills skills/swift
```

2. **Manually: put the files in place**
- File: `.github/skills/swift/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add margelo/react-native-skills --skill swift -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/margelo/react-native-skills --path skills/swift
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/swift/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add margelo/react-native-skills --skill swift -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/margelo/react-native-skills/tree/HEAD/skills/swift/SKILL.md

## When to use it
- 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
- 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

## Similar
- [swift-concurrency](https://affpapa.org/en/nevibecode/skills/prisma-labs-dev-swift-concurrency.md) — skill · 752 installs
- [guide-swift-concurrency](https://affpapa.org/en/nevibecode/skills/guide-swift-concurrency.md) — skill · 539 installs
- [swift-concurrency-pro](https://affpapa.org/en/nevibecode/skills/swift-concurrency-pro.md) — skill · 13100 installs
- [migrating-to-swift-concurrency](https://affpapa.org/en/nevibecode/skills/migrating-to-swift-concurrency.md) — skill · ★ 58 repo stars
- [swift-expert](https://affpapa.org/en/nevibecode/skills/swift-expert.md) — skill · 4500 installs
- [swift-concurrency-expert](https://affpapa.org/en/nevibecode/skills/swift-concurrency-expert.md) — skill · 2100 installs

## Other versions with the same name
- [swift · mindrally](https://affpapa.org/en/nevibecode/skills/mindrally-swift.md) — 748 installs
- [swift · wendylabsinc](https://affpapa.org/en/nevibecode/skills/swift.md) — ★ 64 repo stars

From the same set: [margelo/react-native-skills](https://affpapa.org/en/nevibecode/by/margelo/react-native-skills.md) — 9 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
