test-data-generation — скилл для Claude Code
Скилл помогает генерировать реалистичные тестовые данные через фабрики, фикстуры и библиотеки вроде @faker-js/faker. Пригодится для сидинга баз и интеграционных тестов.
npx skills add aj-geddes/useful-ai-prompts --skill test-data-generation -a claude-codeЧто делает test-data-generation
Скилл даёт шаблоны и правила для генерации тестовых наборов данных. Он описывает реализацию паттернов Factory и Builder, подготовку фикстур для интеграционных тестов и наполнение локальных баз правдоподобными записями.
В коде предлагается использовать библиотеки генерации фейковых данных (в примере показан @faker-js/faker) и поддерживать переопределение полей через overrides. Руководство требует делать данные воспроизводимыми и избегать боевых выгрузок в тестах. Фабрики без поддержки граничных значений быстро приведут к пропуску багов на пустых строках и null.
Какие задачи решает
- создать фабрики тестовых сущностей с поддержкой
overrides - наполнить базу разработки фейковыми записями через
@faker-js/faker - подготовить детерминированные фикстуры для интеграционных тестов
- сгенерировать граничные значения и краевые кейсы вроде
null
Примеры запросов агенту
- Сделай фабрику для модели заказа с использованием
@faker-js/fakerи возможностью передаватьoverrides. - Подготовь фикстуры пользователей для интеграционных тестов с генерацией граничных значений.
- Спроектируй Builder для сложного объекта профиля с вложенным адресом.
Как установить test-data-generation
1Через Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill test-data-generation -a claude-code2Вручную: положить файлы
~/.claude/skills/test-data-generation/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/test-data-generation/
1Через Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill test-data-generation -a codex2Вручную: положить файлы
.agents/skills/test-data-generation/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill test-data-generation -a cursor2Вручную: положить файлы
.cursor/skills/test-data-generation/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install aj-geddes/useful-ai-prompts test-data-generation2Вручную: положить файлы
.github/skills/test-data-generation/SKILL.md1Через Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill test-data-generation -a gemini-cli2Командой платформы
gemini skills install https://github.com/aj-geddes/useful-ai-prompts --path skills/test-data-generationВручную: положить файлы
.devin/skills/test-data-generation/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill test-data-generation -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о test-data-generation
Как установить test-data-generation в Claude Code?
Выполните команду npx skills add aj-geddes/useful-ai-prompts --skill test-data-generation -a claude-code. Также файл скилла можно сохранить напрямую в ~/.claude/skills/test-data-generation/SKILL.md.
Что делает скилл test-data-generation?
Он обучает ИИ-агента создавать тестовые данные через фабрики и строители, генерировать фикстуры и подбирать краевые значения вместо ручного хардкода.
Какие библиотеки требуются для работы примеров?
В базовом примере используется библиотека @faker-js/faker для JavaScript, поэтому её нужно установить в проект через npm.
Исходный текст
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