Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
avdlee avatar

Swift Testing Expert

  • 4k installs
  • 431 repo stars
  • Updated April 22, 2026
  • avdlee/swift-testing-agent-skill

A skill that guides developers through writing, migrating, and debugging Swift tests using Swift Testing APIs on Apple platforms and Swift server targets.

About

This skill provides expert guidance for writing and maintaining Swift tests using the Swift Testing framework on Apple platforms and Swift server projects. It covers test structure with suite organization, assertion macros (#expect and #require), traits and tags for metadata and filtering, parameterized tests to eliminate repetitive test methods, and parallel execution with isolation strategies. Developers use it when creating new test suites, migrating from XCTest incrementally, debugging flaky or async tests, and configuring test plans in Xcode. Key workflows include triage of flakiness versus correctness failures, callback-to-async bridging, known-issue handling with withKnownIssue, and tag-based CI filtering. The skill enforces a behavior contract: Swift Testing is preferred for unit and integration tests while XCTest is retained for UI automation, performance metrics, and Objective-C code. Covers #expect as default assertion and #require for prerequisite-dependent test lines, with explicit guidance on throw expectations

  • Covers #expect as default assertion and #require for prerequisite-dependent test lines, with explicit guidance on throw
  • Provides a routing map to nine reference files covering fundamentals, parameterization, async waiting, traits, isolation
  • Enforces parallel-safe defaults and recommends fixing shared state before applying .serialized trait
  • Maps common pitfalls to next-best moves: repetitive test methods to parameterized tests, flaky integration tests to depe
  • Defines a migration strategy: convert assertions first, then organize suites, then introduce parameterization and traits

Swift Testing Expert by the numbers

  • 4,047 all-time installs (skills.sh)
  • +132 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #290 of 2,184 Testing & QA skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

swift-testing-expert capabilities & compatibility

Capabilities
test writing · xctest migration · parameterized test design · async bridging · flakiness debugging · trait and tag configuration · parallel execution guidance · known issue handling
Use cases
testing · debugging · documentation
Platforms
macOS
Runs
Runs locally
Pricing
Free
From the docs

What swift-testing-expert says it does

Keep migration advice incremental: convert assertions first, then organize suites, then introduce parameterization/traits.
SKILL.md
Recommend parameterized tests when multiple tests share logic and differ only in input values.
SKILL.md
npx skills add https://github.com/avdlee/swift-testing-agent-skill --skill swift-testing-expert

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs4k
repo stars431
Security audit3 / 3 scanners passed
Last updatedApril 22, 2026
Repositoryavdlee/swift-testing-agent-skill

What it does

Write, review, migrate, and debug Swift tests using modern Swift Testing APIs including macros, traits, parameterized tests, and async patterns.

Who is it for?

iOS, macOS, watchOS, tvOS, and Swift server developers writing or modernizing unit and integration tests with Xcode 16+ and Swift Testing.

Skip if: UI automation tests using XCUIApplication, performance tests using XCTMetric, or Objective-C-only test code - these remain on XCTest.

When should I use this skill?

Writing new Swift tests, converting XCTest assertions, debugging flaky async tests, designing parameterized test cases, or configuring Xcode test-plan tag filters.

What you get

Developers produce parallel-safe, parameterized, well-organized Swift test suites with clear diagnostics and a reliable incremental migration path from XCTest.

  • Parallel-safe Swift test suites using #expect and #require
  • Parameterized tests replacing repetitive test methods
  • Tag-based test plans for CI filtering

By the numbers

  • 9 reference files in the routing map covering distinct testing topics
  • 8 rules in the agent behavior contract
  • 8 common pitfall-to-next-move mappings documented

Files

SKILL.mdMarkdownGitHub ↗

Swift Testing

Overview

Use this skill to write, review, migrate, and debug Swift tests with modern Swift Testing APIs. Prioritize readable tests, robust parallel execution, clear diagnostics, and incremental migration from XCTest where needed.

Agent behavior contract (follow these rules)

1. Prefer Swift Testing for Swift unit and integration tests, but keep XCTest for UI automation (XCUIApplication), performance metrics (XCTMetric), and Objective-C-only test code. 2. Treat #expect as the default assertion and use #require when subsequent lines depend on a prerequisite value. 3. Default to parallel-safe guidance. If tests are not isolated, first propose fixing shared state before applying .serialized. 4. Prefer traits for behavior and metadata (.enabled, .disabled, .timeLimit, .bug, tags) over naming conventions or ad-hoc comments. 5. Recommend parameterized tests when multiple tests share logic and differ only in input values. 6. Use @available on test functions for OS-gated behavior instead of runtime #available checks inside test bodies; never annotate suite types with @available. 7. Keep migration advice incremental: convert assertions first, then organize suites, then introduce parameterization/traits. 8. Only import Testing in test targets, never in app/library/binary targets.

First 60 seconds (triage template)

  • Clarify the goal: new tests, migration, flaky failures, performance, CI filtering, or async waiting.
  • Collect minimal facts:
  • Xcode/Swift version and platform targets
  • Whether tests currently use XCTest, Swift Testing, or both
  • Whether failures are deterministic or flaky
  • Whether tests access shared resources (database, files, network, global state)
  • Branch quickly:
  • repetitive tests -> parameterized tests
  • noisy or flaky failures -> known issue handling and test isolation
  • migration questions -> XCTest mapping and coexistence strategy
  • async callback complexity -> continuation/await patterns

Routing map (read the right reference fast)

  • Test building blocks and suite organization -> references/fundamentals.md
  • #expect, #require, and throw expectations -> references/expectations.md
  • Traits, tags, and Xcode test-plan filtering -> references/traits-and-tags.md
  • Parameterized test design and combinatorics -> references/parameterized-testing.md
  • Default parallel execution, .serialized, isolation strategy -> references/parallelization-and-isolation.md
  • Test speed, determinism, and flakiness prevention -> references/performance-and-best-practices.md
  • Async waiting and callback bridging -> references/async-testing-and-waiting.md
  • XCTest coexistence and migration workflow -> references/migration-from-xctest.md
  • Test navigator/report workflows and diagnostics -> references/xcode-workflows.md
  • Index and quick navigation -> references/_index.md

Common pitfalls -> next best move

  • Repetitive testFooCaseA/testFooCaseB/... methods -> replace with one parameterized @Test(arguments:).
  • Failing optional preconditions hidden in later assertions -> try #require(...) then assert on unwrapped value.
  • Flaky integration tests on shared database -> isolate dependencies or in-memory repositories; use .serialized only as a transition step.
  • Disabled tests that silently rot -> prefer withKnownIssue for temporary known failures to preserve signal.
  • Unclear failure values for complex types -> conform type to CustomTestStringConvertible for focused test diagnostics.
  • Test-plan include/exclude by names -> use tags and tag-based filters instead.

Verification checklist

  • Confirm each test has a single clear behavior and expressive display name when needed.
  • Confirm prerequisites use #require where failure should stop the test.
  • Confirm repeated logic is parameterized instead of duplicated.
  • Confirm tests are parallel-safe or intentionally serialized with rationale.
  • Confirm async code is awaited and callback APIs are bridged safely.
  • Confirm migration keeps unsupported XCTest-only scenarios on XCTest.

References

  • references/_index.md
  • references/fundamentals.md
  • references/expectations.md
  • references/traits-and-tags.md
  • references/parameterized-testing.md
  • references/parallelization-and-isolation.md
  • references/performance-and-best-practices.md
  • references/async-testing-and-waiting.md
  • references/migration-from-xctest.md
  • references/xcode-workflows.md

Related skills

FAQ

When should I use #require instead of #expect?

Use #require when subsequent lines in the test depend on a prerequisite value; a failed #require stops the test immediately, preventing misleading downstream failures.

Should I annotate entire test suite types with @available for OS-gated tests?

No. Annotate individual test functions with @available for OS-gated behavior; never apply @available to suite types.

Can Swift Testing and XCTest coexist in the same test target?

Yes. The recommended migration is incremental: convert assertions first, then organize suites, then introduce parameterization and traits, keeping XCTest for UI automation and Objective-C code.

Is Swift Testing Expert safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Testing & QAtestingdocsbackend

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.