Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/markdavidgan/apple-dev-skills/swift-testingnpx skills add markdavidgan/apple-dev-skills --skill swift-testinggit clone --depth 1 https://github.com/markdavidgan/apple-dev-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/markdavidgan/apple-dev-skills/swift-testing)<a href="https://agentmods.dev/skills/markdavidgan/apple-dev-skills/swift-testing"><img src="https://agentmods.dev/badge/skills/markdavidgan/apple-dev-skills/swift-testing.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00016 | $0.01801 |
| Opus 5 | $0.00008 | $0.00901 |
| Sonnet 5 | $0.00003 | $0.00360 |
| Haiku 4.5 | $0.00002 | $0.00180 |
Grade A, and why
swift-testing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 185 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Swift Testing
Author tests with the modern Swift Testing framework (import Testing, Xcode 16+/Swift 6). It coexists with XCTest in the same target — migrate incrementally. For the test harness, CI wiring, SwiftData in-memory setup, and UI/performance testing, see ios-test; this skill is the authoring model.
Pick the right tool. Swift Testing covers unit/integration/logic tests. UI tests (
XCUIApplication) andXCTMetricperformance tests still use XCTest — Swift Testing does not replace them. You can keep both in one project.
The shape of a test
import Testing
@testable import MyApp
@Test func timerStartsAtConfiguredDuration() {
let timer = FocusTimer(minutes: 25)
#expect(timer.remaining == .seconds(25 * 60))
}
- No
XCTestsubclass, notestprefix, noXCTAssert. A free function (or method) annotated@Test. #expect(...)records a failure but continues. It captures the full expression, so#expect(a == b)reports the actual values ofaandb— no need forXCTAssertEqual.- Give tests descriptive names:
@Test("Remaining time is clamped to zero").
#require — stop on failure / safe unwrap
@Test func decodesUser() throws {
let data = try #require(Self.fixture) // unwraps Optional or throws → test stops
let user = try JSONDecoder().decode(User.self, from: data)
#expect(user.name == "Ada")
}
#require is the hard assert: if it fails the test stops (like a guard). Use it when continuing would crash or cascade. try #require(optional) is the idiomatic non-force unwrap.
Async, throwing, and errors
@Test func loadsRemoteProfile() async throws {
let profile = try await client.fetchProfile(id: 42) // just use async/await
#expect(profile.id == 42)
}
// Asserting a specific error is thrown
@Test func rejectsEmptyName() {
#expect(throws: ValidationError.emptyName) {
try Validator.validate(name: "")
}
}
// Any error / error of a type
#expect(throws: (any Error).self) { try risky() }
#expect(throws: ValidationError.self) { try validate() }
#expect(throws: Never.self) { try shouldNotThrow() } // asserts NO throw
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 185 lines · 16 tokens per session scan A 29197b52de16
swift-testing is a skill published in the GitHub repository markdavidgan/apple-dev-skills (5 stars, last pushed 6d ago), licensed MIT. It adds 16 tokens to every session and 1,801 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
swift
Swift development: concurrency patterns, async/await, actors, testing with XCTest and Swift Testing framework.
Kotlin Testing Patterns
Kotlin testing with JUnit 5, MockK, Kotest, coroutine testing, Android testing with Espresso, and Kotlin-specific assertion libraries.
swift-testing-expert
Expert guidance for Swift Testing: test structure, #expect/#require macros, traits and tags, parameterized tests, test plans, parallel execution, async waiting patterns, and XCTest migration. Use when writing new Swift tests, modernizing XCTest suites, debugging flaky tests, or improving test quality and…
temporal-python-testing
Test Temporal workflows with pytest, time-skipping, and mocking strategies. Covers unit testing, integration testing, replay testing, and local development setup. Use when implementing Temporal workflow tests or debugging test failures.
build-run-debug
Build, run, and debug local macOS apps and desktop executables using shell-first Xcode and Swift workflows. Use when asked to build a Mac app, launch it, diagnose compiler or linker failures, inspect startup problems, or debug desktop-only runtime issues.
macos-swiftpm
Build, run, and test SwiftPM macOS packages and executables. Use when the repo is package-first or has no Xcode project.