test-generator
Generate test templates for unit tests, integration tests, and UI tests using Swift Testing and XCTest. Use when adding tests to iOS/macOS apps.
npx skills add rshankras/claude-code-apple-skills --skill test-generator --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Test Generator Generate test templates for unit tests, integration tests, and UI tests in iOS/macOS apps. ## When This Skill Activates Use this skill when the user: - Asks to "add tests" or "write tests" for their app - Asks about unit testing, UI testing, or XCTest - Wants to test ViewModels, services, or repositories - Mentions TDD or test-driven development - Asks about Swift Testing framework (`@Test`, `#expect`, `@Suite`) - Wants mock objects or test helpers - Asks about snapshot testing or preview tests ## Decision Tree ``` What tests do you need? | +-- Unit tests for business logic | +-- Swift Testing (@Test, #expect) -- recommended for iOS 16+ | +-- XCTest -- for iOS 13-15 support or existing XCTest projects | +-- Integration tests (component interactions) | +-- Protocol-based mocks with dependency injection | +-- UI tests | +-- XCUITest with Screen Object pattern | +-- Snapshot/preview tests +-- PreviewSnapshots or swift-snapshot-testing ``` ## Pre-Generation Checks ### 1. Project Context Detection - [ ] Identify existing test targets and test runner - [ ] Detect testing framework already in use (Swift Testing vs XCTest) - [ ] Verify deployment target (Swift Testing requ
- When This Skill Activates
- Decision Tree
- Pre-Generation Checks
- 1. Project Context Detection
- 2. Conflict Detection
- 3. Architecture Detection
- Configuration Questions
- 1. Testing Framework
- 2. Test Types to Generate
- 3. Architecture Pattern
- Generated Files
- Unit Tests
- UI Tests
- Swift Testing (Modern)
Command line xcodebuild test -scheme YourApp -destination 'platform=iOS Simulator,name=iPhone 16' With coverage xcodebuild test -scheme YourApp -enableCodeCoverage YES
What does the test-generator skill do?
Generate test templates for unit tests, integration tests, and UI tests using Swift Testing and XCTest. Use when adding tests to iOS/macOS apps.
How do I install it?
Run `npx skills add rshankras/claude-code-apple-skills --skill test-generator --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From rshankras/claude-code-apple-skills, a repository with 589 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
