prisma
Skill15 starsChanged 42 days agoMITView on GitHub
Expert Prisma ORM assistance covering Prisma schema, migrations, type-safe queries, relation filters, and Accelerate. Use when modeling databases and querying SQL in TypeScript/JavaScript.
7 other projects use a version of this.
Adopted by
Most recently taken up by
- nateslabach/skillstheir own version, first seen Nov 8, 2026
- Alteriom/ai-dev-skillstheir own version, first seen Oct 11, 2026
- juanquijandria/prisma-harnesstheir own version, first seen Oct 9, 2026
- Mindrally/skillstheir own version, first seen Oct 8, 2026
- trycompai/comptheir own version, first seen Oct 8, 2026
- elie222/inbox-zerotheir own version, first seen Oct 8, 2026
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 7
- elie222/inbox-zero★ 13ksame name
- trycompai/comp★ 2.1ksame name
- Mindrally/skills★ 275same name
- YepAPI/skills★ 8same name
- nateslabach/skills★ 6same name
- juanquijandria/prisma-harness★ 2same name
- Alteriom/ai-dev-skills★ 0same 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 repository350 other files it gives its agents.
- airflowSkill
- catboostSkill
- claudeSkill
- comfyuiSkill
- cursor-aiSkill
- dalleSkill
- daskSkill
- dbtSkill
- deepseekSkill
- fastaiSkill
- geminiSkill
- github-copilotSkill
- huggingfaceSkill
- jaxSkill
- jupyterSkill
- kerasSkill
- langchainSkill
- lightgbmSkill
- llamaindexSkill
- llamaSkill
- matplotlibSkill
- midjourneySkill
- mistralSkill
- mlflowSkill
- nltkSkill
- numpySkill
- ollamaSkill
- openai-gptSkill
- opencvSkill
- pandasSkill
- perplexitySkill
- plotlySkill
- polarsSkill
- pytorchSkill
- raySkill
- scikit-learnSkill
- seabornSkill
- spacySkill
- sparkSkill
- stable-diffusionSkill
- tensorflowSkill
- vaexSkill
- weights-biasesSkill
- whisperSkill
- xgboostSkill
- api-gatewaySkill
- clean-architectureSkill
- cqrsSkill
- domain-driven-designSkill
- event-drivenSkill
- event-sourcingSkill
- graphqlSkill
- grpcSkill
- hexagonalSkill
- microservicesSkill
- modular-monolithSkill
- monolithSkill
- rest-apiSkill
- sagaSkill
- serverlessSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 0 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 179
Use select clauses in queries to fetch only necessary columns instead of full rows.
- Very specific: line 180
Run prisma migrate deploy in CI/CD production deployment pipelines.
- Very specific: line 185
Create new PrismaClient() instances inside serverless request handler functions.
- Very specific: line 186
Run prisma db push in production.
- Very specific: line 187
Use $queryRawUnsafe with concatenated user strings.
“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Prisma
Prisma is a next-generation Node.js and TypeScript ORM featuring declarative schema modeling, automated type-safe database queries, and robust migration tooling.
When to Use
- TypeScript-First Database Modeling: Declarative data models with automated migrations and end-to-end type safety.
- Next.js & Node.js Enterprise Backends: Developing web services with Prisma Client and PostgreSQL/MySQL/SQLite/MongoDB.
- Safe Relational Query Composition: Fluent queries with deeply nested relations, filtering, and pagination.
- Prisma Accelerate & Pulse: Edge caching, connection pooling, and real-time database change-event subscriptions.
Quick Start
// schema.prisma
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
posts Post[]
}
model Post {
id Int @id @default(autoincrement())
title String
authorId Int
author User @relation(fields: [authorId], references: [id])
}import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
const users = await prisma.user.findMany({ include: { posts: true } });Core Concepts
Declarative Schema Definition with Relations
Defining entities, indexes, and referential constraints:
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
posts Post[]
createdAt DateTime @default(now())
}
model Post {
id Int @id @default(autoincrement())
title String
content String?
published Boolean @default(false)
author User @relation(fields: [authorId], references: [id], onDelete: Cascade)
authorId Int
@@index([authorId])
}Type-Safe CRUD & Nested Relational Queries
Reading and writing related data in single operations:
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
async function createUserWithPost() {
const user = await prisma.user.create({
data: {
email: "alex@example.com",
name: "Alex Rivera",
posts: {
create: [{ title: "Getting Started with Prisma", published: true }],
},
},
include: {
posts: true,
},
});
return user;
}Interactive Transactions with $transaction
Executing multi-step operations with ACID guarantees:
async function transferFunds(
fromUserId: number,
toUserId: number,
amount: number,
) {
return await prisma.$transaction(async (tx) => {
const sender = await tx.account.update({
where: { userId: fromUserId },
data: { balance: { decrement: amount } },
});
if (sender.balance < 0) {
throw new Error("Insufficient funds");
}
const receiver = await tx.account.update({
where: { userId: toUserId },
data: { balance: { increment: amount } },
});
return { sender, receiver };
});
}Common Patterns
Interactive Transactions with Rollback Safety
Problem: Updating multiple tables where failure of any step must roll back previous changes.
Solution:
Use $transaction closure:
const result = await prisma.$transaction(async (tx) => {
const sender = await tx.account.update({
where: { id: fromAccountId },
data: { balance: { decrement: amount } },
});
if (sender.balance < 0) {
throw new Error("Insufficient funds for transfer");
}
const recipient = await tx.account.update({
where: { id: toAccountId },
data: { balance: { increment: amount } },
});
return { sender, recipient };
});Best Practices
Do:
- Instantiate a single
PrismaClientinstance globally in development to prevent connection pool exhaustion. - Use
selectclauses in queries to fetch only necessary columns instead of full rows. - Run
prisma migrate deployin CI/CD production deployment pipelines. - Leverage interactive transactions (
prisma.$transaction(async (tx) => ...)) for ACID workflows.
Don't:
- Create new
PrismaClient()instances inside serverless request handler functions. - Run
prisma db pushin production; useprisma migrateto preserve migration history. - Use
$queryRawUnsafewith concatenated user strings; use parameterized$queryRaw.
Troubleshooting
| Error | Cause | Solution |
PrismaClientInitializationError: Can't reach database server | Database offline, network partition, or invalid DATABASE_URL. | Check database connection string and network reachability. |
PrismaClientKnownRequestError: P2002 Unique constraint failed | Attempting to insert a duplicate value for a @unique column. | Catch code P2002 and return user-friendly duplicate error. |
Prisma Client not initialized / outdated types | Schema was modified without regenerating client. | Run npx prisma generate after modifying schema.prisma. |
References
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.

