/app:swift-testingfrom app
Author, modernise, and diagnose Swift Testing suites, including migrating XCTest tests and troubleshooting xcodebuild test targets.
Ships in app. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Author, modernise, and diagnose Swift Testing suites (import Testing), and migrate eligible XCTestCase suites cleanly.
Testing to unlock macros; tests are plain functions annotated with @Test.test prefix: keep simple names lowerCamelCase (@Test func ignition()) and use raw identifiers in sentence case for multi-word behavioural descriptions (@Test func `Engine does not stall`()), or @Test("Display Name") for a custom navigator title.#expect is the primary assertion; pass it a boolean expression.async / throws when needed.principle-sequence-verifiable-units).XCUIApplication) and no performance-measurement replacement for XCTest's measure { ... } baseline API. Keep measure { ... } performance tests on XCTest (other methods in the same XCTestCase can still migrate) and keep XCUIApplication UI test targets on XCTest (app:xcuitest). (Only when a user explicitly asks to migrate an XCUIAutomation bundle on Xcode 27+, read references/xcuiautomation-migration.md.)#_sourceLocation; use the full SourceLocation(fileID:filePath:line:column:) initialiser (leave pre-existing #_sourceLocation usages untouched during modernisation).#expect(throws:) replaces XCTAssertThrowsError; #expect(throws: Never.self) (or try #require(throws: Never.self) when halting on failure) replaces XCTAssertNoThrow.Equatable and the expected error case is known, always pin the specific error value (for example #expect(throws: FormatError.negativeAmount)) rather than the broader error type (FormatError.self) or (any Error).self.MyError.self) only when any case of that type is valid. Both #expect(throws:) (returns Error?) and try #require(throws:) (returns unwrapped Error, Xcode 16.3+) return the thrown error when you must assert on its properties. Never use the deprecated throws: matcher-closure overload.@Test func `Rejects negative amount`() throws {
#expect(throws: FormatError.negativeAmount) {
try formatter.validate(-1)
}
#expect(throws: Never.self) {
try formatter.prepare()
}
let error = try #require(throws: MyError.self) {
try throwingFunction()
}
#expect(error.code == 42)
}
#require, #expect, and Issue.recordtry #require(...) halts the test immediately on false or nil; use it to unwrap optionals instead of force-unwrapping (!), and whenever subsequent lines cannot run meaningfully after failure.guard ... else { Issue.record(...); return } into try #require(...) and if !condition { Issue.record(...) } into #expect(condition) where not disruptive; drop redundant messages when the expression is self-explanatory.Issue.record("message") only when recording a non-fatal failure explicitly (add return when execution cannot continue).XCTestCase to Swift TestingSurvey candidate files in one pass before editing; settle naming and struct vs final class choices up front, then migrate one XCTestCase class at a time.
Foundation is not re-exported: XCTest re-exports Foundation, but Testing does not. When removing import XCTest, add import Foundation whenever the file uses URL, Data, Date, Locale, CharacterSet, ProcessInfo, or other Foundation types.continueAfterFailure = false: When set inside a test method, convert every subsequent assertion in that method to try #require(...) and mark the test throws. When set in setUp() / setUpWithError(), it applies to all assertions in every test method of that class (plus setup/teardown): convert all of them to try #require(...). Never downgrade an existing try #require to #expect.setUp, and tearDown:
struct for suites. Swift Testing creates a fresh instance before each test, so replace setUp() / setUpWithError() stored properties with inline initialisers or init() (which may be async and throws; throwing in init fails the test). Mark methods mutating struct properties mutating.tearDown() cleanup is required, use final class or actor with deinit (not a struct).@MainActor sequentially within a class; Swift Testing runs tests concurrently on the Swift Concurrency cooperative pool. Add @MainActor only where a test explicitly relied on main-actor isolation — never defensively. Add @Suite(.serialized) only when mutable state genuinely cannot be isolated.XCTAssertEqual(_:_:accuracy:) overload (note this explicitly when migrating accuracy assertions). Compare with an explicit floating-point tolerance (abs(actual - expected) <= tolerance), or isApproximatelyEqual if swift-numerics is already a dependency.| XCTest | Swift Testing | Notes |
|---|---|---|
XCTAssertThrowsError | #expect(throws:) / try #require(throws:) | Pin exact Equatable case when known |
XCTAssertNoThrow | #expect(throws: Never.self) / try #require(throws: Never.self) | Preserves failure-halting with #require |
XCTestExpectation + fulfill() + await fulfillment(of:) | await confirmation("...") { confirm in ... } | For assertForOverFulfill = false with expectedFulfillmentCount = N, pass expectedCount: N... |
try XCTSkipIf(cond) | @Test(.disabled(if: cond)) | Use @available(...) on the test function for OS/platform checks instead of .enabled(if:) |
try XCTSkipUnless(cond) | @Test(.enabled(if: cond)) | — |
Mid-test throw XCTSkip("reason") | try Test.cancel("reason") | Stops the running test as cancelled |
XCTExpectFailure("...") { ... } | withKnownIssue("...") { ... } | .nonStrict() / strict: false → isIntermittent: true; conditional/matching → when: / matching: |
XCTAttachment + self.add(...) | Attachment.record(value) | Attachable is automatic for Codable and NSSecureCoding with import Foundation |
@Test(arguments:) with immutable, Sendable arguments. Give every parameterised case struct a distinct name/identifier and CustomTestStringConvertible (var testDescription: String) so each failing case is independently identifiable.principle-separate-before-serializing-shared-state).static properties, singletons, or global state between tests; never reach a mutable fixture through one.@MainActor and .serialized remain only where required, and promote unnecessary Issue.record guards into #expect/try #require.principle-scale-verification).xcodebuildapp:xcode-dev-loop owns running xcodebuild and interpreting results; keep these rules whenever you diagnose a Swift Testing run:
Executed 0 tests, with 0 failures is the empty XCTest summary; it proves nothing about Swift Testing tests.-resultBundlePath <bundle> and read the verdict with xcrun xcresulttool get test-results summary --path <bundle>: a pass requires the expected non-zero test count, no failure or crash, and a zero exit status (principle-prove-it-works).principle-gaps-are-not-passes). Check the selection first: confirm -only-testing matches any renamed suite/test and that the target is in the test plan.test-without-building fails to load the test bundle, no test ran and disabling a test (.disabled()) cannot make a bundle that never loads succeed. Rerun with xcodebuild test and a fresh result bundle so the build graph runs first; a load error names the missing library, not the root cause.xcrun simctl shutdown <udid>), then retry once with a fresh result-bundle path (principle-clean-up-what-you-started).What SKILL.md sets; muted values are Claude Code's defaults
19 skills in this plugin
/app-intent-driven-developmentWHEN designing or debugging App Intent-first iOS features for Siri, Shortcuts, widgets, Live Activities, or reuse of an existing intent in SwiftUI; NOT for actions with no system surface; provides AppEntity, metadata, prompting, and view-reuse patterns./app-intents-whats-new-27New App Intents APIs, behaviors, and deprecations in iOS 26 and iOS 27 (and aligned OS releases). Use when adopting, migrating to, or asked about: supportedModes / IntentModes and the deprecated openAppWhenRun; continueInForeground; UndoableIntent; requestChoice; CancellableIntent; LongRunningIntent / performBackgroundTask; IntentExecutionTargets; SnippetIntent interactive snippets; Visual Intelligence with IntentValueQuery / SemanticContentDescriptor / @UnionValue; onscreen appEntityIdentifier; Spotlight with @ComputedProperty / @DeferredProperty(indexingKey:), IndexedEntityQuery, relatedAppEntityIdentifier; RelevantEntities; SyncableEntity / EntityOwnership; SystemShortcut / RunSystemShortcutIntent; EntityCollection; AppUnionValue; @AppIntent(schema:) schemas (replacing deprecated @AssistantIntent); AppIntentsTesting; or what's new in App Intents. For evergreen best practices, use the app-intents-specialist skill instead.npx claudepluginhub mintuz/skills --plugin appOther plugins' skills for the same job