Generate realistic test data for comprehensive testing
Generate realistic test data including users, products, orders, and custom schemas for comprehensive testing. Use for database seeding, unit tests, and development fixtures with support for JSON Schema, TypeScript, and popular factory patterns.
/plugin marketplace add jeremylongshore/claude-code-plugins-plus/plugin install test-data-generator@claude-code-plugins-plusGenerate realistic test data including users, products, orders, and custom schemas for comprehensive testing.
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());
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()
};
}
// 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
`);
}
Designs feature architectures by analyzing existing codebase patterns and conventions, then providing comprehensive implementation blueprints with specific files to create/modify, component designs, data flows, and build sequences