Prisma ORM schema design, migrations, client generation, and query patterns. Use when designing database schemas, writing migrations, querying data, or managing Prisma Client.
100
100%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Advisory
Suggest reviewing before use
For project-specific database schema and connection details, see database-config.md.
npx prisma init # Initialize Prisma in the project
npx prisma generate # Generate Prisma Client from schema
npx prisma migrate dev # Create and apply migration (dev)
npx prisma migrate deploy # Apply pending migrations (production)
npx prisma migrate reset # Reset database and apply all migrations
npx prisma db push # Push schema changes without migration
npx prisma db pull # Introspect database into schema
npx prisma db seed # Run seed script
npx prisma studio # Open visual database editor
npx prisma format # Format schema file
npx prisma validate # Validate schema syntax// prisma/schema.prisma
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id String @id @default(cuid())
email String @unique
name String?
posts Post[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([email])
@@map("users")
}
model Post {
id String @id @default(cuid())
title String
content String?
published Boolean @default(false)
author User @relation(fields: [authorId], references: [id], onDelete: Cascade)
authorId String
@@index([authorId])
@@map("posts")
}cuid() or uuid() for IDs in distributed systems (avoid serial increments).createdAt and updatedAt timestamps for auditability and migrations.@relation definitions and add @@index on frequently queried columns.@map/@@map uses when renaming to prevent accidental column/table mismatches.npx prisma migrate dev during development to generate migrations; inspect the generated SQL before applying.npx prisma migrate deploy in CI/CD; never run migrate dev in production.npx prisma generate.npx prisma migrate dev --name <desc> locally to generate SQL.prisma/migrations/<timestamp>/migration.sql for destructive operations and add backfills as needed.npx prisma migrate deploy and assert clean application.For query patterns, singleton client pattern, and runnable CRUD examples see REFERENCE.md in this directory.
f5c8508
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.