Skip to main content
skill Claude Code CX Codex Cursor GitHub Copilot

swift-testing-pro — Claude Code skill: Swift Testing reviews

Writes, reviews, and improves Swift Testing code. Use it when reviewing tests, migrating XCTest code, or handling async test behaviour.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add twostraws/Swift-Testing-Agent-Skill --skill swift-testing-pro -a claude-code
Open on GitHub

What swift-testing-pro does

This skill reviews Swift Testing code for correctness and project conventions, then writes or improves tests when asked. It checks test suite structure, assertions, dependency injection, async cases, confirmations, time limits, actor isolation, and networking mocks. Review findings are grouped by file and include relevant lines, the violated rule, and a before-and-after fix.

It uses references/core-rules.md, references/writing-better-tests.md, references/async-tests.md, references/new-features.md, and references/migrating-from-xctest.md. For a focused task, it loads only the relevant references. It can convert XCTest tests and uses Swift Testing for new unit and integration tests.

The target is Swift 6.2 or later, so an older toolchain is a reason to check the version first. Swift Testing does not support UI tests; those still require XCTest.

What it helps with

  • review #expect and #require usage
  • migrate XCTest assertions to Swift Testing
  • check async tests for actor isolation issues
  • add networking mocks to test code
  • fix confirmation and time-limit handling

Example prompts for the agent

  • Review the Swift Testing code in `UserTests.swift` and report genuine issues only.
  • Migrate the XCTest tests in `UserTests.swift` to Swift Testing.
  • Write Swift Testing coverage for async networking code with mocks.

How to install swift-testing-pro

1Skills CLI (Vercel)

npx skills add twostraws/Swift-Testing-Agent-Skill --skill swift-testing-pro -a claude-code

2Manually: put the files in place

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

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

Similar

langfuse langfuse Equips your coding agent to inspect traces, manage prompts, and run evaluations in Langfuse. Useful when instrumenting LLM calls or building test datasets. Claude Code CX Codex Cursor +1 19,700installs test-writer leonardomso Generates Vitest test suites for code examples in JavaScript concept documentation pages. Helps verify documentation snippets before publishing. Claude Code CX Codex Cursor +1 352installs vue-expert-js https://github.com/Jeffallan Builds Vue 3 code in JavaScript with JSDoc annotations instead of TypeScript. Use it for components, composables, routing, and state management in JS-only projects. Claude Code CX Codex Cursor +1 4,000installs flutter-dev MiniMax-AI A Flutter development guide for widget patterns, Riverpod, Bloc, and GoRouter. Use it when building layouts, navigation, tests, or reviewing performance. Claude Code CX Codex Cursor +1 2,000installs ralph Yeachan-Heo A persistence loop that works through tasks in prd.json until all stories pass and get reviewer verification. Useful for multi-step jobs that need guaranteed completion. Claude Code CX Codex Cursor +1 971installs react19-test-patterns official github A migration reference for updating test files to work with React 19. Use it when replacing removed test utilities or revising StrictMode call-count assertions. GitHub Copilot 1,200installs improve-codebase-architecture Matt Pocock This skill scans a codebase for architectural friction, then builds a visual HTML report with refactoring candidates. Use it before a deeper architecture review. Claude Code 1,163,035installs design-taste-frontend Leonxlnx This skill directs the design of public pages and work screens, then checks the result in a browser through screenshots. Use it when an interface feels generic or unfinished. Claude Code CX Codex Cursor +1 673,100installs

Questions about swift-testing-pro

How do I install swift-testing-pro in Claude Code?

Run npx skills add twostraws/Swift-Testing-Agent-Skill --skill swift-testing-pro -a claude-code, then run npx skills add twostraws/Swift-Testing-Agent-Skill --skill swift-testing-pro -a claude-code again. The skill file is located at ~/.claude/skills/swift-testing-pro/SKILL.md.

What does swift-testing-pro do?

It writes, reviews, and improves Swift Testing code. It can also migrate XCTest tests and report review findings by file and line.

Can swift-testing-pro handle UI tests?

No. Swift Testing does not support UI tests, so those tests must use XCTest.

Source text

SKILL.md · MIT
---
name: swift-testing-pro
description: Writes, reviews, and improves Swift Testing code using modern APIs and best practices. Use when reading, writing, or reviewing projects that use Swift Testing.
license: MIT
metadata:
  author: Paul Hudson
  version: "1.0"
---

Write and review Swift Testing code for correctness, modern API usage, and adherence to project conventions. Report only genuine problems - do not nitpick or invent issues.

Review process:

1. Ensure tests follow core Swift Testing conventions using `references/core-rules.md`.
1. Validate test structure, assertions, dependency injection, and other best practices using `references/writing-better-tests.md`.
1. Check async tests, confirmations, time limits, actor isolation, and networking mocks using `references/async-tests.md`.
1. Ensure new features like raw identifiers, test scopes, exit tests, and attachments are used correctly using `references/new-features.md`.
1. If migrating from XCTest, follow the conversion guidance in `references/migrating-from-xctest.md`.

If doing partial work, load only the relevant reference files.


## Core Instructions

- Target Swift 6.2 or later, using modern Swift concurrency.
- As a Swift Testing developer, the user wants all new unit and integration tests to be written using Swift Testing, and they may ask for help migrating existing XCTest code to Swift Testing.
- Swift Testing does *not* support UI tests – XCTest must be used there.
- Use a consistent project structure, with folder layout determined by app features.

Swift Testing evolves with each Swift release, so expect three to four releases each year, each introducing new features. This means existing training data you have will naturally be outdated or missing key features.

This skill specifically draws upon the very latest Swift and Swift Testing code, which means it will suggest things you are not aware of. Treat the user’s installed toolchain as authoritative, but there's a fairly high chance Apple's *documentation* about the APIs will be stale, so treat them carefully.


## Output Format

If the user asks for a review, organize findings by file. For each issue:

1. State the file and relevant line(s).
2. Name the rule being violated.
3. Show a brief before/after code fix.

Skip files with no issues. End with a prioritized summary of the most impactful changes to make first.

If the user asks you to write or improve tests, follow the same rules above but make the changes directly instead of returning a findings report.

Example output:

### UserTests.swift

**Line 5: Use struct, not class, for test suites.**

```swift
// Before
class UserTests: XCTestCase {

// After
struct UserTests {
```

**Line 12: Use `#expect` instead of `XCTAssertEqual`.**

```swift
// Before
XCTAssertEqual(user.name, "Taylor")

// After
#expect(user.name == "Taylor")
```

**Line 30: Use `#require` for preconditions, not `#expect`.**

```swift
// Before
#expect(users.isEmpty == false)
let first = users.first!

// After
let first = try #require(users.first)
```

### Summary

1. **Fundamentals (high):** Test suite on line 5 should be a struct, not a class inheriting from `XCTestCase`.
2. **Migration (medium):** `XCTAssertEqual` on line 12 should be migrated to `#expect`.
3. **Assertions (medium):** Force-unwrap on line 30 should use `#require` to unwrap safely and stop the test early on failure.

End of example.


## References

- `references/core-rules.md` - core Swift Testing rules: structs over classes, `init`/`deinit` over setUp/tearDown, parallel execution, parameterized tests, `withKnownIssue`, and tags.
- `references/writing-better-tests.md` - test hygiene, structuring tests, hidden dependencies, `#expect` vs `#require`, `Issue.record()`, `#expect(throws:)`, and verification methods.
- `references/async-tests.md` - serialized tests, `confirmation()`, time limits, actor isolation, testing pre-concurrency code, and mocking networking.
- `references/new-features.md` - raw identifiers, range-based confirmations, test scoping traits, exit tests, attachments, `ConditionTrait.evaluate()`, and the updated `#expect(throws:)` return value.
- `references/migrating-from-xctest.md` - XCTest-to-Swift Testing conversion steps, assertion mappings, and floating-point tolerance via Swift Numerics.

© Paul Hudson · MIT · twostraws/Swift-Testing-Agent-Skill

See also

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