# swift-testing

Writes Swift Testing unit tests and converts existing XCTest assertions, flagging which checks belong in XCTest or XCUITest.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 4300 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-testing/SKILL.md
- Updated: 2026-07-31
- HTML: https://affpapa.org/en/nevibecode/skills/swift-testing

## What it does

The skill gives an agent a working frame for Swift Testing: `@Test`, `@Suite`, `#expect`, `#require`, `withKnownIssue`, `Attachment.record`, exit tests driven by `processExitsWith`. A new check gets the right tool instead of a copy of an XCTest habit.

Inside lie reference files on patterns, suite layout, advanced APIs and a version gate matrix. Migration runs one file or suite at a time, then compares discovered, passing and failing counts. `@available` goes on separate `@Test` functions, not on the suite type.

Swift Testing needs Xcode 16+ and Swift 6+. UI automation, performance measurement, Objective-C exception checks and typical snapshot tooling stay in XCTest, and swapping them for `#expect` is a bad trade. In mixed helpers the test plan's interoperability mode matters: older plans inherit `limited`, new projects get `complete`, and SwiftPM reads `SWIFT_TESTING_XCTEST_INTEROP_MODE`.

## Install

### Claude Code (native platform)

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

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

### Codex

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

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

### Cursor

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

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

### GitHub Copilot

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

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

### Gemini CLI

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

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

### Windsurf (Devin Desktop)

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

### OpenCode

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

## When to use it
- write a first Swift Testing test without dragging in XCTest habits
- convert a file full of `XCTUnwrap` and `XCTFail` into `#require` and `Issue.record`
- mark a known failure with `withKnownIssue` so the suite stays green
- find state leaking between tests that run in parallel
- sort out which checks have to stay in XCTest

## Example prompts
- Add an `@Test` for the discount calculation and cover the edge cases with `#expect`
- Convert `OrderTests.swift` from XCTest to Swift Testing and tell me what stays
- Tests fail only in CI — check whether shared state between parallel runs is the cause

## Similar
- [improve-codebase-architecture](https://affpapa.org/en/nevibecode/skills/improve-codebase-architecture.md) — skill · 1163035 installs
- [design-taste-frontend](https://affpapa.org/en/nevibecode/skills/design-taste-frontend.md) — skill · 678700 installs
- [tdd](https://affpapa.org/en/nevibecode/skills/tdd.md) — skill · 1141062 installs
- [skill-creator](https://affpapa.org/en/nevibecode/skills/skill-creator.md) — skill · 414180 installs
- [agent-browser](https://affpapa.org/en/nevibecode/skills/vercel-labs-agent-browser.md) — skill · 1200000 installs
- [prototype](https://affpapa.org/en/nevibecode/skills/prototype.md) — skill · 986201 installs

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