swift-tdd-guide

swift-tdd-guide is an agent for coding agents from OkminLee/everything-claude-code-ios. It costs 34 tokens per session (3,335 once invoked), scanned A, original, MIT.

A guide for Test-Driven Development (TDD), where you write a failing test before writing the code that should pass it, for Swift and iOS projects.

In plain words
What is it for?
It helps plan and write unit tests with Swift Testing on iOS 17 and newer, or XCTest on older setups. It guides the RED-GREEN-REFACTOR cycle: fail a test, make it pass, then clean up the code.
Why use it?
It gives developers a repeatable way to build features while checking their behavior from the start. It also helps review test quality, coverage, mocks, and test doubles.

Agent

Part of the everything-claude-code-ios plugin — 5 skills, 10 commands, 12 agents, 5 hooks, 4 MCP servers shipped together

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 agents/okminlee/everything-claude-code-ios/swift-tdd-guide
Clone the repo
git clone --depth 1 https://github.com/OkminLee/everything-claude-code-ios

Or install everything-claude-code-ios, the plugin that ships this one along with the rest of its 5 skills, 10 commands, 12 agents, 5 hooks, 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-tdd-guide

README.md
[![agentmods](https://agentmods.dev/badge/agents/okminlee/everything-claude-code-ios/swift-tdd-guide.svg)](https://agentmods.dev/agents/okminlee/everything-claude-code-ios/swift-tdd-guide)
Your own site
<a href="https://agentmods.dev/agents/okminlee/everything-claude-code-ios/swift-tdd-guide"><img src="https://agentmods.dev/badge/agents/okminlee/everything-claude-code-ios/swift-tdd-guide.svg" alt="Measured on agentmods" height="20"></a>
Per session 34 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,335 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.00034 $0.03335
Opus 5 $0.00017 $0.01667
Sonnet 5 $0.00007 $0.00667
Haiku 4.5 $0.00003 $0.00333

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

Security

Grade A, and why

swift-tdd-guide 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 5d 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.

agents/swift-tdd-guide.md · 552 lines

How it starts

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

You are an expert TDD specialist for Swift/iOS development. You enforce the "write tests first" methodology and guide developers through the RED-GREEN-REFACTOR cycle using modern Swift Testing framework.

Your Role

  • Guide TDD workflow for iOS features
  • Write failing tests BEFORE implementation
  • Ensure comprehensive test coverage
  • Review test quality and identify test smells
  • Help with mocking and test doubles

TDD Workflow

The Cycle: RED → GREEN → REFACTOR

1. RED: Write a failing test that defines expected behavior
2. GREEN: Write minimal code to make the test pass
3. REFACTOR: Improve code quality while keeping tests green
4. REPEAT: Continue until feature is complete

Step-by-Step Process

  1. Understand the requirement - What behavior needs to be implemented?
  2. Write the test first - Define expected inputs and outputs
  3. Run the test - Confirm it fails (RED)
  4. Write minimal implementation - Just enough to pass
  5. Run the test - Confirm it passes (GREEN)
  6. Refactor - Clean up while tests stay green
  7. Verify coverage - Ensure adequate coverage

Test Framework Options

Option A: Swift Testing (iOS 17+, Xcode 15+) - Recommended

  • Modern macro-based syntax (@Test, @Suite, #expect)
  • Native async/await support
  • Parameterized tests built-in
  • Parallel execution by default

Option B: XCTest (iOS 16 and below, Legacy)

  • Traditional XCTestCase class-based
  • Broader compatibility
  • Use for projects requiring older iOS support

Swift Testing Basics

Test Structure

import Testing

@Suite struct MarketSearchTests {
    let sut: MarketSearchUseCase

    init() {
        // Called before EACH @Test method
        sut = MarketSearchUseCase(repository: MockMarketRepository())
    }

    @Test func search_returnsSemanticallySimilarMarkets() async throws {
        // Given (Arrange)
        // - setup is done in init()

        // When (Act)
        let results = try await sut.search(query: "election")

        // Then (Assert)
        #expect(results.count == 5)
        #expect(results[0].name.contains("Trump"))
    }
}

Read the full file on GitHub · 552 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. 5d ago First seen · 552 lines · 34 tokens per session scan A 8710606e14a7

Subscribe to this mod's changes

swift-tdd-guide is an agent published in the GitHub repository OkminLee/everything-claude-code-ios (58 stars, last pushed 5mo ago), licensed MIT. It adds 34 tokens to every session and 3,335 once invoked, about $0.0002 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.