dhpk-swift-test-strategy

dhpk-swift-test-strategy is a skill for Claude Code from hmj1026/dhpk. It costs 64 tokens per session (944 once invoked), scanned A, original, MIT.

A testing guide for Swift apps, covering unit, integration, user-interface, performance, asynchronous, and snapshot tests. It also explains how Swift Testing and XCTest fit together and when to use each.

In plain words
What is it for?
Use it when adding or reviewing tests for iOS business logic, user interfaces, asynchronous code, files, Keychain access, or network code.
Why use it?
It removes guesswork about choosing a test type and framework, while encouraging TDD—writing a failing test before the code for a feature or bug fix.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the dhpk plugin — 65 skills, 31 commands, 37 agents, 3 hooks shipped together

Good fit Use it when adding or reviewing tests for iOS business logic, user interfaces, asynchronous code, files, Keychain access, or network code.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hmj1026/dhpk/dhpk-swift-test-strategy
View source ↗ hmj1026/dhpk
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 hmj1026/dhpk --skill dhpk-swift-test-strategy
Clone the repo
git clone --depth 1 https://github.com/hmj1026/dhpk

Made for: Claude Code.

Or install dhpk, the plugin that ships this one along with the rest of its 65 skills, 31 commands, 37 agents, 3 hooks.

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 dhpk-swift-test-strategy

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/hmj1026/dhpk/dhpk-swift-test-strategy"><img src="https://agentmods.dev/badge/skills/hmj1026/dhpk/dhpk-swift-test-strategy.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 64 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 944 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.00064 $0.00944
Opus 5 $0.00032 $0.00472
Sonnet 5 $0.00013 $0.00189
Haiku 4.5 $0.00006 $0.00094

Measured 6d ago against content hash 4a875518357d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

dhpk-swift-test-strategy 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 6d 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.

generated/claude-profiles/compat-v1/package/skills/dhpk-swift-test-strategy/SKILL.md · 82 lines

How it starts

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

Swift test strategy

Load references on demand:

  • references/swift-testing-api.md@Test/#expect/#require/parameterized/traits.
  • references/xctest-bridging.md — XCTest coexistence, async, expectations.
  • references/xcuitest.mdXCUIApplication, launch-arg test seams.
  • references/snapshot-testing.md — swift-snapshot-testing record/verify discipline.
  • references/test-taxonomy.md — the 3-layer model → directories.
  • references/protocol-di-host-testing.md — protocol-fake injection that makes file/Keychain/network code run under host swift test (no simulator).

Core rules

  1. RED first. Write the failing test before the implementation for any new feature or bugfix in business-logic code (services, view models, repositories). See the tdd-guide agent for the workflow; this module supplies the iOS conventions.

  2. Swift Testing for unit/integration, XCTest for UI/perf. New unit and integration tests use import Testing (@Test, #expect, #require). UI tests use XCTest + XCUIApplication; performance uses XCTest measure. The two frameworks coexist in the same project (babylon already has both).

  3. Test async/actor code with await. Mark tests async throws; await the service. Use #require to unwrap-or-fail before asserting on the value.

  4. Inject fakes, don't touch real PHI stores. Unit tests substitute protocol fakes (in-memory Keychain, in-memory Core Data store NSInMemoryStoreType//dev/null URL). No test writes to the real encrypted store or the device Keychain shared with the app.

  5. Three layers, three homes. See test-taxonomy.md. Keep unit tests pure (no I/O), integration tests transactional/isolated, UI tests few and critical.

Critical — never

  • Never assert on print output or sleep-and-hope for async — await the result or use a confirmation.
  • Never leave a flaky timing-based test in the suite; make the seam deterministic.
  • Never commit a snapshot test in record mode (it always passes).
  • Never let a unit test depend on Keychain/disk/network — that's an integration test by definition.

Read the full file on GitHub · 82 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. 6d ago First seen · 82 lines · 64 tokens per session scan A 4a875518357d

Subscribe to this mod's changes

dhpk-swift-test-strategy is a skill published in the GitHub repository hmj1026/dhpk (2 stars, last pushed today), licensed MIT. It adds 64 tokens to every session and 944 once invoked, about $0.0003 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-09-05.