test-data-generation — Claude Code skill: what it does, how to install
Generates realistic, consistent test datasets using factories, fixtures, and fake data libraries. Useful for database seeding and edge-case testing.
npx skills add aj-geddes/useful-ai-prompts --skill test-data-generation -a claude-codeWhat test-data-generation does
The skill provides guidelines and patterns for generating maintainable test data. It covers Factory and Builder patterns, fixtures for integration test setups, and realistic records for local development databases.
The implementation uses fake data utilities like @faker-js/faker and relies on object overrides for flexible test scenarios. It emphasizes deterministic datasets over completely random inputs and bans using production data. Skipping boundary checks such as null or empty strings in your factories will leave common regressions uncovered.
What it helps with
- build reusable entity factories with custom overrides
- generate realistic mock records for local database seeding
- construct deterministic test fixtures for integration suites
- produce edge-case inputs like empty strings and boundary numbers
Example prompts for the agent
- Create a user factory with
@faker-js/fakerthat accepts attribute overrides. - Generate integration test fixtures covering null values and empty string boundaries.
- Implement a builder pattern for a complex order object with nested address records.
How to install test-data-generation
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill test-data-generation -a claude-code2Manually: put the files in place
~/.claude/skills/test-data-generation/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/test-data-generation/
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill test-data-generation -a codex2Manually: put the files in place
.agents/skills/test-data-generation/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill test-data-generation -a cursor2Manually: put the files in place
.cursor/skills/test-data-generation/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install aj-geddes/useful-ai-prompts test-data-generation2Manually: put the files in place
.github/skills/test-data-generation/SKILL.md1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill test-data-generation -a gemini-cli2Platform CLI
gemini skills install https://github.com/aj-geddes/useful-ai-prompts --path skills/test-data-generationManually: put the files in place
.devin/skills/test-data-generation/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill test-data-generation -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about test-data-generation
How to install test-data-generation in Claude Code?
Run npx skills add aj-geddes/useful-ai-prompts --skill test-data-generation -a claude-code. You can also place the file directly at ~/.claude/skills/test-data-generation/SKILL.md.
What does test-data-generation do?
It guides the coding assistant to structure test data using factory and builder patterns rather than hardcoding static mock objects across test files.
Which external libraries does this skill rely on?
The quick start implementation uses @faker-js/faker in JavaScript, so you will need to add it to your project dependencies.
Source text
SKILL.md · MIT
---
name: test-data-generation
description: >
Generate realistic, consistent test data using factories, fixtures, and fake
data libraries. Use for test data, fixtures, mock data, faker, test builders,
and seed data generation.
---
# Test Data Generation
## Table of Contents
- [Overview](#overview)
- [When to Use](#when-to-use)
- [Quick Start](#quick-start)
- [Reference Guides](#reference-guides)
- [Best Practices](#best-practices)
## Overview
Test data generation creates realistic, consistent, and maintainable test data for automated testing. Well-designed test data reduces test brittleness, improves readability, and makes it easier to create diverse test scenarios.
## When to Use
- Creating fixtures for integration tests
- Generating fake data for development databases
- Building test data with complex relationships
- Creating realistic user inputs for testing
- Seeding test databases
- Generating edge cases and boundary values
- Building reusable test data factories
## Quick Start
Minimal working example:
```javascript
// tests/factories/userFactory.js
const { faker } = require("@faker-js/faker");
class UserFactory {
static build(overrides = {}) {
return {
id: faker.string.uuid(),
email: faker.internet.email(),
firstName: faker.person.firstName(),
lastName: faker.person.lastName(),
age: faker.number.int({ min: 18, max: 80 }),
phone: faker.phone.number(),
address: {
street: faker.location.streetAddress(),
city: faker.location.city(),
state: faker.location.state(),
zip: faker.location.zipCode(),
country: "USA",
},
role: "user",
isActive: true,
createdAt: faker.date.past(),
...overrides,
};
}
// ... (see reference guides for full implementation)
```
## Reference Guides
Detailed implementations in the `references/` directory:
| Guide | Contents |
|---|---|
| [Factory Pattern for Test Data](references/factory-pattern-for-test-data.md) | Factory Pattern for Test Data |
| [Builder Pattern for Complex Objects](references/builder-pattern-for-complex-objects.md) | Builder Pattern for Complex Objects |
| [Fixtures for Integration Tests](references/fixtures-for-integration-tests.md) | Fixtures for Integration Tests |
| [Realistic Data Generation](references/realistic-data-generation.md) | Realistic Data Generation |
## Best Practices
### ✅ DO
- Use faker libraries for realistic data
- Create reusable factories for common objects
- Make factories flexible with overrides
- Generate unique values where needed (emails, IDs)
- Use builders for complex object construction
- Create fixtures for integration test setup
- Generate edge cases (empty strings, nulls, boundaries)
- Keep test data deterministic when possible
### ❌ DON'T
- Hardcode test data in multiple places
- Use production data in tests
- Generate truly random data for reproducible tests
- Create overly complex factory hierarchies
- Ignore data relationships and constraints
- Generate massive datasets for simple tests
- Forget to clean up generated data
- Use the same test data for all tests
© aj-geddes · MIT · aj-geddes/useful-ai-prompts