creating-test

creating-test is a skill for Claude Code from SwiftfulThinking/SwiftfulStarterProject. It costs 56 tokens per session (779 once invoked), scanned A, original, MIT.

A guide for creating unit tests in Swift using Apple's newer Swift Testing framework. Unit tests check small pieces of code, such as a manager or presenter, in isolation.

In plain words
What is it for?
Use it to scaffold a test file that mirrors the app's folders, adds Swift Testing annotations and assertions, and covers key behaviours of a class or struct.
Why use it?
It provides a consistent test location and structure instead of leaving test files, imports, and assertions to be worked out each time.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Good fit Use it to scaffold a test file that mirrors the app's folders, adds Swift Testing annotations and assertions, and covers key behaviours of a class or struct.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/swiftfulthinking/swiftfulstarterproject/creating-test
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 SwiftfulThinking/SwiftfulStarterProject --skill creating-test
Clone the repo
git clone --depth 1 https://github.com/SwiftfulThinking/SwiftfulStarterProject

Made for: Claude Code.

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 creating-test

README.md
[![agentmods](https://agentmods.dev/badge/skills/swiftfulthinking/swiftfulstarterproject/creating-test/github.svg)](https://agentmods.dev/skills/swiftfulthinking/swiftfulstarterproject/creating-test)
Your own site
<a href="https://agentmods.dev/skills/swiftfulthinking/swiftfulstarterproject/creating-test"><img src="https://agentmods.dev/badge/skills/swiftfulthinking/swiftfulstarterproject/creating-test/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 creating-test

Your own site · 80×15
<a href="https://agentmods.dev/skills/swiftfulthinking/swiftfulstarterproject/creating-test"><img src="https://agentmods.dev/badge/skills/swiftfulthinking/swiftfulstarterproject/creating-test.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 779 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.00056 $0.00779
Opus 5.5 $0.00022 $0.00312
Sonnet 5.5 $0.00011 $0.00156
Haiku 4.5 $0.00006 $0.00078

Measured 1mo ago against content hash 35df6cb89228, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

creating-test 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.

.claude/skills/creating-test/SKILL.md · 74 lines

How it starts

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

Creating Test

Scaffold a unit test file using Swift Testing (@Test, #expect, #require) — not XCTest.

Steps

  1. Identify the class/struct to test (e.g., UserManager, HomePresenter)
  2. Determine the test file location (see below)
  3. Read references/swift-testing-patterns.md for assertion and async patterns
  4. Create the test file with the template below
  5. Add test methods for the key behaviors

File Location

Test files mirror the app's folder structure inside the unit test target, with a _Tests suffix:

App File Test File
Managers/User/UserManager.swift SwiftfulStarterProjectUnitTests/Managers/User/UserManager_Tests.swift
Core/Home/HomePresenter.swift SwiftfulStarterProjectUnitTests/Core/Home/HomePresenter_Tests.swift
Managers/ABTest/Services/MockABTestService.swift Generally not tested (it's already a mock)

Create intermediate folders as needed to match the app structure.

Template

import Testing
@testable import SwiftfulStarterProject

struct {ClassName}_Tests {

    @Test
    @MainActor
    func someMethodReturnsExpectedResult() async throws {
        // Given
        let sut = {ClassName}(service: Mock{ServiceName}Service(), logManager: nil)

        // When
        let result = await sut.someMethod()

        // Then
        #expect(result == expected)
    }
}

Key Patterns

  • Use Swift Testing — @Test + #expect + #require, NOT XCTest classes
  • Use structs for test containers, not classes
  • @testable import SwiftfulStarterProject — gives access to internal types
  • @MainActor on tests that test @MainActor types (managers, presenters) — do NOT use @MainActor on non-UI tests
  • Inject mock services — test the manager/presenter in isolation, never use Prod services
  • Given/When/Then comments inside each test method — do NOT put these keywords in the method name
  • No test prefix needed — Swift Testing uses @Test macro instead
  • Display names — @Test("Descriptive name") for human-readable failure output
  • #require for preconditions — use try #require(value) to unwrap optionals and halt early instead of force-unwrapping
  • Parameterize — use @Test(arguments:) instead of copy-pasting test methods that differ only in input
  • Method naming: descriptive camelCase (e.g., signOutClearsUser, loadDataWithErrorSetsErrorState)
  • Struct naming: _Tests suffix (e.g., UserManager_Tests)

Read the full file on GitHub · 74 lines

Files

What ships with it

1 file 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. 1mo ago First seen · 74 lines · 56 tokens per session scan A 35df6cb89228

Subscribe to this mod's changes

creating-test is a skill published in the GitHub repository SwiftfulThinking/SwiftfulStarterProject (74 stars, last pushed 7d ago), licensed MIT. It adds 56 tokens to every session and 779 once invoked, about $0.0002 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-09-04.

Related

Other skills, from other repositories

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

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

guide-swift-testing

Swift Testing patterns — structs over classes, async confirmations, parameterized tests, exit tests, attachments, common agent mistakes. Use when writing, reviewing, or migrating Swift Testing code.

Prisma-Labs-Dev/apple-skills · 41 tokens

swift-testing

WHEN writing, running, or diagnosing Swift Testing suites, including migrating XCTest tests to them and a crashing or non-reporting test target under xcodebuild; NOT for authoring XCTest or XCUITest tests; returns macro-driven test patterns, the XCTest boundary, and the correct way to read xcodebuild results.

mintuz/skills · 66 tokens

modernize-tests

Modernize test suites to use modern Swift Testing features or migrate from XCTest.

aduermael/herm · 19 tokens

testing-coroutines-with-runtest

Use this skill to test suspend functions and coroutine-using classes on the JVM with kotlinx-coroutines-test. Covers runTest, TestScope, StandardTestDispatcher vs UnconfinedTestDispatcher, virtual time via TestCoroutineScheduler (advanceTimeBy, advanceUntilIdle, runCurrent), the canonical MainDispatcherRule wrapper…

skydoves/android-testing-skills · 172 tokens