swift-testing

swift-testing is a skill for Claude Code, Codex from jeremieb/swift-unit-test-instructions. It costs 87 tokens per session (1,352 once invoked), scanned A, original, MIT.

A test-writing assistant for Swift, SwiftUI, and UIKit apps. It creates unit tests for code behavior and UI tests for user-facing flows using Swift Testing or XCTest.

In plain words
What is it for?
Use it to test view models, services, repositories, formatters, validators, utilities, asynchronous flows, error paths, and complete UI interactions.
Why use it?
It helps catch broken state changes, error handling, data transformations, and asynchronous behavior before they reach users. It focuses tests on observable behavior instead of private implementation details.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions CLAUDE.md.

Good fit Use it to test view models, services, repositories, formatters, validators, utilities, asynchronous flows, error paths, and complete UI interactions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jeremieb/swift-unit-test-instructions/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 jeremieb/swift-unit-test-instructions --skill swift-testing
Clone the repo
git clone --depth 1 https://github.com/jeremieb/swift-unit-test-instructions

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/jeremieb/swift-unit-test-instructions/swift-testing.svg)](https://agentmods.dev/skills/jeremieb/swift-unit-test-instructions/swift-testing)
Your own site
<a href="https://agentmods.dev/skills/jeremieb/swift-unit-test-instructions/swift-testing"><img src="https://agentmods.dev/badge/skills/jeremieb/swift-unit-test-instructions/swift-testing.svg" alt="Measured on agentmods" height="20"></a>
Per session 87 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,352 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.00087 $0.01352
Opus 5 $0.00044 $0.00676
Sonnet 5 $0.00017 $0.00270
Haiku 4.5 $0.00009 $0.00135

Measured 7d ago against content hash 6e4371967834, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-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 7d 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.

skills/swift-testing/SKILL.md · 182 lines

How it starts

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

Swift Testing

Instructions

Step 1: Determine Testing Mode

Check CLAUDE.md for Testing Mode:

  • enterprise → consult references/enterprise.md for strict rules
  • indie → consult references/indie.md for pragmatic rules
  • If not set: ask the user which mode applies

Step 2: Identify What to Test

Ask if not already clear:

  • Which type / function / feature needs tests?
  • What is the expected behavior (not implementation)?
  • Are there async operations?
  • Are there existing mocks or does the skill need to create them?

Always test:

  • ViewModels (state changes, actions, error states)
  • Services and Repositories (business logic, data transformations)
  • Formatters, validators, utilities
  • Async flows end-to-end (with mocked dependencies)
  • Edge cases and error paths

Never test:

  • Private implementation details
  • SwiftUI view tree structure or layout positions
  • UIViewController internal wiring

Step 3: Choose the Framework

Scenario Framework
New unit tests (Swift 5.9+, iOS 16+) Swift Testing (@Test, #expect)
Legacy or team convention on XCTest XCTest (XCTestCase, XCTAssert*)
UI / end-to-end tests XCTest + XCUITest
Async unit tests Both support async — use await

Do NOT mix Swift Testing and XCTest in the same test target.

Step 4: Write Tests

Naming (both frameworks):

test_when_<Condition>_should_<ExpectedOutcome>()

Structure — Swift Testing:

import Testing
@testable import MyApp

@MainActor
struct LoginViewModelTests {

    @Test func test_when_credentialsAreValid_should_setIsLoggedIn() async throws {
        // Arrange
        let authService = MockAuthService(willSucceed: true)
        let sut = LoginViewModel(authService: authService)

        // Act
        await sut.login(email: "[email protected]", password: "secret")

        // Assert
        #expect(sut.isLoggedIn == true)
        #expect(sut.error == nil)
    }

    @Test func test_when_credentialsAreInvalid_should_setError() async throws {
        // Arrange
        let authService = MockAuthService(willSucceed: false)
        let sut = LoginViewModel(authService: authService)

        // Act
        await sut.login(email: "[email protected]", password: "wrong")

        // Assert
        #expect(sut.isLoggedIn == false)
        #expect(sut.error != nil)
    }
}

Read the full file on GitHub · 182 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 7d ago First seen · 182 lines · 87 tokens per session scan A 6e4371967834

Subscribe to this mod's changes

swift-testing is a skill published in the GitHub repository jeremieb/swift-unit-test-instructions (5 stars, last pushed 6mo ago), licensed MIT. It adds 87 tokens to every session and 1,352 once invoked, about $0.0004 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-31.

Related

Other skills, from other repositories

testing-arsenal

Testing strategies including unit tests, integration tests, E2E tests, mocking, coverage analysis, and TDD workflow. Trigger when users need help writing tests, choosing testing frameworks, implementing mocking strategies, or setting up test infrastructure.

FutureJJ/claude-skills · 51 tokens

testing-patterns

Cross-language testing strategies and patterns. Triggers on: test pyramid, unit test, integration test, e2e test, TDD, BDD, test coverage, mocking strategy, test doubles, test isolation.

aiskillstore/marketplace · 47 tokens

ios-testing

Invoke any time a user is writing iOS/Swift tests or asking why tests behave a certain way — including XCTest versus Swift Testing (@Test/#expect) choices, async ViewModel tests with @Observable or @Published, snapshot testing across device sizes, mocking protocols for dependency injection, setUp/tearDown lifecycle…

rusel95/ios-agent-skills · 134 tokens

pwp-test

Testing strategy and implementation protocol — structured quality assurance that catches real bugs. Use this skill whenever the user asks to write tests, add test coverage, set up a testing strategy, or asks 'how should I test this'. Also use when they say 'add tests', 'write tests for this', 'test coverage', 'what…

shandar/pwp-plugin · 104 tokens

qa-react

React testing skill with React Testing Library, Vitest, MSW, and Playwright. Use when writing or running React frontend tests.

endorphin-ai/claude-code-teams · 30 tokens

asc-shots-pipeline

Orchestrate iOS screenshot automation with xcodebuild/simctl for build-run, AXe for UI actions, JSON settings and plan files, Koubou-based framing (asc screenshots frame), and screenshot upload (asc screenshots upload). Use when users ask for automated screenshot capture, AXe-driven simulator flows, frame composition…

rorkai/app-store-connect-cli-skills · 79 tokens