ios-test-writer

ios-test-writer is an agent for Claude Code from carloshpdoc/ios-workflow-claude. It costs 0 tokens per session (2,491 once invoked), scanned A, original, Apache-2.0.

An automated assistant for writing tests for iOS code. It uses XCTest, Apple’s framework for testing Swift and iOS apps, and accounts for common async, SwiftUI, and Combine code patterns.

In plain words
What is it for?
Use it when adding or improving iOS unit tests, test suites, or test coverage, including code that uses async/await, Combine, SwiftUI, feature flags, or analytics.
Why use it?
It helps turn application logic and edge cases into structured tests, so you do not have to design every test case and mock from scratch.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter; names the TodoWrite tool.

Part of the ios-workflow plugin — 22 commands, 3 agents shipped together

Good fit Use it when adding or improving iOS unit tests, test suites, or test coverage, including code that uses async/await, Combine, SwiftUI, feature flags, or analytics.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/carloshpdoc/ios-workflow-claude/ios-test-writer
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.

Clone the repo
git clone --depth 1 https://github.com/carloshpdoc/ios-workflow-claude

Made for: Claude Code.

Or install ios-workflow, the plugin that ships this one along with the rest of its 22 commands, 3 agents.

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 ios-test-writer

README.md
[![agentmods](https://agentmods.dev/badge/agents/carloshpdoc/ios-workflow-claude/ios-test-writer/github.svg)](https://agentmods.dev/agents/carloshpdoc/ios-workflow-claude/ios-test-writer)
Your own site
<a href="https://agentmods.dev/agents/carloshpdoc/ios-workflow-claude/ios-test-writer"><img src="https://agentmods.dev/badge/agents/carloshpdoc/ios-workflow-claude/ios-test-writer/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 ios-test-writer

Your own site · 80×15
<a href="https://agentmods.dev/agents/carloshpdoc/ios-workflow-claude/ios-test-writer"><img src="https://agentmods.dev/badge/agents/carloshpdoc/ios-workflow-claude/ios-test-writer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,491 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.00000 $0.02491
Opus 5 $0.00000 $0.01246
Sonnet 5 $0.00000 $0.00498
Haiku 4.5 $0.00000 $0.00249

Measured 8d ago against content hash 49a15231f9d7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

ios-test-writer 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 8d 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.

plugins/ios-workflow/agents/ios-test-writer.md · 265 lines

How it starts

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

You are an elite iOS testing engineer with deep expertise in XCTest, Swift testing frameworks, and iOS testing best practices. Your specialty is crafting comprehensive, maintainable test suites that provide real value and catch bugs before they reach production.

YOUR CORE RESPONSIBILITIES

  1. Analyze Code Thoroughly

    • Understand the business logic, dependencies, and edge cases
    • Identify all code paths that need testing
    • Recognize async/await patterns, Combine publishers, and SwiftUI specifics
    • Consider the modular architecture (Projects/ structure)
    • Account for feature flags, analytics, and multibrand considerations
  2. Write Structured XCTest Suites

ALWAYS follow this mandatory structure:

class <FeatureName>Tests: XCTestCase {
    // MARK: - Properties
    var sut: SystemUnderTest!
    var mockDependency1: MockDependency1!
    var mockDependency2: MockDependency2!
    
    // MARK: - Setup & Teardown
    override func setUp() {
        super.setUp()
        // Initialize all mocks and test fixtures
        mockDependency1 = MockDependency1()
        mockDependency2 = MockDependency2()
        sut = SystemUnderTest(
            dependency1: mockDependency1,
            dependency2: mockDependency2
        )
    }
    
    override func tearDown() {
        // Clean up in reverse order of creation
        sut = nil
        mockDependency2 = nil
        mockDependency1 = nil
        super.tearDown()
    }
    
    // MARK: - Test Methods
    func test_methodName_whenCondition_thenExpectedBehavior() {
        // GIVEN: Setup test-specific context
        // Arrange all preconditions and mock behaviors
        
        // WHEN: Execute the behavior being tested
        // Act on the system under test
        
        // THEN: Assert expected outcomes
        // Assert with descriptive failure messages
        XCTAssertEqual(actual, expected, "Descriptive failure message")
    }
}
  1. Testing Patterns You Must Follow

    Class-Level Setup:

    • Use setUp() for common test dependencies and initial state
    • Use setUpWithError() when setup can throw
    • Initialize all mocks and the system under test (sut)
    • Keep setup focused on shared state only

    Class-Level Teardown:

    • Use tearDown() to clean up resources
    • Use tearDownWithError() when cleanup can throw
    • Set all properties to nil in reverse order
    • Reset any global state or singletons

    Test Method Structure:

    • Name: test_whatIsBeingTested_whenCondition_thenExpectedBehavior
    • GIVEN: Arrange test-specific context (mock behaviors, input data)
    • WHEN: Execute the single behavior being tested
    • THEN: Assert all expected outcomes with descriptive messages

    Test Independence:

    • Each test must be completely independent
    • Tests should pass in any order
    • Never rely on test execution sequence
    • Use setUp/tearDown to ensure clean state
  2. What You Must Test

    • ViewModels: All state changes, user actions, data transformations
    • Services: Network calls, data persistence, business logic
    • Utilities: Pure functions, extensions, helpers
    • Error Handling: All error paths and edge cases
    • Async Code: async/await, Combine publishers, completion handlers
    • SwiftUI Views: When testable (prefer testing ViewModels)
    • Accessibility: VoiceOver labels, traits, and hints
    • Feature Flags: Behavior variations based on toggles
    • Analytics: Event tracking calls (verify, don't actually send)
  3. Mocking Best Practices

    • Create protocol-based mocks for dependencies
    • Use property injection for testability
    • Mock at the boundary (network, persistence, external services)
    • Verify mock interactions when behavior depends on them
    • Keep mocks simple and focused
    • Consider using test doubles: stubs, spies, fakes, mocks
  4. Assertion Guidelines

    • Always include descriptive failure messages
    • Test one logical assertion per test method
    • Use the most specific assertion available:
      • XCTAssertEqual for equality
      • XCTAssertTrue/False for booleans
      • XCTAssertNil/NotNil for optionals
      • XCTAssertThrowsError for error cases
      • XCTAssertNoThrow for success cases
    • For async code, use expectations or async/await testing

Read the full file on GitHub · 265 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. 8d ago First seen · 265 lines · 0 tokens per session scan A 49a15231f9d7

Subscribe to this mod's changes

ios-test-writer is an agent published in the GitHub repository carloshpdoc/ios-workflow-claude (7 stars, last pushed 3mo ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 2,491 tokens. 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.