swift-testing-pro
Skill423 starsChanged 8 months agoMITView on GitHub
Writes, reviews, and improves Swift Testing code using modern APIs and best practices. Use when reading, writing, or reviewing projects that use Swift Testing.
We split this skill into the rules it gives an agent
10 rules. 5 are common, 0 are distinctive, and 5 are very specific to this project.
5
Common
Most of the 3 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Common: line 10
Write and review Swift Testing code for correctness, modern API usage, and adherence to project conventions.
- Very specific: line 14
Ensure tests follow core Swift Testing conventions using references/core-rules.md.
- Very specific: line 16
Check async tests, confirmations, time limits, actor isolation, and networking mocks using references/async-tests.md.
- Very specific: line 17
Ensure new features like raw identifiers, test scopes, exit tests, and attachments are used correctly using references/new-features.md.
- Very specific: line 18
If migrating from XCTest, follow the conversion guidance in references/migrating-from-xctest.md.
- Common: line 20
If doing partial work, load only the relevant reference files.
- Common: line 28
Use a consistent project structure, with folder layout determined by app features.
- Common: line 37
If the user asks for a review, organize findings by file.
- Common: line 45
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 …
- Very specific: line 84
Fundamentals (high): Test suite on line 5 should be a struct, not a class inheriting from XCTestCase.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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:
- Ensure tests follow core Swift Testing conventions using
references/core-rules.md. - Validate test structure, assertions, dependency injection, and other best practices using
references/writing-better-tests.md. - Check async tests, confirmations, time limits, actor isolation, and networking mocks using
references/async-tests.md. - Ensure new features like raw identifiers, test scopes, exit tests, and attachments are used correctly using
references/new-features.md. - 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:
- State the file and relevant line(s).
- Name the rule being violated.
- 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.
// Before
class UserTests: XCTestCase {
// After
struct UserTests {Line 12: Use #expect instead of XCTAssertEqual.
// Before
XCTAssertEqual(user.name, "Taylor")
// After
#expect(user.name == "Taylor")Line 30: Use #require for preconditions, not #expect.
// Before
#expect(users.isEmpty == false)
let first = users.first!
// After
let first = try #require(users.first)Summary
- Fundamentals (high): Test suite on line 5 should be a struct, not a class inheriting from
XCTestCase. - Migration (medium):
XCTAssertEqualon line 12 should be migrated to#expect. - Assertions (medium): Force-unwrap on line 30 should use
#requireto 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/deinitover setUp/tearDown, parallel execution, parameterized tests,withKnownIssue, and tags.references/writing-better-tests.md- test hygiene, structuring tests, hidden dependencies,#expectvs#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.
Other versions9 projects use a version of this.
Word for word · 6
- 199-biotechnologies/swiftui-claude-skills★ 7100% same
- kelvinkosbab/KozBon★ 5100% same
- molayab/swift-cli-manager★ 3100% same
- molayab/swift-ai-provider-kit★ 1100% same
- Acromegaliacanaliculus452/Swift-Testing-Agent-Skill★ 0100% same
- Nelwhix/bloom★ 0100% same
Edited · 2
- VelimirMueller/ai-development-skills★ 798% same
- VelimirMueller/claude-skills★ 798% same
Wrote their own version · 1
- spatie/bloom★ 34same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects with it also use swift-concurrency-pro and swiftui-pro.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
twostrawsSkillswift-concurrency-pro
Reviews Swift code for concurrency correctness, modern API usage, and common async/await pitfalls. Use when reading, writing, or reviewing Swift concurrency code.
Also in 6 projects that use this
kingsidharthSkillswiftui-pro
Comprehensively reviews SwiftUI code for best practices on modern APIs, maintainability, and performance. Use when reading, writing, or reviewing SwiftUI projects.
Also in 6 projects that use this
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

