Prisma
A Claude Code plugin packaging 23 skills, 8 agents, 5 event hooks, and 7 MCP servers for full-stack development with React 19, TypeScript, Express, Prisma, Tailwind CSS v4, and shadcn/ui.
npx -y skills add michelve/hugin-v0 --skill prismaAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Prisma ORM patterns including Prisma Client usage, queries, mutations, relations, transactions, and schema management. Use when working with Prisma database operations or schema definitions.
SKILL.md
4.7 KB, ~1.1k tokens by cl100k_base, as published. Nobody here has run it
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: "[email protected]",
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: "[email protected]" },
update: { lastLogin: new Date() },
create: {
email: "[email protected]",
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
What ships with it: 6 files
6.3 KB alongside SKILL.md
reference/
- error-handling.md1.0 KB
- n-plus-one.md833 B
- query-optimization.md942 B
- relations.md887 B
- repository-pattern.md1.7 KB
- transactions.md1011 B
Gives 1 of the 12 instructions most databases sql skills give in ~1.1k tokens
Counted across 589 of the 662 authors here whose files we hold, read 2026-08-07
- Use parameterized queriesin 37 of 589, across 34 files
- Use timestamptz for timestampsin 30 of 589, across 14 files
- Index foreign keysin 29 of 589, across 18 files
- Create indexes concurrentlyin 29 of 589, across 24 files
- Use numeric type for moneyin 25 of 589, across 8 files
- Use cursor pagination instead of offsetin 24 of 589, across 17 files
- Select only required columnshere, and in 24 of 589, across 20 files
- Add indexes manually on foreign key columnsin 22 of 589, across 12 files
- Normalize to third normal formin 19 of 589, across 10 files
- Configure connection poolingin 19 of 589, across 17 files
- Put equality columns before range columns in indexesin 18 of 589, across 10 files
- Read individual rule files for detailed explanationsin 18 of 589, across 4 files
Said here and by no other author read
- never create new client instances
- use repositories for complex queries
- handle specific Prisma error codes
- use Prisma input types for data
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.