@ioloro/ios-testing
Three-layer productization for iOS/macOS test work in Claude Code: a skill that teaches the model to write correct modern tests, a Swift CLI that runs them, and an optional enforcement hook that blocks the old way.
- Skill — Swift Testing, XCTest, XCUITest, performance/accessibility/animation testing, and Instruments .trace analysis.
- CLI (
iostesting) — drive simulators, devices, and .xctest bundles. Build-tool agnostic.
- Hook — optional Claude Code
PreToolUse hook that blocks xcodebuild test and xcrun simctl boot/install/launch/... and suggests the iostesting equivalent.
What it does
This skill teaches Claude when and how to use each Apple testing framework:
- Swift Testing — default for all new unit and integration tests (
@Test, #expect, @Suite, parameterized tests)
- XCTest — performance benchmarks (
measure {}, XCTClockMetric, XCTCPUMetric, XCTMemoryMetric, XCTStorageMetric), energy/power measurement (XCTOSSignpostMetric)
- XCUITest — UI automation, accessibility audits, animation hitch testing, scroll performance, screenshot capture
- Instruments .trace analysis — export and analyze Time Profiler, System Trace, Allocations, and other trace data without leaving the terminal
The CLI then runs the tests Claude writes. The hook stops Claude from drifting back to raw xcodebuild test.
Examples
Here are things you can ask Claude to do with this installed:
Writing tests
- "Write tests for my UserService class"
- "Add parameterized tests for all the edge cases in this parser"
- "Convert these XCTest tests to Swift Testing"
- "Test that this function throws ValidationError.tooShort for empty input"
Running tests
- "Run the tests on the iPhone 17 Pro simulator"
- "Run just the UserServiceTests in MyAppTests.xctest"
- "Boot the sim, launch the app, take a screenshot in light mode and another in dark mode"
Performance and energy
- "Add a performance test that measures CPU and memory for this sort operation"
- "Set up signpost-based measurement for my image processing pipeline"
- "Add scroll deceleration hitch testing for my collection view"
UI testing
- "Write UI tests for the login flow"
- "Add accessibility audits for contrast and dynamic type on every screen"
- "Set up screenshot capture across light mode, dark mode, and all themes"
Trace file analysis
- "Analyze this .trace file and tell me why the app is slow"
- "Look at the time-sample data and find the hottest call stacks"
- "What's blocking the main thread in this System Trace?"
Why
AI models frequently:
- Default to XCTest when Swift Testing should be used
- Mix
XCTAssertEqual with #expect in the same file
- Use bare
measure {} instead of specific XCTMetric subclasses
- Invent assertion syntax for
#expect(throws:) or confirmation from memory
- Skip parameterized tests in favor of copy-pasted test functions
- Reach for raw
xcodebuild test or xcrun simctl when a dedicated CLI exists
- Forget about performance, power, and animation testing entirely
- Can't analyze .trace files without manual xctrace export/XML parsing
This package fixes all of that across three reinforcing layers.
Install
Skill
npm install -g @ioloro/ios-testing
The skill installs to ~/.claude/plugins/ and activates on test-related requests.
CLI
cd cli
swift build -c release
# Copy or symlink .build/release/iostesting to a directory on PATH
# One-time: merge iostesting's permission allowlist into ~/.claude/settings.json
# so Claude Code stops prompting for `xcrun simctl spawn`, `swift build`, etc.
iostesting setup
Requires Xcode 14+ and Swift 6 (tested on Swift 6.3 / Xcode 26.4).
iostesting setup is idempotent. It preserves unknown keys + the order of any pre-existing permissions.allow entries, and only appends the curated iostesting list (no MCP entries, no machine-specific paths). Run with --dry-run to preview the diff.
Hook (optional)
Add to ~/.claude/settings.json:
{
"hooks": {
"PreToolUse": [
{ "hooks": [{ "command": "/absolute/path/to/ios-testing/hooks/iostesting-guard.sh", "type": "command" }], "matcher": "Bash" }
]
}
}
Then restart Claude Code. See hooks/README.md for details.
What's included
Skill (skills/ios-testing/)