swift-testing — Swift Testing skill for Claude Code with XCTest
Writes Swift Testing unit tests and converts existing XCTest assertions, flagging which checks belong in XCTest or XCUITest.
npx skills add dpearson2699/swift-ios-skills --skill swift-testing -a claude-codeWhat swift-testing 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.
What it helps with
- write a first Swift Testing test without dragging in XCTest habits
- convert a file full of
XCTUnwrapandXCTFailinto#requireandIssue.record - mark a known failure with
withKnownIssueso the suite stays green - find state leaking between tests that run in parallel
- sort out which checks have to stay in XCTest
Example prompts for the agent
- Add an
@Testfor the discount calculation and cover the edge cases with#expect - Convert
OrderTests.swiftfrom XCTest to Swift Testing and tell me what stays - Tests fail only in CI — check whether shared state between parallel runs is the cause
How to install swift-testing
1Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill swift-testing -a claude-code2Manually: put the files in place
~/.claude/skills/swift-testing/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/swift-testing/
1Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill swift-testing -a codex2Manually: put the files in place
.agents/skills/swift-testing/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill swift-testing -a cursor2Manually: put the files in place
.cursor/skills/swift-testing/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install dpearson2699/swift-ios-skills swift-testing2Manually: put the files in place
.github/skills/swift-testing/SKILL.md1Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill swift-testing -a gemini-cli2Platform CLI
gemini skills install https://github.com/dpearson2699/swift-ios-skills --path skills/swift-testingManually: put the files in place
.devin/skills/swift-testing/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill swift-testing -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-testing
How do I install swift-testing in Claude Code?
Run npx skills add dpearson2699/swift-ios-skills --skill swift-testing -a claude-code. The skill file then sits at ~/.claude/skills/swift-testing/SKILL.md.
What does swift-testing do?
It writes and migrates tests on the Swift Testing framework: @Test, @Suite, #expect, #require, known issues, attachments and exit tests. It also tells you where migration should stop.
When should a test stay on XCTest?
Keep UI automation, performance benchmarks, Objective-C exception tests and common snapshot tooling there. For unit tests the skill recommends Swift Testing.