prisma-orm
Skill3 starsChanged 7 months agoMITView on GitHub
Prisma ORM expertise for schema design, migrations, client usage, and deployment. Use when writing Prisma schemas, creating migrations, querying with Prisma Client, defining relations, or deploying database changes. Triggers on "prisma", "prisma schema", "prisma migrate", "prisma client", "prisma relation", "@@map", "@@index", "prisma generate", "prisma studio", "prisma deploy".
1 other project uses a version of this.
Adopted by
Most recently taken up by
- cohen-liel/hivemindtheir own version, first seen Mar 17, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- cohen-liel/hivemind★ 108same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository16 other files it gives its agents.
- api-designSkill
- auth-patternsSkill
- database-designerSkill
- database-optimizerSkill
- framer-motionSkill
- js-debuggingSkill
- js-testingSkill
- knip-cleanupSkill
- mysql-expertSkill
- nextjs-expertSkill
- nextjs-typescript-engineerSkill
- postgresql-expertSkill
- quality-gateSkill
- supabaseSkill
- tailwindSkill
- verificationSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 96
Read reference/client-patterns.md for CRUD recipes, nested writes, transactions, and error handling.
- Very specific: line 117
Read reference/migration-workflow.md for CI/CD integration, handling drift, and rollback strategies.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Prisma ORM Skill
You are a Prisma ORM expert for TypeScript applications.
Critical Rules
- Run
prisma generateafter schema changes — the client is code-generated, not runtime - Use
migrate devin development — creates migration files and applies them - Use
migrate deployin production — applies pending migrations without creating new ones - Never use
db pushin production — it doesn't create migration files and can lose data - Name relations explicitly — when a model has multiple relations to the same target
- Add
@@indexfor query performance — Prisma doesn't auto-create indexes on FKs - Use transactions for multi-step operations —
prisma.$transaction()for consistency
Schema Design
model User {
id String @id @default(uuid())
email String @unique
name String?
posts Post[]
profile Profile?
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("users")
@@index([email])
}
model Post {
id String @id @default(uuid())
title String
content String?
author User @relation(fields: [authorId], references: [id], onDelete: Cascade)
authorId String @map("author_id")
@@map("posts")
@@index([authorId])
}Key attributes: @id, @unique, @default(), @map(), @relation(), @@map(), @@index(), @@unique(). Read reference/schema-patterns.md for all types and patterns.
Relations
| Type | Schema Pattern |
| One-to-One | FK with @unique on one side, optional ? field on other |
| One-to-Many | FK on "many" side, array [] on "one" side |
| Many-to-Many (implicit) | Array [] on both sides, Prisma creates junction table |
| Many-to-Many (explicit) | Junction model with two @relation fields |
| Self-relation | Model references itself (e.g., parent/children) |
Client Usage
// Create with relation
const user = await prisma.user.create({
data: { email: 'a@b.com', name: 'Alice', posts: { create: { title: 'Hello' } } },
include: { posts: true },
});
// Query with filtering
const posts = await prisma.post.findMany({
where: { author: { email: { contains: '@company.com' } } },
orderBy: { createdAt: 'desc' },
take: 20,
skip: 0,
select: { id: true, title: true, author: { select: { name: true } } },
});
// Cursor pagination (preferred over offset)
const next = await prisma.post.findMany({
cursor: { id: lastId },
skip: 1,
take: 20,
orderBy: { id: 'asc' },
});Read reference/client-patterns.md for CRUD recipes, nested writes, transactions, and error handling.
Migrations
# Development: create and apply migration
npx prisma migrate dev --name add_user_table
# Production: apply pending migrations
npx prisma migrate deploy
# Reset database (development only)
npx prisma migrate reset
# Generate client after schema change
npx prisma generate
# Browse database
npx prisma studioRead reference/migration-workflow.md for CI/CD integration, handling drift, and rollback strategies.
Advanced
- Raw queries —
prisma.$queryRawfor complex SQL not supported by client - Transactions —
prisma.$transaction([...])for sequential, orprisma.$transaction(async (tx) => {...})for interactive - Middleware —
prisma.$use()for logging, soft delete, audit trails - Connection pooling — use
pgbouncer=truein connection string for serverless
Anti-Patterns
- Don't use
db pushin prod — no migration history, can drop columns - Don't skip
@@index— Prisma doesn't auto-index foreign keys - Don't fetch all fields — use
selectto reduce payload - Don't ignore N+1 — use
includeto eager-load relations - Don't edit migration files — create new migrations to fix issues
- Don't use
prisma migrate devin CI — useprisma migrate deploy
Related
reference/schema-patterns.md— Model patterns, field types, attributes, enums, multi-file schemasreference/client-patterns.md— CRUD recipes, filtering, transactions, raw SQL, error handlingreference/migration-workflow.md— Dev vs prod workflow, seeding, CI/CD, rollback
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

