Agent skill

Swift Testing

by nimblehq in nimblehq/ios-templates

Write, review, or migrate unit tests using Swift Testing (@Test, @Suite, expect, require).

MITAuto-check passedTesting & QA

Install Swift Testing

skills CLI
$ npx skills add nimblehq/ios-templates --skill swift-testing -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install nimblehq/ios-templates swift-testing --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/nimblehq/ios-templates.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/swift-testing .claude/skills/swift-testing && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
swift-testing
GitHub stars
110
Token cost
~1.3k tokens
SKILL.md length
429 words
Files
7 (incl. references)
Skills in repo
5
Repo updated
First seen
Licence
MIT

At a glance

Write, review, or migrate unit tests using Swift Testing (@Test, @Suite, expect, require).

  • Works in 9 steps: Swift Testing for all new… → Use #expect as the default assertion;… → Design tests to run safely in parallel… → …
  • Writing new tests
  • SKILL.md covers Overview, Agent Behavior Contract, Quick Triage and File Naming & Placement, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Swift Testing is an agent skill from nimblehq/ios-templates. Write, review, or migrate unit tests using Swift Testing (@Test, @Suite, expect, require). Use when writing new tests, converting existing Quick+Nimble specs to Swift Testing, reviewing test quality, debugging flaky tests, or improving test structure in this iOS template project. Triggers on: "write test", "add test", "test this", "migrate test", "convert spec", "Swift Testing".

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including reference files (for example `references/async-testing.md`, `references/expectations.md` and `references/fundamentals.md`).

It sits in Testing & QA, covering iOS development and Test generation. It works with iOS. The repository describes itself as: Our optimized iOS templates used in our projects. The licence is MIT.

When your agent uses it

  • Writing new tests
  • Converting existing Quick+Nimble specs to Swift Testing
  • Reviewing test quality
  • Debugging flaky tests

Example prompts

  • “write test”
  • “add test”
  • “test this”
  • “/swift-testing”

Workflow steps

9 steps, taken from the first numbered list in SKILL.md.

  1. Swift Testing for all new unit/integration tests. Retain Quick+Nimble only for existing specs; do not migrate unless asked.
  2. Use #expect as the default assertion; use #require only when subsequent lines depend on a prerequisite value.
  3. Design tests to run safely in parallel by default. Fix shared state before reaching for .serialized.
  4. Use inline private struct / private actor stubs conforming to domain protocols — no generated mocks.
  5. Use actor stubs when the protocol requires async or has mutable state; use struct stubs otherwise.
  6. Prefer parameterized tests (@Test(arguments:)) over duplicated test methods.
  7. Use traits (.enabled, .disabled, .timeLimit, .bug, .tags) instead of ad-hoc comments.
  8. Import Testing only in test targets, never in app/library targets.
  9. Keep tests deterministic — no real network calls. Use NetworkStubber (OHHTTPStubs) for network-level tests.

What it can do on your machine

Read from SKILL.md and the folder at commit f009d02. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are swift).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Swift Testing loads about 1.3k tokens when it runs, and up to ~6.8k if it reads all its reference files. Until then it costs about 99 tokens; SKILL.md has 429 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~99
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~6.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from nimblehq/ios-templates at commit f009d02, republished under its MIT licence (© nimblehq). 429 words, ~1,258 tokens.

Download SKILL.mdSave it as .claude/skills/swift-testing/SKILL.md (or your agent's skills folder). This skill also uses 6 other files; get the full folder from GitHub.
name
swift-testing
description
Write, review, or migrate unit tests using Swift Testing (@Test, @Suite, #expect, #require). Use when writing new tests, converting existing Quick+Nimble specs to Swift Testing, reviewing test quality, debugging flaky tests, or improving test structure in this iOS template project. Triggers on: "write test", "add test", "test this", "migrate test", "convert spec", "Swift Testing".

Swift Testing

Overview

Write, review, migrate, and debug tests using Swift Testing for this iOS template project. This project uses Quick + Nimble (*Spec.swift) as the legacy framework and Swift Testing (*Tests.swift) for all new tests.

Agent Behavior Contract

  1. Swift Testing for all new unit/integration tests. Retain Quick+Nimble only for existing specs; do not migrate unless asked.
  2. Use #expect as the default assertion; use #require only when subsequent lines depend on a prerequisite value.
  3. Design tests to run safely in parallel by default. Fix shared state before reaching for .serialized.
  4. Use inline private struct / private actor stubs conforming to domain protocols — no generated mocks.
  5. Use actor stubs when the protocol requires async or has mutable state; use struct stubs otherwise.
  6. Prefer parameterized tests (@Test(arguments:)) over duplicated test methods.
  7. Use traits (.enabled, .disabled, .timeLimit, .bug, .tags) instead of ad-hoc comments.
  8. Import Testing only in test targets, never in app/library targets.
  9. Keep tests deterministic — no real network calls. Use NetworkStubber (OHHTTPStubs) for network-level tests.

Quick Triage

Before writing or reviewing tests, clarify:

  1. New or migration? Writing fresh tests vs converting an existing *Spec.swift.
  2. Which module? App ({PROJECT_NAME}Tests/), Data (Modules/Data/Tests/), Domain (Modules/Domain/Tests/), or Model (Modules/Model/Tests/).
  3. Async? Does the code under test use async/await?
  4. Shared resources? Database, network, file system, or singleton state involved?

File Naming & Placement

FrameworkSuffixPlacement
Swift Testing*Tests.swiftTests/Sources/ mirroring production path (e.g. Repositories/, Entities/)
Quick + Nimble*Spec.swiftTests/Sources/Specs/
Show full SKILL.md (187 more words)Show less

Canonical Pattern (this project)

swift
import Testing

@testable import Data
import Domain

@Suite("DefaultRemoteConfigRepository")
struct DefaultRemoteConfigRepositoryTests {

    @Test("returns a typed stored value")
    func returnsATypedStoredValue() async {
        let booleanKey = RemoteConfigKey(name: "feature_enabled", defaultValue: false)
        let repository = DefaultRemoteConfigRepository(
            source: StubRemoteConfigSource(values: [
                booleanKey.name: .string("true")
            ])
        )

        let value = await repository.value(for: booleanKey)

        #expect(value == true)
    }
}

private actor StubRemoteConfigSource: RemoteConfigSource {

    private let values: [String: RemoteConfigStoredValue]

    init(values: [String: RemoteConfigStoredValue] = [:]) {
        self.values = values
    }

    func refresh() async throws {}

    func value(forKey key: String) async -> RemoteConfigStoredValue? {
        values[key]
    }
}

Key observations:

  • struct suite, not class
  • @Suite("DisplayName") with human-readable name matching the type under test
  • @Test("description") with lowercase sentence describing behavior
  • Function name is camelCase matching the description (no test prefix)
  • Arrange / Act / Assert with blank line separations
  • Inline private actor stub at bottom of file (actor because protocol has async)
  • @testable import for the module under test; regular import for its dependencies

Routing to References

Load the appropriate reference file based on the task:

TaskReference
Writing new tests, suite structure, namingreferences/fundamentals.md
Assertions, error checking, known issuesreferences/expectations.md
Traits, tags, conditional executionreferences/traits-and-tags.md
Data-driven / parameterized testsreferences/parameterized-testing.md
Async/await, callbacks, confirmationsreferences/async-testing.md
Creating stubs, fakes, network mocksreferences/test-doubles.md

Verification Checklist

Before finishing, confirm:

  • Each test verifies one clear behavior
  • #require is used for prerequisites; #expect for everything else
  • Parameterized tests replace duplicated test methods
  • Tests are parallel-safe (no shared mutable state)
  • Async tests use async functions directly (no Task.sleep hacks)
  • Stubs are private struct or private actor at bottom of file
  • File is named *Tests.swift and placed in the correct module test directory
  • No real network calls — NetworkStubber or protocol stubs used

© nimblehq, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 6 other files (references) in skills/swift-testing of nimblehq/ios-templates.

  • SKILL.md
  • references/async-testing.md
  • references/expectations.md
  • references/fundamentals.md
  • references/parameterized-testing.md
  • references/test-doubles.md
  • references/traits-and-tags.md

Open the folder on GitHubat commit f009d02

Compare with similar skills

Swift Testing next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Swift Testing compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Swift Testing this skillnimblehq/ios-templates110—~1.3kAutomated safety check: PassMIT
Testing iOS Codebitwarden/ios695—~1.8kAutomated safety check: PassGPL-3.0
Test Generatorgustavscirulis/snapgrid1171 repos~2.7kAutomated safety check: NotesCustom licence
Engine E2Ewix/react-native-navigation13k—~1.1kAutomated safety check: PassMIT
iOS Accessibility Testingconorluddy/xclaude-plugin183—~5kAutomated safety check: PassMIT
MAUI UI Test Writerdotnet/maui23k—~3kAutomated safety check: PassMIT

Similar skills

  • Testing iOS Code

    bitwarden/ios

    Official

    Write tests, add test coverage, unit test, or add missing tests for Bitwarden iOS.

    695 GitHub stars~1.8k tokensUpdated today
    Testing & QAAuto-check passed
  • Test Generator

    gustavscirulis/snapgrid

    Generate test templates for unit tests, integration tests, and UI tests using Swift Testing and XCTest.

    117 GitHub starsUsed in 1 repo~2.7k tokens
    Testing & QAAuto-check: notes
  • Engine E2E

    wix/react-native-navigation

    Official

    Run Wix Engine (mobile-apps-engine) iOS E2E tests locally to validate RNN changes.

    13k GitHub stars~1.1k tokensUpdated 2 days ago
    Testing & QAAuto-check passed
  • iOS Accessibility Testing

    conorluddy/xclaude-plugin

    Guides WCAG 2.1 and VoiceOver accessibility testing for iOS apps, working from the accessibility tree and not from screenshots.

    183 GitHub stars~5k tokensUpdated 26 days ago
    Testing & QAAuto-check passed
  • Official

    Writes UI tests that reproduce a GitHub issue in .NET MAUI and keeps iterating until the tests actually fail, proving they catch the bug.

    23k GitHub stars~3k tokensUpdated today
    Testing & QAAuto-check passed
  • Coverage Report

    n0an/VivaDicta

    Measure VivaDicta test code coverage from the terminal. An agent skill from n0an/VivaDicta.

    131 GitHub stars~1.2k tokensUpdated 3 days ago
    Testing & QAAuto-check passed

More from nimblehq/ios-templates

  • Swift Concurrency

    nimblehq/ios-templates

    Write, review, or fix Swift 6 concurrency code using actors, Sendable, structured concurrency, and the strict data-race-safety model.

    110 GitHub stars~1.7k tokensUpdated 2 mo ago
    Auto-check passed
  • Tophat Build Install

    nimblehq/ios-templates

    Find, build, and install mobile artifacts for the current repository through GitHub Actions and Tophat.

    110 GitHub stars~1k tokensUpdated 2 mo ago
    Auto-check passed
  • Commit

    nimblehq/ios-templates

    Generate and create a git commit following Nimble's Compass convention ([ID] Verb message).

    110 GitHub stars~790 tokensUpdated 2 mo ago
    Auto-check passed
  • Resolve PR Comments

    nimblehq/ios-templates

    Guided workflow to address, reply to, and resolve GitHub PR review threads — one at a time, collaboratively.

    110 GitHub stars~1.7k tokensUpdated 2 mo ago
    Auto-check passed

Works with

Questions about Swift Testing

What does Swift Testing do?

Write, review, or migrate unit tests using Swift Testing (@Test, @Suite, expect, require). Swift Testing is an agent skill from nimblehq/ios-templates. Write, review, or migrate unit tests using Swift Testing (@Test, @Suite, expect, require).

When should I use Swift Testing?

Swift Testing fits situations like: writing new tests; converting existing Quick+Nimble specs to Swift Testing; reviewing test quality; debugging flaky tests.

How do I install Swift Testing in Claude Code?

Run `npx skills add nimblehq/ios-templates --skill swift-testing -a claude-code`. Or copy the skill folder (skills/swift-testing in nimblehq/ios-templates) into .claude/skills/swift-testing in your project. Claude Code loads it when a task matches its description.

How do I install Swift Testing in Codex?

Run `npx skills add nimblehq/ios-templates --skill swift-testing -a codex`. Or copy the skill folder (skills/swift-testing in nimblehq/ios-templates) into .agents/skills/swift-testing in your project. Codex loads it when a task matches its description.

Can I use Swift Testing in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add nimblehq/ios-templates --skill swift-testing -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/swift-testing, .gemini/skills/swift-testing, .github/skills/swift-testing and .opencode/skills/swift-testing in your project.

What does Swift Testing need to run?

SKILL.md names no scripts, command-line tools or credentials: Swift Testing is instructions for the agent only.

Does Swift Testing access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Swift Testing safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Swift Testing use?

Swift Testing is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Swift Testing use?

About 1.3k tokens (SKILL.md is roughly 5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 5.5k tokens, read only when the agent opens those files.

What are the alternatives to Swift Testing?

Skills that share tags, products or a category with Swift Testing: Testing iOS Code (bitwarden/ios, 695 stars), Test Generator (gustavscirulis/snapgrid, 117 stars), Engine E2E (wix/react-native-navigation, 13k stars) and iOS Accessibility Testing (conorluddy/xclaude-plugin, 183 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Swift Testing?

nimblehq (a GitHub organization) maintains it in nimblehq/ios-templates, which has 110 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on July 27, 2026.

Source: nimblehq/ios-templates on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.