Swift Testing

Swift Testing is a skill for Claude Code from onmyway133/claude-code-plugins. It costs 11 tokens per session (2,957 once invoked), scanned A, original, MIT.

Guidance for writing Swift tests with Apple’s modern Swift Testing framework instead of the older XCTest framework. It shows the framework’s test structure and assertion syntax.

In plain words
What is it for?
Use it to write tests, check values and collections, handle optional values, and verify that code throws expected errors.
Why use it?
It helps you use the correct Swift Testing patterns when creating or updating tests. This reduces confusion when moving away from XCTest.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the super plugin — 6 skills, 5 commands, 6 agents, 4 MCP servers shipped together

Good fit Use it to write tests, check values and collections, handle optional values, and verify that code throws expected errors.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/onmyway133/claude-code-plugins/swift-testing
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.

Any agent
npx skills add onmyway133/claude-code-plugins --skill swift-testing
Clone the repo
git clone --depth 1 https://github.com/onmyway133/claude-code-plugins

Made for: Claude Code.

Or install super, the plugin that ships this one along with the rest of its 6 skills, 5 commands, 6 agents, 4 MCP servers.

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/onmyway133/claude-code-plugins/swift-testing/github.svg)](https://agentmods.dev/skills/onmyway133/claude-code-plugins/swift-testing)
Your own site
<a href="https://agentmods.dev/skills/onmyway133/claude-code-plugins/swift-testing"><img src="https://agentmods.dev/badge/skills/onmyway133/claude-code-plugins/swift-testing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for Swift Testing

Your own site · 80×15
<a href="https://agentmods.dev/skills/onmyway133/claude-code-plugins/swift-testing"><img src="https://agentmods.dev/badge/skills/onmyway133/claude-code-plugins/swift-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 11 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,957 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00011 $0.02957
Opus 5.5 $0.00004 $0.01183
Sonnet 5.5 $0.00002 $0.00591
Haiku 4.5 $0.00001 $0.00296

Measured 1mo ago against content hash c334019fc70c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

plugins/super/skills/swift-testing/SKILL.md · 566 lines

How it starts

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

Swift Testing

You are a Swift testing expert using the modern Swift Testing framework (not XCTest). Apply these patterns when writing tests.

Framework Basics

Import and Structure

import Testing
@testable import MyApp

struct UserTests {
    @Test func createsUserWithValidEmail() {
        let user = User(email: "[email protected]")
        #expect(user.isValid)
    }
}

Key Differences from XCTest

XCTest Swift Testing
class with XCTestCase struct (preferred) or class
func testSomething() @Test func something()
XCTAssertEqual(a, b) #expect(a == b)
XCTAssertTrue(x) #expect(x)
XCTAssertNil(x) #expect(x == nil)
XCTAssertThrowsError #expect(throws:)
setUpWithError() init()
tearDown() deinit

Expectations

Basic Expectations

@Test func basicExpectations() {
    let value = 42

    // Boolean
    #expect(value > 0)
    #expect(value == 42)

    // Optionals
    let optional: String? = "hello"
    #expect(optional != nil)

    // Collections
    let array = [1, 2, 3]
    #expect(array.contains(2))
    #expect(array.count == 3)
}

Require (Unwrapping)

@Test func requireUnwrapping() throws {
    let optional: String? = "hello"

    // Unwrap or fail test
    let value = try #require(optional)
    #expect(value == "hello")

    // With custom message
    let user = try #require(fetchUser(), "User should exist")
    #expect(user.isActive)
}

Error Expectations

@Test func errorHandling() {
    // Expect any error
    #expect(throws: (any Error).self) {
        try riskyOperation()
    }

    // Expect specific error type
    #expect(throws: ValidationError.self) {
        try validate(email: "invalid")
    }

    // Expect specific error value
    #expect(throws: ValidationError.invalidEmail) {
        try validate(email: "")
    }
}

Test Organization

Suites (Grouping)

Read the full file on GitHub · 566 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. 1mo ago First seen · 566 lines · 11 tokens per session scan A c334019fc70c

Subscribe to this mod's changes

Swift Testing is a skill published in the GitHub repository onmyway133/claude-code-plugins (5 stars, last pushed 9mo ago), licensed MIT. It adds 11 tokens to every session and 2,957 once invoked, about $0.0000 per session on Opus 5.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-31.

Related

Other skills, from other repositories

swift_testing

Modern Swift Testing framework patterns and best practices.

onmyway133/skills · 11 tokens

golang-testing

Production-ready Golang tests — table-driven tests, testify suites and mocks, parallel tests, fuzzing, fixtures, goroutine leak detection with goleak, snapshot testing, code coverage, integration tests, idiomatic test naming. Use when writing or reviewing Go tests, choosing a testing approach, setting up Go test CI…

samber/cc-skills-golang · 115 tokens

golang-stretchr-testify

Comprehensive guide to stretchr/testify for Golang testing. Covers assert, require, mock, and suite packages in depth. Use when writing tests with testify, creating mocks, setting up test suites, or choosing between assert and require. Covers testify assertions, mock expectations, argument matchers, call verification…

samber/cc-skills-golang · 97 tokens

swift-testing-pro

Writes, reviews, and improves Swift Testing code using modern APIs and best practices. Use when reading, writing, or reviewing projects that use Swift Testing.

jacklandrin/OnlySwitch · 34 tokens

adk-verify-snippets

Checks that every Python code block in a Markdown file actually compiles and runs, by extracting each block to a temporary file, executing it in an isolated subprocess, and writing a pass/fail report with per-snippet coverage. Use when the user asks to verify, test, or validate the code samples in a README, a guide…

google/adk-python · 149 tokens

adk-setup

Sets up a local ADK Python development environment in a git clone of the open-source adk-python repository: a uv virtual environment, all dependency extras, pre-commit hooks, and a first unit-test run. Runs only when explicitly requested, never on its own. Use when asked to set up, bootstrap, or repair a development…

google/adk-python · 146 tokens