Populate databases with realistic, reproducible test data for development, testing, and staging environments.
npx skills add https://github.com/seb1n/awesome-ai-agent-skills --skill database-seeding
This skill enables an AI agent to generate and insert realistic test data into databases for development, testing, and staging environments. The agent creates idempotent seed scripts using deterministic generators or faker libraries, handles relational data with proper foreign key ordering, supports environment-specific seed profiles (minimal dev data vs. large-scale load testing), and ensures seeds can be run repeatedly without duplicating data.
Provide the database schema (or point to your migration files) and specify the target environment and desired data volume. The agent will generate a complete seed script that respects all constraints and relationships. You can request specific data characteristics (e.g., "include users from multiple time zones" or "create orders spanning the last 12 months").
Request: Seed a PostgreSQL database with users, products, and orders for development.
"""seed.py — Seed development database with realistic test data."""
import random
from datetime import datetime, timedelta
from faker import Faker
import psycopg2
fake = Faker()
Faker.seed(42) # Deterministic output for reproducibility
random.seed(42)
DB_CONFIG = {
"host": "localhost",
"port": 5432,
"dbname": "dev_db",
"user": "dev_user",
"password": "dev_password",
}
NUM_USERS = 50
NUM_PRODUCTS = 30
NUM_ORDERS = 100
def seed():
conn = psycopg2.connect(**DB_CONFIG)
cur = conn.cursor()
# Seed users
user_ids = []
for _ in range(NUM_USERS):
cur.execute(
"""INSERT INTO users (email, password_hash, full_name, created_at)
VALUES (%s, %s, %s, %s)
ON CONFLICT (email) DO NOTHING
RETURNING id""",
(
fake.unique.email(),
fake.sha256(),
fake.name(),
fake.date_time_between(start_date="-2y", end_date="now"),
),
)
row = cur.fetchone()
if row:
user_ids.append(row[0])
# Seed products
product_ids = []
for i in range(NUM_PRODUCTS):
cur.execute(
"""INSERT INTO products (name, description, price, stock_quantity, sku)
VALUES (%s, %s, %s, %s, %s)
ON CONFLICT (sku) DO NOTHING
RETURNING id""",
(
fake.catch_phrase(),
fake.paragraph(nb_sentences=3),
round(random.uniform(9.99, 499.99), 2),
random.randint(0, 500),
f"SKU-{i+1:05d}",
),
)
row = cur.fetchone()
if row:
product_ids.append(row[0])
# Seed orders with order items
statuses = ["pending", "confirmed", "shipped", "delivered"]
for _ in range(NUM_ORDERS):
user_id = random.choice(user_ids)
status = random.choice(statuses)
items = random.sample(product_ids, k=random.randint(1, 5))
total = 0.0
cur.execute(
"""INSERT INTO orders (user_id, status, total_amount, shipping_address, ordered_at)
VALUES (%s, %s, 0, %s, %s) RETURNING id""",
(user_id, status, fake.address(), fake.date_time_between("-1y", "now")),
)
order_id = cur.fetchone()[0]
for pid in items:
qty = random.randint(1, 4)
price = round(random.uniform(9.99, 499.99), 2)
total += qty * price
cur.execute(
"""INSERT INTO order_items (order_id, product_id, quantity, unit_price)
VALUES (%s, %s, %s, %s)""",
(order_id, pid, qty, price),
)
cur.execute(
"UPDATE orders SET total_amount = %s WHERE id = %s", (round(total, 2), order_id)
)
conn.commit()
cur.close()
conn.close()
print(f"Seeded {len(user_ids)} users, {len(product_ids)} products, {NUM_ORDERS} orders.")
if __name__ == "__main__":
seed()
Request: Create a plain SQL seed file for a small development dataset.
-- seed.sql — Idempotent seed data for local development
-- Run with: psql -U dev_user -d dev_db -f seed.sql
BEGIN;
-- Users
INSERT INTO users (id, email, password_hash, full_name, created_at) VALUES
(1, '[email protected]', 'hash_alice', 'Alice Johnson', '2024-03-15 09:00:00'),
(2, '[email protected]', 'hash_bob', 'Bob Martinez', '2024-05-20 14:30:00'),
(3, '[email protected]', 'hash_carol', 'Carol Chen', '2024-07-01 11:15:00'),
(4, '[email protected]', 'hash_dave', 'Dave Okafor', '2024-09-10 08:45:00'),
(5, '[email protected]', 'hash_eve', 'Eve Andersson', '2024-11-28 16:00:00')
ON CONFLICT (id) DO NOTHING;
-- Products
INSERT INTO products (id, name, description, price, stock_quantity, sku) VALUES
(1, 'Wireless Keyboard', 'Bluetooth mechanical keyboard', 79.99, 150, 'SKU-00001'),
(2, 'USB-C Hub', '7-in-1 USB-C docking station', 49.99, 300, 'SKU-00002'),
(3, 'Noise-Cancelling Headphones', 'Over-ear ANC headphones', 199.99, 75, 'SKU-00003'),
(4, '4K Monitor', '27-inch IPS 4K display', 399.99, 40, 'SKU-00004'),
(5, 'Laptop Stand', 'Adjustable aluminum stand', 34.99, 200, 'SKU-00005')
ON CONFLICT (id) DO NOTHING;
-- Orders
INSERT INTO orders (id, user_id, status, total_amount, shipping_address, ordered_at) VALUES
(1, 1, 'delivered', 129.98, '123 Oak St, Portland, OR 97201', '2024-12-01 10:00:00'),
(2, 2, 'shipped', 199.99, '456 Elm Ave, Austin, TX 78701', '2025-01-05 14:20:00'),
(3, 3, 'confirmed', 484.98, '789 Pine Rd, Seattle, WA 98101', '2025-01-10 09:30:00'),
(4, 1, 'pending', 49.99, '123 Oak St, Portland, OR 97201', '2025-01-12 16:45:00')
ON CONFLICT (id) DO NOTHING;
-- Order items
INSERT INTO order_items (id, order_id, product_id, quantity, unit_price) VALUES
(1, 1, 1, 1, 79.99),
(2, 1, 2, 1, 49.99),
(3, 2, 3, 1, 199.99),
(4, 3, 4, 1, 399.99),
(5, 3, 5, 1, 34.99),
(6, 4, 2, 1, 49.99)
ON CONFLICT (id) DO NOTHING;
-- Reset sequences to avoid conflicts with future inserts
SELECT setval('users_id_seq', (SELECT MAX(id) FROM users));
SELECT setval('products_id_seq', (SELECT MAX(id) FROM products));
SELECT setval('orders_id_seq', (SELECT MAX(id) FROM orders));
SELECT setval('order_items_id_seq', (SELECT MAX(id) FROM order_items));
COMMIT;
Faker.seed(42)) to produce deterministic data that makes test results reproducible and diffs in seed output meaningful.assert os.environ["ENV"] != "production") at the top of seed scripts as a safety guard.fake.unique.email() or append a counter to generated values to avoid duplicates. Reset the unique tracker between test runs with fake.unique.clear().LLM-driven hypothesis generation/testing on tabular data. Three methods: HypoGeniC (data-driven), HypoRefine (literature+data), Union. Iterative refinement, Redis caching, multi-hypothesis inference. Manual: hypothesis-generation; ideation: scientific-brainstorming.
This skill should be used when the user asks to \"automate SQL injection testing,\" \"enumerate database structure,\" \"extract database credentials using sqlmap,\" \"dump tables and columns...
Optimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.
Bisect a ClickHouse regression using pre-built master binaries from CI. Use when the user wants to find the commit that introduced a bug.
QA an analysis before sharing -- methodology, accuracy, and bias checks. Use when reviewing an analysis before a stakeholder presentation, spot-checking calculations and aggregation logic, verifying a SQL query's results look right, or assessing whether conclusions are actually supported by the data.
End-to-end smoke test for the public Errors HTTP API (error groups). Seeds failed runs into ClickHouse so the error materialized views populate, then drives the real endpoints against the running webapp — list (with filters + pagination), retrieve, resolve/ignore/unresolve, the `filter[error]` runs filter, user attribution via the `trigger.dev mint-token` -> JWT exchange, and the 401/403/404 negatives. Use for "smoke test the errors API", "test the errors API e2e", "prove the errors endpoints work", or to re-verify after changes.
Strix SQL 注入测试手册,覆盖 union、blind、error-based 与 ORM 绕过技巧;触发名:strix-sql-injection
> Pull and interpret production experiment query-performance data from the staff-only slowest experiment queries, precompute read/build health, and preaggregation cache footprint. and response field semantics (exception codes, exposure paths, precompute skip reasons, job states). Use when investigating slow or failing experiment queries, precompute regressions, 307/159/241 errors, preaggregation table growth, or when asked how experiment query performance or the precompute rollout is doing in production.
Take seb1n/database-seeding from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.