Prisma ORM schema design, migrations, client generation, and query patterns. Use when designing database schemas, writing migrations, querying data, or managing Prisma Client.
70
86%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Low
Low-risk findings worth noting
Project schema and connection details: database-config.md. Docs: https://www.prisma.io/docs
npx prisma migrate dev in development only — never in production; it can reset data. CI/production uses npx prisma migrate deploy.prisma/migrations/<timestamp>/migration.sql before applying. Destructive operations (drops, column rewrites) need an explicit backfill step added to the migration.npx prisma generate after every schema change; a stale client silently mismatches the DB. npx prisma db push skips migration history entirely — prototyping only.cuid() / uuid() for IDs, not serial increments, in anything distributed.@map/@@map produces a column drop plus add, not a rename. Check both when renaming.@@index explicitly on frequently queried columns — the schema does not imply them.@relation explicitly, including onDelete (e.g. onDelete: Cascade); leaving it implicit means the delete behavior is whatever the connector defaults to.createdAt @default(now()) and updatedAt @updatedAt for auditability.Hot reload in dev creates a new PrismaClient per reload and exhausts the connection pool. Use the global singleton:
const globalForPrisma = globalThis as unknown as { prisma?: PrismaClient };
export const prisma = globalForPrisma.prisma ?? new PrismaClient();
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;Use select for narrow reads, include for relations, prisma.$transaction for multi-step writes. Catch error code P2002 for unique-constraint violations and handle it rather than letting it surface as a 500.
Other commands: prisma studio (visual editor), prisma db pull (introspect), prisma db seed, prisma validate, prisma format.
fa0c341
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.