db-seed

jezweb/claude-skills · updated May 29, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/jezweb/claude-skills --skill db-seed
0 commentsdiscussion
summary

Generate seed scripts that populate databases with realistic, domain-appropriate sample data. Reads your schema and produces ready-to-run seed files.

skill.md

Database Seed Generator

Generate seed scripts that populate databases with realistic, domain-appropriate sample data. Reads your schema and produces ready-to-run seed files.

Workflow

1. Find the Schema

Scan the project for schema definitions:

Source Location pattern
Drizzle schema src/db/schema.ts, src/schema/*.ts, db/schema.ts
D1 migrations drizzle/*.sql, migrations/*.sql
Raw SQL schema.sql, db/*.sql
Prisma prisma/schema.prisma

Read all schema files. Build a mental model of:

  • Tables and their columns
  • Data types and constraints (NOT NULL, UNIQUE, DEFAULT)
  • Foreign key relationships (which tables reference which)
  • JSON fields stored as TEXT (common in D1/SQLite)

2. Determine Seed Parameters

Ask the user:

Parameter Options Default
Purpose dev, demo, testing dev
Volume small (5-10 rows/table), medium (20-50), large (100+) small
Domain context "e-commerce store", "SaaS app", "blog", etc. Infer from schema
Output format TypeScript (Drizzle), raw SQL, or both Match project's ORM

Purpose affects data quality:

  • dev: Varied data, some edge cases (empty fields, long strings, unicode)
  • demo: Polished data that looks good in screenshots and presentations
  • testing: Systematic data covering boundary conditions, duplicates, special characters

3. Plan Insert Order

Build a dependency graph from foreign keys. Insert parent tables before children.

Example order for a blog schema:

1. users        (no dependencies)
2. categories   (no dependencies)
3. posts        (depends on users, categories)
4. comments     (depends on users, posts)
5. tags         (no dependencies)
6. post_tags    (depends on posts, tags)

Circular dependencies: If table A references B and B references A, use nullable foreign keys and insert in two passes (insert with NULL, then UPDATE).

4. Generate Realistic Data

Do NOT use generic placeholders like "test123", "[email protected]", or "Lorem ipsum". Generate data that matches the domain.

Data Generation Patterns (no external libraries needed)

Names: Use a hardcoded list of common names. Mix genders and cultural backgrounds.

const firstNames = ['Sarah', 'James', 'Priya', 'Mohammed', 'Emma', 'Wei', 'Carlos', 'Aisha'];
const lastNames = ['Chen', 'Smith', 'Patel', 'Garcia', 'Kim', 'O\'Brien', 'Nguyen', 'Wilson'];

Emails: Derive from names — [email protected]. Use example.com domain (RFC 2606 reserved).

Dates: Generate within a realistic range. Use ISO 8601 format for D1/SQLite.

const randomDate = (daysBack: number) => {
  const d = new Date();
  d.setDate(d.getDate() - Math.floor(Math.random() * daysBack));
  return d.toISOString();
};

IDs: Use crypto.randomUUID() for UUIDs, or sequential integers if the schema uses auto-increment.

Deterministic seeding: For reproducible data, use a seeded PRNG:

function seededRandom(seed: number) {
  return () => {
    seed = (seed * 16807) % 2147483647;
    return (seed - 1) / 2147483646;
  };
}
const rand = seededRandom(42); // Same seed = same data every time

Prices/amounts: Use realistic ranges. (rand() * 900 + 100).toFixed(2) for $1-$10 range.

Descriptions/content: Write 3-5 realistic variations per content type and cycle through them. Don't generate AI-sounding prose — write like real user data.

5. Output Format

TypeScript (Drizzle ORM)

// scripts/seed.ts
import { drizzle } from 'drizzle-orm/d1';
import * as schema from '../src/db/schema';

export async function seed(db: ReturnType<typeof drizzle>) {
  console.log('Seeding database...');

  // Clear existing data (reverse dependency order)
  await db.delete(schema.comments);
  await db.delete(schema.posts);
  await db.delete(schema.users);

  // Insert users
  const users = [
    { id: crypto.randomUUID(), name: 'Sarah Chen', email: '[email protected]', ... },
    // ...
  ];

  // D1 batch limit: 10 rows per INSERT
  for (let i = 0; i < users.length; i += 10) {
    await db.insert(schema.users).values(users.slice(i, i + 10));
  }

  // Insert posts (references users)
  const posts = [
    { id: crypto.randomUUID(), userId: users[0].id, title: '...', ... },
    // ...
  ];

  for (let i = 0; i < posts.length; i += 10) {
    await db.insert(schema.posts).values(posts.slice(i, i + 10));
  }

  console.log(`Seeded: ${users.length} users, ${posts.length} posts`);
}

Run with: npx tsx scripts/seed.ts

For Cloudflare Workers, add a seed endpoint (remove before production):

app.post('/api/seed', async (c) => {
  const db = drizzle(c.env.DB);
  await seed(db);
  return c.json({ ok: true });
});

Raw SQL (D1)

-- seed.sql
-- Run: npx wrangler d1 execute DB_NAME --local --file=./scripts/seed.sql

-- Clear existing (reverse order)
DELETE FROM comments;
DELETE FROM posts;
DELETE FROM users;

-- Users
INSERT INTO users (id, name, email, created_at) VALUES
  ('uuid-1', 'Sarah Chen', '[email protected]', '2025-01-15T10:30:00Z'),
  ('uuid-2', 'James Wilson', '[email protected]', '2025-02-01T14:22:00Z');

-- Posts (max 10 rows per INSERT for D1)
INSERT INTO posts (id, user_id
how to use db-seed

How to use db-seed on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add db-seed
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/jezweb/claude-skills --skill db-seed

The skills CLI fetches db-seed from GitHub repository jezweb/claude-skills and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/db-seed

Reload or restart Cursor to activate db-seed. Access the skill through slash commands (e.g., /db-seed) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

User Story & Requirements Generation

Create detailed user stories, acceptance criteria, and feature specs

Example

Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios

Reduce spec writing time by 50%, ensure comprehensive coverage

Competitive Analysis

Research competitors, compare features, identify gaps

Example

Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities

Complete competitive research in 2 hours instead of 2 days

Roadmap Prioritization

Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs

Example

Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale

Make data-driven prioritization decisions faster

Stakeholder Communication

Draft PRDs, status updates, and stakeholder presentations

Example

Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement

Save 3-5 hours/week on communication overhead

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client
  • Access to product documentation and roadmap tools (Jira, Notion, etc.)
  • Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
  • Stakeholder contact information and communication channels

Time Estimate

30-60 minutes to see productivity improvements

Installation Steps

  1. 1.Install product management skill
  2. 2.Start with user story generation for known feature
  3. 3.Progress to competitive analysis: research 2-3 competitors
  4. 4.Use for roadmap prioritization: apply RICE/ICE scoring
  5. 5.Draft stakeholder communications and refine based on feedback
  6. 6.Build template library for recurring PM tasks
  7. 7.Share effective prompts with product team

Common Pitfalls

  • Not validating competitive research—verify facts before sharing
  • Accepting user stories without involving engineering team
  • Over-relying on frameworks without qualitative judgment
  • Not customizing outputs to company culture and communication style
  • Skipping stakeholder validation of generated requirements

Best Practices

✓ Do

  • +Validate research and competitive analysis with real data
  • +Collaborate with engineering when generating technical requirements
  • +Customize frameworks and templates to your company context
  • +Use skill for first drafts, refine with stakeholder input
  • +Document successful prompt patterns for PM tasks
  • +Combine AI efficiency with human judgment and intuition

✗ Don't

  • Don't publish competitive analysis without fact-checking
  • Don't finalize user stories without engineering review
  • Don't make prioritization decisions solely on AI scoring
  • Don't skip customer validation of generated requirements
  • Don't ignore company-specific context and culture

💡 Pro Tips

  • Provide context: company goals, constraints, customer feedback
  • Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
  • Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
  • Use skill for 70% generation + 30% customization to company needs

When to Use This

✓ Use When

Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.

✗ Avoid When

Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.

Learning Path

  1. 1Basic: user stories, feature specs, status updates
  2. 2Intermediate: competitive analysis, prioritization frameworks, PRDs
  3. 3Advanced: product strategy, go-to-market planning, OKR setting
  4. 4Expert: product vision, market positioning, business model innovation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.652 reviews
  • Soo Liu· Dec 28, 2024

    We added db-seed from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Isabella Kapoor· Dec 24, 2024

    Registry listing for db-seed matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Michael Bansal· Dec 20, 2024

    Keeps context tight: db-seed is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Aditi Malhotra· Dec 8, 2024

    db-seed reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Daniel Shah· Dec 8, 2024

    I recommend db-seed for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Aanya Perez· Nov 27, 2024

    Registry listing for db-seed matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Soo Zhang· Nov 27, 2024

    db-seed fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Harper Thompson· Nov 15, 2024

    db-seed reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Olivia Rahman· Nov 3, 2024

    We added db-seed from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Harper Garcia· Oct 22, 2024

    Keeps context tight: db-seed is the kind of skill you can hand to a new teammate without a long onboarding doc.

showing 1-10 of 52

1 / 6