test-data-factory
Generate test fixture factories for your models. Builder pattern and static factories for zero-boilerplate test data. Use when tests need sample data setup.
npx skills add rshankras/claude-code-apple-skills --skill test-data-factory --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 Data Factory Generate factory helpers that make creating test data effortless. Eliminates boilerplate in test setup so writing tests has zero friction. ## When This Skill Activates Use this skill when the user: - Has repetitive test setup code - Asks for "test fixtures" or "test factories" or "sample data" - Wants to reduce boilerplate in tests - Says "my tests have too much setup" - Is building a test suite and needs realistic sample data - Mentions "builder pattern" for tests ## Why Test Factories ```swift // ❌ Without factory — every test repeats this let item = Item( id: UUID(), title: "Test Item", description: "A test description", category: .general, createdAt: Date(), updatedAt: Date(), isFavorite: false, tags: [], author: User(id: UUID(), name: "Test User", email: "test@test.com") ) // ✅ With factory — one line, override only what matters let item = Item.fixture() let favoriteItem = Item.fixture(isFavorite: true) let taggedItem = Item.fixture(tags: ["swift", "testing"]) ``` ## Process ### Phase 1: Discover Models ``` Glob: **/*.swift (in source targets) Grep: "struct.*:.*Identifiable|class.*:.*Identifiable|@Model" Grep: "struct.*:.*Codable|struct.*:.*Sendable" ``` Id
- When This Skill Activates
- Why Test Factories
- Process
- Phase 1: Discover Models
- Phase 2: Choose Factory Pattern
- Phase 3: Generate Factories
- Phase 4: Generate Date/Time Helpers
- Phase 5: Generate Mock Response Factories
- Factory Design Rules
- Defaults Should Be
- Naming Conventions
- Output Format
- References
What does the test-data-factory skill do?
Generate test fixture factories for your models. Builder pattern and static factories for zero-boilerplate test data. Use when tests need sample data setup.
How do I install it?
Run `npx skills add rshankras/claude-code-apple-skills --skill test-data-factory --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.
