This skill should be used when the user is working with Prisma database operations or schema definitions. It covers Prisma ORM patterns including Prisma Client usage, queries, mutations, relations, transactions, and schema management.
From hugin-coworknpx claudepluginhub michelve/hugin-marketplace --plugin hugin-coworkThis skill uses the workspace's default tool permissions.
references/error-handling.mdreferences/n-plus-one.mdreferences/query-optimization.mdreferences/relations.mdreferences/repository-pattern.mdreferences/transactions.mdSearches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Guides agent creation for Claude Code plugins with file templates, frontmatter specs (name, description, model), triggering examples, system prompts, and best practices.
Complete patterns for using Prisma ORM effectively, including query optimization, transaction handling, and the repository pattern for clean data access.
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 },
});
// 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" } }],
},
});
See repository-pattern.md for repository template, when to use repositories, and service integration.
See transactions.md for simple and interactive transaction patterns with timeout configuration.
See query-optimization.md for select vs include, field limiting, and relation fetching.
See n-plus-one.md for N+1 problem identification and solutions using include and batch queries.
See relations.md for one-to-many queries, nested writes, and relation data patterns.
See error-handling.md for Prisma error codes (P2002, P2003, P2025) and error handling patterns.
// 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 },
});
// 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",
},
});
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 },
});
prisma from @server/lib/prisma, never create new instancesRelated Skills: