Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
prisma avatar

Prisma Cli Db Seed

  • 14 installs
  • 8 repo stars
  • Updated February 9, 2026
  • prisma/cursor-plugin

prisma-cli-db-seed runs the configured Prisma database seed script.

About

The prisma-cli-db-seed skill documents prisma db seed executing the migrations.seed command from prisma.config.ts such as tsx prisma/seed.ts. v7 requires explicit seeding after migrate dev unlike v6 auto-seed on reset. Examples show upsert-based idempotent users, conditional seeding when tables are empty, and environment-specific branches. Custom args pass after -- to the seed script. Best practices recommend minimal realistic fake data, version-controlled scripts, and disconnect handling in finally blocks. Pairs with migrate reset --force for clean dev databases. Seed configuration lives beside migrations.path in defineConfig with datasource url from env. Runs seed command configured in prisma.config.ts. v7 requires explicit prisma db seed after migrations. Documents upsert idempotency and conditional seeding. Passes custom args after -- to seed scripts. Pairs with migrate reset for dev database refresh. Populated database from idempotent seed script execution.

  • Runs seed command configured in prisma.config.ts.
  • v7 requires explicit prisma db seed after migrations.
  • Documents upsert idempotency and conditional seeding.
  • Passes custom args after -- to seed scripts.
  • Pairs with migrate reset for dev database refresh.

Prisma Cli Db Seed by the numbers

  • 14 all-time installs (skills.sh)
  • Ranked #604 of 911 Databases skills by installs in the Skillselion catalog
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
At a glance

prisma-cli-db-seed capabilities & compatibility

Capabilities
prisma.config.ts seed configuration · v7 explicit seed workflow · idempotent upsert patterns
Works with
postgres · mysql
Use cases
database · testing
From the docs

What prisma-cli-db-seed says it does

Runs your database seed script to populate data
SKILL.md
seeding is NOT automatic after migrations
SKILL.md
npx skills add https://github.com/prisma/cursor-plugin --skill prisma-cli-db-seed

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs14
repo stars8
Last updatedFebruary 9, 2026
Repositoryprisma/cursor-plugin

How do I seed a Prisma database in v7?

Run configured seed scripts to populate development data with idempotent upsert patterns in Prisma v7.

Who is it for?

Developers loading fixtures after migrations in local environments.

Skip if: Skip in production deploy pipelines that must not seed.

When should I use this skill?

User runs or authors prisma db seed workflows.

What you get

Populated database from idempotent seed script execution.

Files

SKILL.mdMarkdownGitHub ↗

prisma db seed

Runs your database seed script to populate data.

Command

prisma db seed [options]

What It Does

  • Executes your configured seed script
  • Populates database with initial/test data
  • Runs independently (not auto-run by migrations in v7)

Options

OptionDescription
--configCustom path to your Prisma config file
--Pass custom arguments to seed script

Configuration

Configure seed script in prisma.config.ts:

import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'

export default defineConfig({
  schema: 'prisma/schema.prisma',
  migrations: {
    path: 'prisma/migrations',
    seed: 'tsx prisma/seed.ts',  // Your seed command
  },
  datasource: {
    url: env('DATABASE_URL'),
  },
})

Common seed commands

// TypeScript with tsx
seed: 'tsx prisma/seed.ts'

// TypeScript with ts-node
seed: 'ts-node prisma/seed.ts'

// JavaScript
seed: 'node prisma/seed.js'

Seed Script Example

// prisma/seed.ts
import { PrismaClient } from '../generated/client'

const prisma = new PrismaClient()

async function main() {
  // Create users
  const alice = await prisma.user.upsert({
    where: { email: 'alice@prisma.io' },
    update: {},
    create: {
      email: 'alice@prisma.io',
      name: 'Alice',
      posts: {
        create: {
          title: 'Hello World',
          published: true,
        },
      },
    },
  })

  const bob = await prisma.user.upsert({
    where: { email: 'bob@prisma.io' },
    update: {},
    create: {
      email: 'bob@prisma.io',
      name: 'Bob',
    },
  })

  console.log({ alice, bob })
}

main()
  .then(async () => {
    await prisma.$disconnect()
  })
  .catch(async (e) => {
    console.error(e)
    await prisma.$disconnect()
    process.exit(1)
  })

Examples

Run seed

prisma db seed

With custom arguments

prisma db seed -- --environment development

Arguments after -- are passed to your seed script.

v7 Changes

In Prisma 7, seeding is NOT automatic after migrations:

# v7 workflow
prisma migrate dev --name init
prisma generate
prisma db seed  # Must run explicitly

Previously (v6), migrate dev and migrate reset auto-ran seeds.

Idempotent Seeding

Use upsert to make seeds re-runnable:

// Good: Can run multiple times
await prisma.user.upsert({
  where: { email: 'alice@prisma.io' },
  update: {},  // Don't change existing
  create: { email: 'alice@prisma.io', name: 'Alice' },
})

// Bad: Fails on second run
await prisma.user.create({
  data: { email: 'alice@prisma.io', name: 'Alice' },
})

Common Patterns

Development reset

prisma migrate reset --force
prisma db seed

Conditional seeding

// prisma/seed.ts
const count = await prisma.user.count()
if (count === 0) {
  // Only seed if empty
  await seedUsers()
}

Environment-specific seeds

// prisma/seed.ts
const env = process.env.NODE_ENV || 'development'

if (env === 'development') {
  await seedDevData()
} else if (env === 'test') {
  await seedTestData()
}

Best Practices

1. Use upsert for idempotent seeds 2. Keep seeds focused and minimal 3. Use realistic but fake data 4. Document required seed data 5. Version control your seed scripts

Related skills

FAQ

What does prisma-cli-db-seed do?

prisma-cli-db-seed runs the configured Prisma database seed script.

When should I use prisma-cli-db-seed?

User runs or authors prisma db seed workflows.

Is this skill safe to install?

Review the Security Audits panel on this page before installing in production.

Databasesdatabases

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.