# swift-language

Guides AI agents through modern Swift patterns for core, non-concurrency code. Useful when modernizing enums, generics, and protocols under recent compiler releases.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 4000 installs · ★ 1237
- Author: dpearson2699
- License: LicenseRef-Unknown · policy=link-only · description only; the file stays with the author
- Source: https://github.com/dpearson2699/swift-ios-skills/tree/HEAD/skills/swift-language/SKILL.md
- Updated: 2026-07-31
- HTML: https://affpapa.org/en/nevibecode/skills/swift-language

## What it does

This skill guides coding assistants to apply current Swift syntax without altering runtime behavior. It covers `if` and `switch` expressions from Swift 5.9, typed errors from Swift 6, `@resultBuilder` types, and `@propertyWrapper` logic. It also covers opaque `some` versus existential `any`, `guard` statements, and collection methods like `count(where:)`.

The instructions enforce strict checks: apply one rewrite at a time, compile the module, and run tests. Multi-statement branches are disallowed in `if`/`switch` expressions. Every branch must resolve to a single expression of identical type.

This skill omits concurrency and UI code. It routes async tasks to `swift-concurrency`, SwiftUI layouts to `swiftui-patterns`, and deep serialization to `swift-codable`.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill swift-language -a claude-code
```

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

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill swift-language -a codex
```

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

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill swift-language -a cursor
```

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

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install dpearson2699/swift-ios-skills swift-language
```

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

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill swift-language -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/dpearson2699/swift-ios-skills --path skills/swift-language
```

### Windsurf (Devin Desktop)

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

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill swift-language -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/dpearson2699/swift-ios-skills/tree/HEAD/skills/swift-language/SKILL.md

## When to use it
- convert legacy branch blocks into Swift 5.9+ if/switch expressions
- introduce typed throws to handle domain error enums exhaustively
- encapsulate data clamping and bounds checks into a property wrapper
- construct domain-specific syntax trees using result builders

## Example prompts
- Refactor this status switch into a Swift 5.9 expression
- Update validateUser to throw a typed ValidationError enum
- Create an ArrayBuilder struct using @resultBuilder for custom string lists

## Similar
- [swift-expert](https://affpapa.org/en/nevibecode/skills/swift-expert.md) — skill · 4100 installs
- [ios-swift-development](https://affpapa.org/en/nevibecode/skills/ios-swift-development.md) — skill · 1500 installs
- [axiom-swift](https://affpapa.org/en/nevibecode/skills/axiom-swift.md) — skill · 1200 installs
- [swift-api-design-guidelines-skill](https://affpapa.org/en/nevibecode/skills/swift-api-design-guidelines-skill.md) — skill · 1200 installs
- [swift-development](https://affpapa.org/en/nevibecode/skills/swift-development.md) — skill · 488 installs
- [guide-swift-concurrency](https://affpapa.org/en/nevibecode/skills/guide-swift-concurrency.md) — skill · 431 installs

From the same set: [dpearson2699/swift-ios-skills](https://affpapa.org/en/nevibecode/by/dpearson2699/swift-ios-skills.md) — 86 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
