Initial commit
This commit is contained in:
15
.claude-plugin/plugin.json
Normal file
15
.claude-plugin/plugin.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "test-data-generator",
|
||||
"description": "Generate realistic test data including users, products, orders, and custom schemas for comprehensive testing",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "Claude Code Plugins",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
"skills": [
|
||||
"./skills"
|
||||
],
|
||||
"agents": [
|
||||
"./agents"
|
||||
]
|
||||
}
|
||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# test-data-generator
|
||||
|
||||
Generate realistic test data including users, products, orders, and custom schemas for comprehensive testing
|
||||
164
agents/data-generator.md
Normal file
164
agents/data-generator.md
Normal file
@@ -0,0 +1,164 @@
|
||||
---
|
||||
description: Generate realistic test data for comprehensive testing
|
||||
capabilities: ["test-data", "fake-data", "fixtures", "factories", "seed-data"]
|
||||
---
|
||||
|
||||
# Test Data Generator Agent
|
||||
|
||||
Generate realistic test data including users, products, orders, and custom schemas for comprehensive testing.
|
||||
|
||||
## Data Types
|
||||
|
||||
### User Data
|
||||
- Names (realistic, locale-aware)
|
||||
- Email addresses
|
||||
- Passwords (hashed if needed)
|
||||
- Addresses
|
||||
- Phone numbers
|
||||
- Avatars
|
||||
- Birth dates
|
||||
- Profile info
|
||||
|
||||
### Business Data
|
||||
- Products (name, description, price, SKU)
|
||||
- Orders (items, totals, status)
|
||||
- Invoices
|
||||
- Transactions
|
||||
- Companies
|
||||
- Categories
|
||||
|
||||
### Technical Data
|
||||
- UUIDs
|
||||
- Timestamps
|
||||
- IP addresses
|
||||
- URLs
|
||||
- User agents
|
||||
- API keys
|
||||
- Tokens
|
||||
|
||||
### Custom Schemas
|
||||
- JSON Schema support
|
||||
- Database schema import
|
||||
- TypeScript types
|
||||
- GraphQL schemas
|
||||
|
||||
## Libraries Used
|
||||
|
||||
- **Faker.js / @faker-js/faker** - Comprehensive fake data
|
||||
- **Chance.js** - Random generator helper
|
||||
- **json-schema-faker** - Generate from JSON Schema
|
||||
- **Factory Bot** - Ruby factory patterns
|
||||
- **Factory Boy** - Python factory patterns
|
||||
|
||||
## Example: User Factory
|
||||
|
||||
```javascript
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
function createUser(overrides = {}) {
|
||||
return {
|
||||
id: faker.string.uuid(),
|
||||
email: faker.internet.email(),
|
||||
name: faker.person.fullName(),
|
||||
age: faker.number.int({ min: 18, max: 80 }),
|
||||
address: {
|
||||
street: faker.location.streetAddress(),
|
||||
city: faker.location.city(),
|
||||
country: faker.location.country(),
|
||||
zipCode: faker.location.zipCode()
|
||||
},
|
||||
createdAt: faker.date.past(),
|
||||
...overrides
|
||||
};
|
||||
}
|
||||
|
||||
// Generate single user
|
||||
const user = createUser({ age: 25 });
|
||||
|
||||
// Generate multiple users
|
||||
const users = Array.from({ length: 100 }, () => createUser());
|
||||
```
|
||||
|
||||
## Example: E-commerce Data
|
||||
|
||||
```javascript
|
||||
function createProduct() {
|
||||
return {
|
||||
id: faker.string.uuid(),
|
||||
name: faker.commerce.productName(),
|
||||
description: faker.commerce.productDescription(),
|
||||
price: parseFloat(faker.commerce.price()),
|
||||
category: faker.commerce.department(),
|
||||
inStock: faker.datatype.boolean(),
|
||||
sku: faker.string.alphanumeric(8).toUpperCase(),
|
||||
images: Array.from({ length: 3 }, () => faker.image.url())
|
||||
};
|
||||
}
|
||||
|
||||
function createOrder(userId) {
|
||||
const items = Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 5 }) },
|
||||
() => ({
|
||||
productId: faker.string.uuid(),
|
||||
quantity: faker.number.int({ min: 1, max: 3 }),
|
||||
price: parseFloat(faker.commerce.price())
|
||||
})
|
||||
);
|
||||
|
||||
const subtotal = items.reduce((sum, item) =>
|
||||
sum + (item.price * item.quantity), 0
|
||||
);
|
||||
|
||||
return {
|
||||
id: faker.string.uuid(),
|
||||
userId,
|
||||
items,
|
||||
subtotal,
|
||||
tax: subtotal * 0.08,
|
||||
total: subtotal * 1.08,
|
||||
status: faker.helpers.arrayElement([
|
||||
'pending', 'processing', 'shipped', 'delivered'
|
||||
]),
|
||||
createdAt: faker.date.recent()
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Database Seeding
|
||||
|
||||
```javascript
|
||||
// Seed script
|
||||
async function seedDatabase() {
|
||||
// Generate users
|
||||
const users = Array.from({ length: 100 }, () => createUser());
|
||||
await db.users.insertMany(users);
|
||||
|
||||
// Generate products
|
||||
const products = Array.from({ length: 500 }, () => createProduct());
|
||||
await db.products.insertMany(products);
|
||||
|
||||
// Generate orders (2-5 per user)
|
||||
const orders = users.flatMap(user =>
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 2, max: 5 }) },
|
||||
() => createOrder(user.id)
|
||||
)
|
||||
);
|
||||
await db.orders.insertMany(orders);
|
||||
|
||||
console.log(`Seeded:
|
||||
- ${users.length} users
|
||||
- ${products.length} products
|
||||
- ${orders.length} orders
|
||||
`);
|
||||
}
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Use seed for development consistency
|
||||
- Generate fresh data for each test
|
||||
- Use realistic data patterns
|
||||
- Locale-aware generation
|
||||
- Deterministic with seeds for reproducibility
|
||||
- Clean up after tests
|
||||
61
plugin.lock.json
Normal file
61
plugin.lock.json
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"$schema": "internal://schemas/plugin.lock.v1.json",
|
||||
"pluginId": "gh:jeremylongshore/claude-code-plugins-plus:plugins/testing/test-data-generator",
|
||||
"normalized": {
|
||||
"repo": null,
|
||||
"ref": "refs/tags/v20251128.0",
|
||||
"commit": "f604b5a25111754b620b3c3bd4705e1c1a5babf4",
|
||||
"treeHash": "a24e6c4faa260324459900a4f4c05776790294897061cbbc484c2c5bfec95e16",
|
||||
"generatedAt": "2025-11-28T10:18:48.997000Z",
|
||||
"toolVersion": "publish_plugins.py@0.2.0"
|
||||
},
|
||||
"origin": {
|
||||
"remote": "git@github.com:zhongweili/42plugin-data.git",
|
||||
"branch": "master",
|
||||
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
|
||||
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
|
||||
},
|
||||
"manifest": {
|
||||
"name": "test-data-generator",
|
||||
"description": "Generate realistic test data including users, products, orders, and custom schemas for comprehensive testing",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"content": {
|
||||
"files": [
|
||||
{
|
||||
"path": "README.md",
|
||||
"sha256": "c901447b741b0ed5507f50dc217c6cecc0385b1d579e908c967cd1bc4b8f54f2"
|
||||
},
|
||||
{
|
||||
"path": "agents/data-generator.md",
|
||||
"sha256": "3fc0388ca1ee15c1b76c15a6c4a1258f15a58755b7d74c125591b28f2c3edd2a"
|
||||
},
|
||||
{
|
||||
"path": ".claude-plugin/plugin.json",
|
||||
"sha256": "708a63a34afcb0263f3b8871044a2445967ad526f90ba4607631e098abde439f"
|
||||
},
|
||||
{
|
||||
"path": "skills/test-data-generator/SKILL.md",
|
||||
"sha256": "8d8711b9fedb331de0ddb0837cd55c058320e6529304b77e2efb1c6bad19db9a"
|
||||
},
|
||||
{
|
||||
"path": "skills/test-data-generator/references/README.md",
|
||||
"sha256": "d3b989483a03aa5500c088027f12b8cf37410b19b0ec96baa9a23577117456e9"
|
||||
},
|
||||
{
|
||||
"path": "skills/test-data-generator/scripts/README.md",
|
||||
"sha256": "7932cae765584b93a0bb4f2aa9790fddda2dc1a844acca62bc5805fe285f59d3"
|
||||
},
|
||||
{
|
||||
"path": "skills/test-data-generator/assets/README.md",
|
||||
"sha256": "10f070917f907496d6f7e185df112c7fc3e2f72dbe9a8c160c0a8f58f01d452b"
|
||||
}
|
||||
],
|
||||
"dirSha256": "a24e6c4faa260324459900a4f4c05776790294897061cbbc484c2c5bfec95e16"
|
||||
},
|
||||
"security": {
|
||||
"scannedAt": null,
|
||||
"scannerVersion": null,
|
||||
"flags": []
|
||||
}
|
||||
}
|
||||
56
skills/test-data-generator/SKILL.md
Normal file
56
skills/test-data-generator/SKILL.md
Normal file
@@ -0,0 +1,56 @@
|
||||
---
|
||||
name: generating-test-data
|
||||
description: |
|
||||
This skill enables Claude to generate realistic test data for software development. It uses the test-data-generator plugin to create users, products, orders, and custom schemas for comprehensive testing. Use this skill when you need to populate databases, simulate user behavior, or create fixtures for automated tests. Trigger phrases include "generate test data", "create fake users", "populate database", "generate product data", "create test orders", or "generate data based on schema". This skill is especially useful for populating testing environments or creating sample data for demonstrations.
|
||||
allowed-tools: Read, Write, Edit, Grep, Glob, Bash
|
||||
version: 1.0.0
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
This skill empowers Claude to generate realistic and diverse test data, streamlining software testing and development workflows. It leverages the test-data-generator plugin to produce data sets tailored to your specific needs, from user profiles to complex business transactions.
|
||||
|
||||
## How It Works
|
||||
|
||||
1. **Identify Data Requirements**: Claude analyzes your request to determine the type and volume of test data required (e.g., users, products, orders, custom schemas).
|
||||
2. **Generate Data**: Claude uses the test-data-generator plugin to create realistic test data based on your specifications.
|
||||
3. **Present Data**: Claude presents the generated data in a suitable format, such as JSON or a data file, ready for use in your testing environment.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
This skill activates when you need to:
|
||||
- Generate a large number of realistic user profiles for testing authentication and authorization.
|
||||
- Create a dataset of products with varying attributes for testing e-commerce functionality.
|
||||
- Simulate order placements and transactions for performance testing and load testing.
|
||||
- Populate a database with realistic data for demonstration or training purposes.
|
||||
- Generate data that adheres to a specific schema or data model.
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Generating User Data
|
||||
|
||||
User request: "Generate 500 test users with realistic names, emails, and addresses."
|
||||
|
||||
The skill will:
|
||||
1. Invoke the test-data-generator plugin to create 500 user records.
|
||||
2. Populate each record with realistic names, email addresses, and physical addresses.
|
||||
3. Provide the generated data in JSON format.
|
||||
|
||||
### Example 2: Creating Product Data
|
||||
|
||||
User request: "Create product test data including name, description, price, and category for 100 different products."
|
||||
|
||||
The skill will:
|
||||
1. Utilize the test-data-generator plugin to generate 100 product records.
|
||||
2. Populate each product with relevant details like name, description, price, and category.
|
||||
3. Deliver the data in a structured format suitable for database insertion.
|
||||
|
||||
## Best Practices
|
||||
|
||||
- **Schema Definition**: Provide a clear schema or data model when generating custom data to ensure accuracy and consistency.
|
||||
- **Locale Considerations**: Specify the desired locale when generating data that is sensitive to regional variations (e.g., names, addresses, phone numbers).
|
||||
- **Seed Values**: Use seed values for reproducible test data generation, ensuring consistency across multiple runs.
|
||||
|
||||
## Integration
|
||||
|
||||
This skill can be integrated with other plugins, such as database management tools, to directly populate databases with the generated test data. It can also be used in conjunction with API testing tools to generate realistic request payloads.
|
||||
7
skills/test-data-generator/assets/README.md
Normal file
7
skills/test-data-generator/assets/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Assets
|
||||
|
||||
Bundled resources for test-data-generator skill
|
||||
|
||||
- [ ] example_schemas/: A directory containing example JSON schemas for different data types.
|
||||
- [ ] example_data/: A directory containing example generated data for different data types.
|
||||
- [ ] configuration_templates/: Templates for configuring the data generation process (e.g., number of records, data types).
|
||||
7
skills/test-data-generator/references/README.md
Normal file
7
skills/test-data-generator/references/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# References
|
||||
|
||||
Bundled resources for test-data-generator skill
|
||||
|
||||
- [ ] data_schemas.md: Documentation of common data schemas used for generating test data (e.g., user schema, product schema).
|
||||
- [ ] faker_providers.md: Documentation of custom Faker providers used for generating realistic data.
|
||||
- [ ] test_data_best_practices.md: Best practices for generating effective test data.
|
||||
7
skills/test-data-generator/scripts/README.md
Normal file
7
skills/test-data-generator/scripts/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Scripts
|
||||
|
||||
Bundled resources for test-data-generator skill
|
||||
|
||||
- [ ] generate_data.py: A script to generate test data based on provided schema or pre-defined types (users, products, orders).
|
||||
- [ ] validate_data.py: A script to validate generated data against a schema or set of rules.
|
||||
- [ ] seed_database.py: A script to seed a database with the generated test data.
|
||||
Reference in New Issue
Block a user