Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add dpearson2699/swift-ios-skills --skill swift-testing -a claude-code
Open on GitHub

What 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 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 for the agent

  • 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

How to install swift-testing

1Skills CLI (Vercel)

npx skills add dpearson2699/swift-ios-skills --skill swift-testing -a claude-code

2Manually: put the files in place

~/.claude/skills/swift-testing/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/swift-testing/

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.

Similar skills

Everything for Testing and QA →

From the same set69

swiftui-patterns Guides SwiftUI view work around state, composition, environment wiring, and isolated previews. Use it when refactoring a screen or sorting out @Observable ownership. CX Codex +1 4,500installs ios-networking A skill that guides your coding agent through Swift networking on iOS and macOS: URLSession with async/await, error handling, retries and pagination. CX Codex +1 4,400installs swift-concurrency Fixes Sendable errors and actor isolation diagnostics in Swift 6.2+ while adopting approachable concurrency features. CX Codex +1 4,300installs ios-localization Guides localization work for iOS and macOS apps, from String Catalogs and plural forms to locale formatting and RTL layouts. CX Codex +1 4,300installs swiftui-navigation Provides SwiftUI navigation architectures, covering typed stacks, multi-column layouts, sheets, and tabs. Useful when structuring navigation state across iOS and macOS apps. CX Codex +1 4,400installs push-notifications Review, build, and debug local and APNs remote notifications for iOS and macOS in Swift. Handles permission flows, silent pushes, and service extensions. CX Codex +1 4,200installs swiftui-layout-components Guides SwiftUI screen layouts built from stacks, grids, lists, forms, and controls. Use it for settings, collections, and scrollable views. CX Codex +1 4,200installs debugging-instruments Helps debug crashes, find retain cycles, and diagnose main-thread hangs in iOS apps using LLDB, Memory Graph Debugger, and Instruments. CX Codex +1 4,100installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor