swift-testing

swift-testing is a skill for Claude Code from jyotiraditya-chauhan/test-kit. It costs 111 tokens per session (2,378 once invoked), scanned A, original, MIT.

A test-writing add-on for Swift and SwiftUI apps on iOS and macOS. It writes unit, view-model, and snapshot tests, testing a view model directly when SwiftUI's private view structure cannot be inspected.

In plain words
What is it for?
Use it to test Swift logic, ObservableObject or @Observable view models, and visual snapshots with Swift Testing or XCTest.
Why use it?
It avoids testing SwiftUI through internal view details that are not publicly accessible and follows the test framework already used by the project when possible.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it to test Swift logic, ObservableObject or @Observable view models, and visual snapshots with Swift Testing or XCTest.

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

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 swift-testing

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/jyotiraditya-chauhan/test-kit/swift-testing"><img src="https://agentmods.dev/badge/skills/jyotiraditya-chauhan/test-kit/swift-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 111 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,378 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.00111 $0.02378
Opus 5 $0.00056 $0.01189
Sonnet 5 $0.00022 $0.00476
Haiku 4.5 $0.00011 $0.00238

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

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/detect_stack.sh), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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/skills/swift-testing/SKILL.md · 188 lines

How it starts

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

Swift / SwiftUI Testing

Writes unit, view-model, and snapshot tests for Swift/SwiftUI projects. The central pattern: SwiftUI has no public view-tree introspection, so business logic is tested via the view model, not the view — see reference/view-model-testing.md before generating anything against a view file directly. Writing the test files is the deliverable. Running the suite and verifying it — including the fault-injection self-check — is a separate, optional step this skill offers but never runs without being asked. See Step 6.

Progress checklist

Copy this into your response and check items off as you go:

- [ ] 1. Detect stack + existing test framework (scripts/detect_stack.sh)
- [ ] 2. Audit project structure and existing conventions
- [ ] 3. Ask the user what to test (layer + scope) — do not assume
- [ ] 4. State the test plan explicitly
- [ ] 5. Generate tests following AAA, boundary-only mocking/fakes
- [ ] 6. Report what was written; offer to run + verify — do not run yet
- [ ] 7. Only if asked: run tests, fault-injection self-check, report results

Step 1 — Detect stack

Run scripts/detect_stack.sh from the project root. It confirms this is a Swift project (.xcodeproj/.xcworkspace/Package.swift) and reports whether Swift Testing (@Test), XCTest, or both are already in use, plus swift-snapshot-testing, ViewInspector, and Core Data/SwiftData presence.

If a test framework is already in use, follow it even if a different tool is this skill's default recommendation (Swift Testing for new code). Never generate an XCTAssert* call inside a @Test function or vice versa — see reference/swift-testing-vs-xctest.md; the two frameworks are not cross-compatible and a misplaced assertion silently never registers as a failure.

Step 2 — Audit project structure

Before writing anything:

  • Classify the target: a plain type/service (fully testable in isolation) vs a view model (ObservableObject/@Observable — test this directly, never the view) vs a SwiftUI view itself (needs extraction or ViewInspector — see reference/view-model-testing.md) vs UI automation/performance (XCTest-only, Swift Testing does not cover these — see reference/swift-testing-vs-xctest.md).
  • Match the existing test target/file naming convention.
  • Flag critical paths — authentication, payment/billing, any data-write operation — for elevated rigor even if the user's request was narrower. State this flag out loud; do not silently expand scope.
  • Known gap, say so rather than guessing: this skill does not have reliable, researched guidance on testing on-device AI features built on Apple's Foundation Models framework. If asked to test one, say plainly that this is an under-researched area rather than presenting invented conventions as established practice.

Read the full file on GitHub · 188 lines

Files

What ships with it

6 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. 9d ago First seen · 188 lines · 111 tokens per session scan A 4c8f4f626834

Subscribe to this mod's changes

swift-testing is a skill published in the GitHub repository jyotiraditya-chauhan/test-kit (4 stars, last pushed 19d ago), licensed MIT. It adds 111 tokens to every session and 2,378 once invoked, about $0.0006 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

android-unit-test

Guide for writing and converting Chromium Android unit tests across host Robolectric (chromejunittests) and on-device (chromepublicunittestapk) suites.

chromium/chromium · 36 tokens

react-native-testing

Write tests using React Native Testing Library (RNTL) v13 and v14 (@testing-library/react-native). Use when writing, reviewing, or fixing React Native component tests. Covers: render, screen, queries (getBy/getAllBy/queryBy/findBy), Jest matchers, userEvent, fireEvent, waitFor, and async patterns. Supports v13 (React…

callstack/react-native-testing-library · 134 tokens

flutter-add-widget-test

Implement a component-level test using WidgetTester to verify UI rendering and user interactions (tapping, scrolling, entering text). Use when validating that a specific widget displays correct data and responds to events as expected.

flutter/agent-plugins · 48 tokens

mobiai-android-testing

Use when writing or running tests in an Android project — unit tests, UI tests, choosing the right framework and patterns.

ArisGuimera/MobiAI-Core · 30 tokens

mobiai-ios-testing

Use when writing or running tests in an iOS project — unit tests, UI tests, snapshot tests, choosing the right framework.

ArisGuimera/MobiAI-Core · 31 tokens

maui-unit-testing

Add MAUI app tests around ViewModels, services, platform abstractions, and unit/integration/device boundaries. USE FOR: xUnit, avoiding MauiProgram.CreateMauiApp in unit tests, fakes/mocks, injectable Essentials interfaces, PlatformNotSupportedException, navigation/data services, AppProjectReference, device-test…

dotnet/maui-labs · 84 tokens