swift-testing

swift-testing is a skill for Claude Code, Codex from bocato/swift-testing-agent-skill. It costs 124 tokens per session (2,309 once invoked), scanned A, original, MIT.

Expert guidance for Swift Testing, Apple's modern framework for writing tests in Swift. It covers test structure, test doubles such as mocks and stubs, integration tests, and snapshot tests.

In plain words
What is it for?
Use it when creating or migrating tests with @Test, #expect, #require, or @Suite, and when planning unit tests, integration tests, snapshots, fixtures, mocks, stubs, or spies.
Why use it?
It helps developers write tests that are easier to understand and less fragile, while choosing the right assertion and test-double approach.

Skill for Claude CodeCodex

Install

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.

agentmods
npx agentmods add skills/bocato/swift-testing-agent-skill/swift-testing
Any agent
npx skills add bocato/swift-testing-agent-skill --skill swift-testing
Clone the repo
git clone --depth 1 https://github.com/bocato/swift-testing-agent-skill

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for swift-testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/bocato/swift-testing-agent-skill/swift-testing.svg)](https://agentmods.dev/skills/bocato/swift-testing-agent-skill/swift-testing)
Your own site
<a href="https://agentmods.dev/skills/bocato/swift-testing-agent-skill/swift-testing"><img src="https://agentmods.dev/badge/skills/bocato/swift-testing-agent-skill/swift-testing.svg" alt="Measured on agentmods" height="20"></a>
Per session 124 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,309 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00124 $0.02309
Opus 5 $0.00062 $0.01154
Sonnet 5 $0.00025 $0.00462
Haiku 4.5 $0.00012 $0.00231

Measured 4d ago against content hash 81b4e5a051d4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

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 4d 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.

swift-testing/SKILL.md · 296 lines

How it starts

The opening of the file, as written. The whole thing — 296 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Swift Testing

Overview

This skill provides expert guidance on Swift Testing, covering the modern Swift Testing framework, test doubles (mocks, stubs, spies), fixtures, integration testing, snapshot testing, and migration from XCTest. Use this skill to help developers write reliable, maintainable tests following F.I.R.S.T. principles and Arrange-Act-Assert patterns.

Agent Behavior Contract (Follow These Rules)

  1. Use Swift Testing framework (@Test, #expect, #require, @Suite) for all new tests, not XCTest.
  2. Always structure tests with clear Arrange-Act-Assert phases.
  3. Follow F.I.R.S.T. principles: Fast, Isolated, Repeatable, Self-Validating, Timely.
  4. Use proper test double terminology per Martin Fowler's taxonomy (Dummy, Fake, Stub, Spy, SpyingStub, Mock).
  5. Place fixtures close to models with #if DEBUG, not in test targets.
  6. Place test doubles close to interfaces with #if DEBUG, not in test targets.
  7. Prefer state verification over behavior verification - simpler, less brittle tests.
  8. Use #expect for soft assertions (continue on failure) and #require for hard assertions (stop on failure).

Quick Decision Tree

When a developer needs testing guidance, follow this decision tree:

  1. Starting fresh with Swift Testing?

    • Read references/test-organization.md for suites, tags, traits
    • Read references/async-testing.md for async test patterns
  2. Need to create test data?

    • Read references/fixtures.md for fixture patterns and placement
    • Read references/test-doubles.md for mock/stub/spy patterns
  3. Testing multiple inputs?

    • Read references/parameterized-tests.md for parameterized testing
  4. Testing module interactions?

    • Read references/integration-testing.md for integration test patterns
  5. Testing UI for regressions?

    • Read references/snapshot-testing.md for snapshot testing setup
  6. Testing data structures or state?

    • Read references/dump-snapshot-testing.md for text-based snapshot testing

Read the full file on GitHub · 296 lines

Changes

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.

  1. 4d ago First seen · 296 lines · 124 tokens per session scan A 81b4e5a051d4

Subscribe to this mod's changes

swift-testing is a skill published in the GitHub repository bocato/swift-testing-agent-skill (80 stars, last pushed 7mo ago), licensed MIT. It adds 124 tokens to every session and 2,309 once invoked, about $0.0006 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-08-30.

Related

Other skills, from other repositories

swift_expert

Swift and iOS/macOS specialist. Protocol-oriented programming and SwiftUI patterns.

ApexIQ/skillsmith · 20 tokens

Swift Patterns

Use this skill when working on Swift projects (SwiftPM packages, iOS/macOS apps) and you want consistent patterns for concurrency, structure, and safety.

AmariahAK/atlarix-skills · 2 tokens

app-ui-design

Mobile app UI design expert for iOS and Android. Use when designing app interfaces, creating design systems, ensuring accessibility, or following platform guidelines. Covers Material Design 3, Human Interface Guidelines, color theory, typography, and 2025 trends.

majiayu000/spellbook · 54 tokens

workflow-audit

Systematic UI workflow auditing for SwiftUI applications. Discovers entry points, traces user flows, detects dead ends and broken promises, audits data wiring, evaluates from user perspective. Triggers: "workflow audit", "audit flows", "find dead ends", "check navigation".

Terryc21/workflow-audit · 59 tokens

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…

AvdLee/Swift-Testing-Agent-Skill · 73 tokens

swiftui-backports

Find SwiftUIBackports replacements for SwiftUI APIs unavailable on a project deployment target. Use for Swift/SwiftUI compiler availability errors, old iOS/tvOS/watchOS/macOS targets, or when implementing SwiftUI app features that may benefit from SwiftUIBackports.

shaps80/SwiftUIBackports · 60 tokens