prisma
Skill0 starsChanged 8 months agoMITView on GitHub
Prisma ORM patterns including Prisma Client usage, queries, mutations, relations, transactions, and schema management. Use when working with Prisma database operations or schema definitions.
5 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- juanquijandria/prisma-harnesstheir own version, first seen Sep 16, 2026
- Rikinshah787/agent-skills-production-skillstheir own version, first seen Aug 10, 2026
- YepAPI/skillstheir own version, first seen Apr 12, 2026
- michelve/hugin-coworkedited, first seen Mar 16, 2026
- Mindrally/skillstheir own version, first seen Jan 23, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- michelve/hugin-cowork★ 190% same
Wrote their own version · 4
- Mindrally/skills★ 266same name
- YepAPI/skills★ 8same name
- juanquijandria/prisma-harness★ 2same name
- Rikinshah787/agent-skills-production-skills★ 2same 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 repository30 other files it gives its agents.
- skills/react-best-practices/AGENTS.mdAGENTS.md
- accessibilitySkill
- adr-writerSkill
- automatic-code-reviewSkill
- component-visualizerSkill
- create-tasksSkill
- dsai-componentsSkill
- dsai-figmaSkill
- dsai-stylingSkill
- dsai-toolsSkill
- figma-code-connect-componentsSkill
- figma-create-design-system-rulesSkill
- figma-create-new-fileSkill
- figma-generate-designSkill
- figma-generate-librarySkill
- figma-implement-designSkill
- figma-useSkill
- miro-mcpSkill
- nodejsSkill
- playwright-skillSkill
- react-best-practicesSkill
- reactSkill
- route-testerSkill
- setupSkill
- skill-creatorSkill
- skill-developerSkill
- sync-schemasSkill
- task-checkSkill
- web-design-guidelinesSkill
- writing-testsSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 199
Use the Singleton Client: - Import prisma from @server/lib/prisma, never create new instances
- Distinctive: line 200
Use Repositories for Complex Queries: - Keep data access organized
- Distinctive: line 202
Prevent N+1 Queries: - Use include or batch queries
- Distinctive: line 203
Use Transactions: - Ensure atomicity for multi-step operations
- Distinctive: line 204
Handle Errors: - Check for specific Prisma error codes
“Common” is measured: kept by at least 6 in 10 of the 5 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 ORM Patterns
When to Use
- Writing database queries with Prisma Client
- Defining or modifying Prisma schema
- Adding database models
- Creating migrations
- Working with relations and associations
- Implementing transactions
- Handling Prisma errors (P2002, P2025)
Purpose
Complete patterns for using Prisma ORM effectively, including query optimization, transaction handling, and the repository pattern for clean data access.
When to Use This Skill
- Working with Prisma Client for database queries
- Creating repositories for data access
- Using transactions
- Query optimization and N+1 prevention
- Handling Prisma errors
Basic Prisma Usage
Core Query Patterns
import { prisma } from "@server/lib/prisma";
// Find one
const user = await prisma.user.findUnique({
where: { id: userId },
});
// Find many with filters
const users = await prisma.user.findMany({
where: { isActive: true },
orderBy: { createdAt: "desc" },
take: 10,
});
// Create
const newUser = await prisma.user.create({
data: {
email: "user@example.com",
name: "John Doe",
},
});
// Update
const updated = await prisma.user.update({
where: { id: userId },
data: { name: "Jane Doe" },
});
// Delete
await prisma.user.delete({
where: { id: userId },
});Complex Filtering
// Multiple conditions
const users = await prisma.user.findMany({
where: {
email: { contains: "@example.com" },
isActive: true,
createdAt: { gte: new Date("2024-01-01") },
},
});
// AND/OR conditions
const posts = await prisma.post.findMany({
where: {
AND: [{ published: true }, { author: { isActive: true } }],
OR: [{ title: { contains: "prisma" } }, { content: { contains: "prisma" } }],
},
});Repository Pattern
See repository-pattern.md for repository template, when to use repositories, and service integration.
Transaction Patterns
See transactions.md for simple and interactive transaction patterns with timeout configuration.
Query Optimization
See query-optimization.md for select vs include, field limiting, and relation fetching.
N+1 Query Prevention
See n-plus-one.md for N+1 problem identification and solutions using include and batch queries.
Relations
See relations.md for one-to-many queries, nested writes, and relation data patterns.
Error Handling
See error-handling.md for Prisma error codes (P2002, P2003, P2025) and error handling patterns.
Advanced Patterns
Aggregations
// Count
const count = await prisma.user.count({
where: { isActive: true },
});
// Aggregate
const stats = await prisma.post.aggregate({
_count: true,
_avg: { views: true },
_sum: { likes: true },
where: { published: true },
});
// Group by
const postsByAuthor = await prisma.post.groupBy({
by: ["authorId"],
_count: { id: true },
});Upsert
// Update if exists, create if not
const user = await prisma.user.upsert({
where: { email: "user@example.com" },
update: { lastLogin: new Date() },
create: {
email: "user@example.com",
name: "John Doe",
},
});TypeScript Patterns
import type { User, Prisma } from "@prisma/client";
// Create input type
const createUser = async (data: Prisma.UserCreateInput): Promise<User> => {
return prisma.user.create({ data });
};
// Include type
type UserWithProfile = Prisma.UserGetPayload<{
include: { profile: true };
}>;
const user: UserWithProfile = await prisma.user.findUnique({
where: { id },
include: { profile: true },
});Best Practices
- Use the Singleton Client - Import
prismafrom@server/lib/prisma, never create new instances - Use Repositories for Complex Queries - Keep data access organized
- Select Only Needed Fields - Improve performance with select
- Prevent N+1 Queries - Use include or batch queries
- Use Transactions - Ensure atomicity for multi-step operations
- Handle Errors - Check for specific Prisma error codes
Related Skills:
- nodejs - Core Node.js patterns and async handling
- route-tester - API route testing patterns
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.

