@intentsolutionsio/test-data-generator 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "test-data-generator",
3
+ "version": "1.0.0",
4
+ "description": "Generate realistic test data including users, products, orders, and custom schemas for comprehensive testing",
5
+ "author": {
6
+ "name": "Claude Code Plugins",
7
+ "email": "[email protected]"
8
+ },
9
+ "repository": "https://github.com/jeremylongshore/claude-code-plugins",
10
+ "license": "MIT",
11
+ "keywords": [
12
+ "testing",
13
+ "test-data",
14
+ "fake-data",
15
+ "fixtures",
16
+ "factory",
17
+ "agent-skills"
18
+ ]
19
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Claude Code Plugins
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Test Data Generator Plugin
2
+
3
+ Generate realistic test data including users, products, orders, and custom schemas for comprehensive testing.
4
+
5
+ ## Features
6
+
7
+ - **Realistic data** - Names, emails, addresses, phone numbers
8
+ - **Business data** - Products, orders, invoices, transactions
9
+ - **Technical data** - UUIDs, IPs, URLs, tokens
10
+ - **Custom schemas** - JSON Schema, TypeScript, GraphQL
11
+ - **Bulk generation** - Create thousands of records
12
+ - **Locale support** - Data for different regions
13
+ - **Deterministic** - Reproducible with seeds
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ /plugin install test-data-generator@claude-code-plugins-plus
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```
24
+ Generate 100 test users with addresses
25
+ Create e-commerce test data (products, orders, customers)
26
+ Generate API test data matching our OpenAPI schema
27
+ ```
28
+
29
+ ## Data Types
30
+
31
+ - **Users** - Names, emails, passwords, addresses, profiles
32
+ - **Products** - Names, descriptions, prices, categories
33
+ - **Orders** - Items, totals, status, shipping
34
+ - **Companies** - Names, addresses, domains, employees
35
+ - **Custom** - Your schema, your data
36
+
37
+ ## License
38
+
39
+ MIT
@@ -0,0 +1,163 @@
1
+ ---
2
+ name: data-generator
3
+ description: Generate realistic test data for comprehensive testing
4
+ ---
5
+ # Test Data Generator Agent
6
+
7
+ Generate realistic test data including users, products, orders, and custom schemas for comprehensive testing.
8
+
9
+ ## Data Types
10
+
11
+ ### User Data
12
+ - Names (realistic, locale-aware)
13
+ - Email addresses
14
+ - Passwords (hashed if needed)
15
+ - Addresses
16
+ - Phone numbers
17
+ - Avatars
18
+ - Birth dates
19
+ - Profile info
20
+
21
+ ### Business Data
22
+ - Products (name, description, price, SKU)
23
+ - Orders (items, totals, status)
24
+ - Invoices
25
+ - Transactions
26
+ - Companies
27
+ - Categories
28
+
29
+ ### Technical Data
30
+ - UUIDs
31
+ - Timestamps
32
+ - IP addresses
33
+ - URLs
34
+ - User agents
35
+ - API keys
36
+ - Tokens
37
+
38
+ ### Custom Schemas
39
+ - JSON Schema support
40
+ - Database schema import
41
+ - TypeScript types
42
+ - GraphQL schemas
43
+
44
+ ## Libraries Used
45
+
46
+ - **Faker.js / @faker-js/faker** - Comprehensive fake data
47
+ - **Chance.js** - Random generator helper
48
+ - **json-schema-faker** - Generate from JSON Schema
49
+ - **Factory Bot** - Ruby factory patterns
50
+ - **Factory Boy** - Python factory patterns
51
+
52
+ ## Example: User Factory
53
+
54
+ ```javascript
55
+ import { faker } from '@faker-js/faker';
56
+
57
+ function createUser(overrides = {}) {
58
+ return {
59
+ id: faker.string.uuid(),
60
+ email: faker.internet.email(),
61
+ name: faker.person.fullName(),
62
+ age: faker.number.int({ min: 18, max: 80 }),
63
+ address: {
64
+ street: faker.location.streetAddress(),
65
+ city: faker.location.city(),
66
+ country: faker.location.country(),
67
+ zipCode: faker.location.zipCode()
68
+ },
69
+ createdAt: faker.date.past(),
70
+ ...overrides
71
+ };
72
+ }
73
+
74
+ // Generate single user
75
+ const user = createUser({ age: 25 });
76
+
77
+ // Generate multiple users
78
+ const users = Array.from({ length: 100 }, () => createUser());
79
+ ```
80
+
81
+ ## Example: E-commerce Data
82
+
83
+ ```javascript
84
+ function createProduct() {
85
+ return {
86
+ id: faker.string.uuid(),
87
+ name: faker.commerce.productName(),
88
+ description: faker.commerce.productDescription(),
89
+ price: parseFloat(faker.commerce.price()),
90
+ category: faker.commerce.department(),
91
+ inStock: faker.datatype.boolean(),
92
+ sku: faker.string.alphanumeric(8).toUpperCase(),
93
+ images: Array.from({ length: 3 }, () => faker.image.url())
94
+ };
95
+ }
96
+
97
+ function createOrder(userId) {
98
+ const items = Array.from(
99
+ { length: faker.number.int({ min: 1, max: 5 }) },
100
+ () => ({
101
+ productId: faker.string.uuid(),
102
+ quantity: faker.number.int({ min: 1, max: 3 }),
103
+ price: parseFloat(faker.commerce.price())
104
+ })
105
+ );
106
+
107
+ const subtotal = items.reduce((sum, item) =>
108
+ sum + (item.price * item.quantity), 0
109
+ );
110
+
111
+ return {
112
+ id: faker.string.uuid(),
113
+ userId,
114
+ items,
115
+ subtotal,
116
+ tax: subtotal * 0.08,
117
+ total: subtotal * 1.08,
118
+ status: faker.helpers.arrayElement([
119
+ 'pending', 'processing', 'shipped', 'delivered'
120
+ ]),
121
+ createdAt: faker.date.recent()
122
+ };
123
+ }
124
+ ```
125
+
126
+ ## Database Seeding
127
+
128
+ ```javascript
129
+ // Seed script
130
+ async function seedDatabase() {
131
+ // Generate users
132
+ const users = Array.from({ length: 100 }, () => createUser());
133
+ await db.users.insertMany(users);
134
+
135
+ // Generate products
136
+ const products = Array.from({ length: 500 }, () => createProduct());
137
+ await db.products.insertMany(products);
138
+
139
+ // Generate orders (2-5 per user)
140
+ const orders = users.flatMap(user =>
141
+ Array.from(
142
+ { length: faker.number.int({ min: 2, max: 5 }) },
143
+ () => createOrder(user.id)
144
+ )
145
+ );
146
+ await db.orders.insertMany(orders);
147
+
148
+ console.log(`Seeded:
149
+ - ${users.length} users
150
+ - ${products.length} products
151
+ - ${orders.length} orders
152
+ `);
153
+ }
154
+ ```
155
+
156
+ ## Best Practices
157
+
158
+ - Use seed for development consistency
159
+ - Generate fresh data for each test
160
+ - Use realistic data patterns
161
+ - Locale-aware generation
162
+ - Deterministic with seeds for reproducibility
163
+ - Clean up after tests
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@intentsolutionsio/test-data-generator",
3
+ "version": "1.0.0",
4
+ "description": "Generate realistic test data including users, products, orders, and custom schemas for comprehensive testing",
5
+ "keywords": [
6
+ "testing",
7
+ "test-data",
8
+ "fake-data",
9
+ "fixtures",
10
+ "factory",
11
+ "agent-skills",
12
+ "claude-code",
13
+ "claude-plugin",
14
+ "tonsofskills"
15
+ ],
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/jeremylongshore/claude-code-plugins-plus-skills.git",
19
+ "directory": "plugins/testing/test-data-generator"
20
+ },
21
+ "homepage": "https://tonsofskills.com/plugins/test-data-generator",
22
+ "bugs": "https://github.com/jeremylongshore/claude-code-plugins-plus-skills/issues",
23
+ "license": "MIT",
24
+ "author": {
25
+ "name": "Claude Code Plugins",
26
+ "email": "[email protected]"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "files": [
32
+ "README.md",
33
+ ".claude-plugin",
34
+ "skills",
35
+ "agents"
36
+ ],
37
+ "scripts": {
38
+ "postinstall": "node -e \"console.log(\\\"\\\\n→ This npm package is a tracking/proof artifact. Install the plugin via:\\\\n ccpi install test-data-generator\\\\n or /plugin install test-data-generator@claude-code-plugins-plus in Claude Code\\\\n\\\")\""
39
+ }
40
+ }
@@ -0,0 +1,143 @@
1
+ ---
2
+ name: generating-test-data
3
+ description: |
4
+ Generate realistic test data including edge cases and boundary conditions.
5
+ Use when creating realistic fixtures or edge case test data.
6
+ Trigger with phrases like "generate test data", "create fixtures", or "setup test database".
7
+
8
+ allowed-tools: Read, Write, Edit, Grep, Glob, Bash(test:data-*)
9
+ version: 1.0.0
10
+ author: Jeremy Longshore <jeremy@intentsolutions.io>
11
+ license: MIT
12
+ compatible-with: claude-code, codex, openclaw
13
+ tags: [testing, database, test-data]
14
+ ---
15
+ # Test Data Generator
16
+
17
+ ## Overview
18
+
19
+ Generate realistic, type-safe test data including fixtures, factory functions, seed datasets, and edge case values. Supports Faker.js, Factory Bot patterns, Fishery (TypeScript factories), pytest fixtures, and database seed scripts.
20
+
21
+ ## Prerequisites
22
+
23
+ - Data generation library installed (Faker.js/@faker-js/faker, Fishery, factory-boy for Python, or JavaFaker)
24
+ - Database schema or TypeScript/Python type definitions for the data models
25
+ - Test framework with fixture support (Jest, pytest, JUnit)
26
+ - Seed management for reproducible random data (`faker.seed()`)
27
+ - Database client for seed data insertion (if generating database fixtures)
28
+
29
+ ## Instructions
30
+
31
+ 1. Read the project's data models, TypeScript interfaces, database schemas, or ORM definitions to understand the shape of all entities.
32
+ 2. For each entity, create a factory function that produces a valid default instance:
33
+ - Use Faker methods matched to field semantics (e.g., `faker.person.fullName()` for names, `faker.internet.email()` for emails).
34
+ - Provide sensible defaults for required fields.
35
+ - Allow overrides via a partial parameter for test-specific customization.
36
+ - Set a deterministic seed for reproducibility (`faker.seed(12345)`).
37
+ 3. Generate edge case data variants for each entity:
38
+ - **Empty values**: Empty strings, null, undefined, empty arrays.
39
+ - **Boundary values**: Maximum string length, integer overflow, zero, negative numbers.
40
+ - **Unicode and i18n**: Names with accents, CJK characters, RTL text, emoji.
41
+ - **Adversarial inputs**: SQL injection strings, XSS payloads, excessively long strings.
42
+ - **Temporal edge cases**: Leap years, timezone boundaries, epoch zero, far-future dates.
43
+ 4. Create relationship factories that build connected entity graphs:
44
+ - A user factory that also creates associated addresses and orders.
45
+ - Configurable depth to avoid infinite recursion.
46
+ - Lazy evaluation for optional relationships.
47
+ 5. Generate database seed files for integration tests:
48
+ - SQL insert scripts or ORM seed functions.
49
+ - Idempotent operations (use `ON CONFLICT` or `INSERT IF NOT EXISTS`).
50
+ - Separate seed sets for different test scenarios (empty state, populated state, edge cases).
51
+ 6. Write fixture files in JSON, YAML, or TypeScript for static test data:
52
+ - Group fixtures by test scenario.
53
+ - Include both valid and invalid data sets.
54
+ 7. Validate generated data against the schema to ensure factories remain in sync with model changes.
55
+
56
+ ## Output
57
+
58
+ - Factory function files (one per entity) in `test/factories/` or `tests/factories/`
59
+ - Edge case data collections covering boundaries and adversarial inputs
60
+ - Database seed scripts for integration test environments
61
+ - JSON/YAML fixture files for static test data
62
+ - Factory index file exporting all factories for easy test imports
63
+
64
+ ## Error Handling
65
+
66
+ | Error | Cause | Solution |
67
+ |-------|-------|---------|
68
+ | Factory produces invalid data | Schema changed but factory not updated | Add a validation step that runs the factory output through the schema validator |
69
+ | Duplicate unique values | Faker generates collisions in small datasets | Use sequential IDs or append a counter; increase Faker's unique retry limit |
70
+ | Database seed fails on foreign key | Seed insertion order violates referential integrity | Sort seed operations topologically by dependency; disable FK checks during seeding |
71
+ | Factory recursion overflow | Circular relationships (User -> Order -> User) | Limit relationship depth; use lazy references; break cycles with ID-only references |
72
+ | Non-deterministic test failures | Random seed not set consistently | Call `faker.seed()` in `beforeAll` or at factory module level; document seed values |
73
+
74
+ ## Examples
75
+
76
+ **TypeScript factory with Fishery:**
77
+ ```typescript
78
+ import { Factory } from 'fishery';
79
+ import { faker } from '@faker-js/faker';
80
+
81
+ interface User {
82
+ id: string;
83
+ name: string;
84
+ email: string;
85
+ role: 'admin' | 'user';
86
+ createdAt: Date;
87
+ }
88
+
89
+ export const userFactory = Factory.define<User>(({ sequence }) => ({
90
+ id: `user-${sequence}`,
91
+ name: faker.person.fullName(),
92
+ email: faker.internet.email(),
93
+ role: 'user',
94
+ createdAt: faker.date.past(),
95
+ }));
96
+
97
+ // Usage:
98
+ const user = userFactory.build();
99
+ const admin = userFactory.build({ role: 'admin' });
100
+ const users = userFactory.buildList(10);
101
+ ```
102
+
103
+ **pytest fixture factory:**
104
+ ```python
105
+ import pytest
106
+ from faker import Faker
107
+
108
+ fake = Faker()
109
+ Faker.seed(42)
110
+
111
+ @pytest.fixture
112
+ def make_user():
113
+ def _make_user(**overrides):
114
+ defaults = {
115
+ "name": fake.name(),
116
+ "email": fake.email(),
117
+ "age": fake.random_int(min=18, max=99),
118
+ }
119
+ return {**defaults, **overrides}
120
+ return _make_user
121
+
122
+ def test_user_validation(make_user):
123
+ user = make_user(age=17)
124
+ assert validate_age(user) is False
125
+ ```
126
+
127
+ **Edge case data collection:**
128
+ ```typescript
129
+ export const edgeCases = {
130
+ strings: ['', ' ', '\t\n', 'a'.repeat(10000), '<script>alert(1)</script>', # 10000: 10 seconds in ms
131
+ "Robert'); DROP TABLE users;--", '\u0000null\u0000byte'],
132
+ numbers: [0, -0, -1, Number.MAX_SAFE_INTEGER, NaN, Infinity, -Infinity],
133
+ dates: [new Date(0), new Date('2024-02-29'), new Date('9999-12-31')], # 2024: 9999 = configured value
134
+ };
135
+ ```
136
+
137
+ ## Resources
138
+
139
+ - Faker.js: https://fakerjs.dev/
140
+ - Fishery (TypeScript factories): https://github.com/thoughtbot/fishery
141
+ - factory_boy (Python): https://factoryboy.readthedocs.io/
142
+ - Chance.js: https://chancejs.com/
143
+ - Test data management patterns: https://martinfowler.com/bliki/ObjectMother.html
@@ -0,0 +1,7 @@
1
+ # Assets
2
+
3
+ Bundled resources for test-data-generator skill
4
+
5
+ - [ ] example_schemas/: A directory containing example JSON schemas for different data types.
6
+ - [ ] example_data/: A directory containing example generated data for different data types.
7
+ - [ ] configuration_templates/: Templates for configuring the data generation process (e.g., number of records, data types).
@@ -0,0 +1,4 @@
1
+ # References
2
+
3
+ Bundled resources for test-data-generator skill
4
+
@@ -0,0 +1,7 @@
1
+ # Scripts
2
+
3
+ Bundled resources for test-data-generator skill
4
+
5
+ - [ ] generate_data.py: A script to generate test data based on provided schema or pre-defined types (users, products, orders).
6
+ - [ ] validate_data.py: A script to validate generated data against a schema or set of rules.
7
+ - [ ] seed_database.py: A script to seed a database with the generated test data.
@@ -0,0 +1,129 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ test-data-generator - Generator Script
4
+ A script to generate test data based on provided schema or pre-defined types (users, products, orders).
5
+ Generated: 2025-12-10 03:48:17
6
+ """
7
+
8
+ import os
9
+ import json
10
+ import argparse
11
+ from pathlib import Path
12
+ from datetime import datetime
13
+
14
+ class Generator:
15
+ def __init__(self, config: Dict):
16
+ self.config = config
17
+ self.output_dir = Path(config.get('output', './output'))
18
+ self.output_dir.mkdir(parents=True, exist_ok=True)
19
+
20
+ def generate_markdown(self, title: str, content: str) -> Path:
21
+ """Generate markdown document."""
22
+ filename = f"{title.lower().replace(' ', '_')}_{datetime.now().strftime('%Y%m%d_%H%M%S')}.md"
23
+ file_path = self.output_dir / filename
24
+
25
+ md_content = f"""# {title}
26
+
27
+ Generated by test-data-generator
28
+ Date: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}
29
+
30
+ ## Overview
31
+ {content}
32
+
33
+ ## Configuration
34
+ ```json
35
+ {json.dumps(self.config, indent=2)}
36
+ ```
37
+
38
+ ## Category
39
+ testing
40
+
41
+ ## Plugin
42
+ test-data-generator
43
+ """
44
+
45
+ file_path.write_text(md_content)
46
+ return file_path
47
+
48
+ def generate_json(self, data: Dict) -> Path:
49
+ """Generate JSON output."""
50
+ filename = f"output_{datetime.now().strftime('%Y%m%d_%H%M%S')}.json"
51
+ file_path = self.output_dir / filename
52
+
53
+ output_data = {
54
+ "generated_by": "test-data-generator",
55
+ "timestamp": datetime.now().isoformat(),
56
+ "category": "testing",
57
+ "plugin": "test-data-generator",
58
+ "data": data,
59
+ "config": self.config
60
+ }
61
+
62
+ with open(file_path, 'w') as f:
63
+ json.dump(output_data, f, indent=2)
64
+
65
+ return file_path
66
+
67
+ def generate_script(self, name: str, template: str) -> Path:
68
+ """Generate executable script."""
69
+ filename = f"{name}.sh"
70
+ file_path = self.output_dir / filename
71
+
72
+ script_content = f"""#!/bin/bash
73
+ # Generated by test-data-generator
74
+ # Date: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}
75
+
76
+ set -e # Exit on error
77
+
78
+ echo "🚀 Running {name}..."
79
+
80
+ # Template content
81
+ {template}
82
+
83
+ echo "✅ Completed successfully"
84
+ """
85
+
86
+ file_path.write_text(script_content)
87
+ file_path.chmod(0o755) # Make executable
88
+ return file_path
89
+
90
+ def main():
91
+ parser = argparse.ArgumentParser(description="A script to generate test data based on provided schema or pre-defined types (users, products, orders).")
92
+ parser.add_argument('--type', choices=['markdown', 'json', 'script'], default='markdown')
93
+ parser.add_argument('--output', '-o', default='./output', help='Output directory')
94
+ parser.add_argument('--config', '-c', help='Configuration file')
95
+ parser.add_argument('--title', default='test-data-generator Output')
96
+ parser.add_argument('--content', help='Content to include')
97
+
98
+ args = parser.parse_args()
99
+
100
+ config = {'output': args.output}
101
+ if args.config and Path(args.config).exists():
102
+ with open(args.config) as f:
103
+ config.update(json.load(f))
104
+
105
+ generator = Generator(config)
106
+
107
+ print(f"🔧 Generating {args.type} output...")
108
+
109
+ if args.type == 'markdown':
110
+ output_file = generator.generate_markdown(
111
+ args.title,
112
+ args.content or "Generated content"
113
+ )
114
+ elif args.type == 'json':
115
+ output_file = generator.generate_json(
116
+ {"title": args.title, "content": args.content}
117
+ )
118
+ else: # script
119
+ output_file = generator.generate_script(
120
+ args.title.lower().replace(' ', '_'),
121
+ args.content or "# Add your script content here"
122
+ )
123
+
124
+ print(f"✅ Generated: {output_file}")
125
+ return 0
126
+
127
+ if __name__ == "__main__":
128
+ import sys
129
+ sys.exit(main())