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 maintainability in Apple-platform or Swift server projects.
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o swift-testing-expert.zip https://jpskill.com/download/23283.zip && unzip -o swift-testing-expert.zip && rm swift-testing-expert.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/23283.zip -OutFile "$d\swift-testing-expert.zip"; Expand-Archive "$d\swift-testing-expert.zip" -DestinationPath $d -Force; ri "$d\swift-testing-expert.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
swift-testing-expert.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
swift-testing-expertフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 11
📖 Claude が読む原文 SKILL.md(中身を展開)
この本文は AI(Claude)が読むための原文(英語または中国語)です。日本語訳は順次追加中。
Swift Testing
Overview
Use this skill to write, review, migrate, and debug Swift tests with modern Swift Testing APIs. Prioritize readable tests, robust parallel execution, clear diagnostics, and incremental migration from XCTest where needed.
Agent behavior contract (follow these rules)
- Prefer Swift Testing for Swift unit and integration tests, but keep XCTest for UI automation (
XCUIApplication), performance metrics (XCTMetric), and Objective-C-only test code. - Treat
#expectas the default assertion and use#requirewhen subsequent lines depend on a prerequisite value. - Default to parallel-safe guidance. If tests are not isolated, first propose fixing shared state before applying
.serialized. - Prefer traits for behavior and metadata (
.enabled,.disabled,.timeLimit,.bug, tags) over naming conventions or ad-hoc comments. - Recommend parameterized tests when multiple tests share logic and differ only in input values.
- Use
@availableon test functions for OS-gated behavior instead of runtime#availablechecks inside test bodies; never annotate suite types with@available. - Keep migration advice incremental: convert assertions first, then organize suites, then introduce parameterization/traits.
- Only import
Testingin test targets, never in app/library/binary targets.
First 60 seconds (triage template)
- Clarify the goal: new tests, migration, flaky failures, performance, CI filtering, or async waiting.
- Collect minimal facts:
- Xcode/Swift version and platform targets
- Whether tests currently use XCTest, Swift Testing, or both
- Whether failures are deterministic or flaky
- Whether tests access shared resources (database, files, network, global state)
- Branch quickly:
- repetitive tests -> parameterized tests
- noisy or flaky failures -> known issue handling and test isolation
- migration questions -> XCTest mapping and coexistence strategy
- async callback complexity -> continuation/await patterns
Routing map (read the right reference fast)
- Test building blocks and suite organization ->
references/fundamentals.md #expect,#require, and throw expectations ->references/expectations.md- Traits, tags, and Xcode test-plan filtering ->
references/traits-and-tags.md - Parameterized test design and combinatorics ->
references/parameterized-testing.md - Default parallel execution,
.serialized, isolation strategy ->references/parallelization-and-isolation.md - Test speed, determinism, and flakiness prevention ->
references/performance-and-best-practices.md - Async waiting and callback bridging ->
references/async-testing-and-waiting.md - XCTest coexistence and migration workflow ->
references/migration-from-xctest.md - Test navigator/report workflows and diagnostics ->
references/xcode-workflows.md - Index and quick navigation ->
references/_index.md
Common pitfalls -> next best move
- Repetitive
testFooCaseA/testFooCaseB/...methods -> replace with one parameterized@Test(arguments:). - Failing optional preconditions hidden in later assertions ->
try #require(...)then assert on unwrapped value. - Flaky integration tests on shared database -> isolate dependencies or in-memory repositories; use
.serializedonly as a transition step. - Disabled tests that silently rot -> prefer
withKnownIssuefor temporary known failures to preserve signal. - Unclear failure values for complex types -> conform type to
CustomTestStringConvertiblefor focused test diagnostics. - Test-plan include/exclude by names -> use tags and tag-based filters instead.
Verification checklist
- Confirm each test has a single clear behavior and expressive display name when needed.
- Confirm prerequisites use
#requirewhere failure should stop the test. - Confirm repeated logic is parameterized instead of duplicated.
- Confirm tests are parallel-safe or intentionally serialized with rationale.
- Confirm async code is awaited and callback APIs are bridged safely.
- Confirm migration keeps unsupported XCTest-only scenarios on XCTest.
References
references/_index.mdreferences/fundamentals.mdreferences/expectations.mdreferences/traits-and-tags.mdreferences/parameterized-testing.mdreferences/parallelization-and-isolation.mdreferences/performance-and-best-practices.mdreferences/async-testing-and-waiting.mdreferences/migration-from-xctest.mdreferences/xcode-workflows.md
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (4,908 bytes)
- 📎 references/_index.md (1,004 bytes)
- 📎 references/async-testing-and-waiting.md (3,243 bytes)
- 📎 references/expectations.md (3,486 bytes)
- 📎 references/fundamentals.md (3,830 bytes)
- 📎 references/migration-from-xctest.md (3,425 bytes)
- 📎 references/parallelization-and-isolation.md (2,597 bytes)
- 📎 references/parameterized-testing.md (9,004 bytes)
- 📎 references/performance-and-best-practices.md (4,410 bytes)
- 📎 references/traits-and-tags.md (2,921 bytes)
- 📎 references/xcode-workflows.md (2,280 bytes)