This skill should be used when the user asks about "prisma client", "findMany", "findUnique", "create", "update", "delete", "prisma query", "include", "select", "where", "prisma transactions", "nested writes", or mentions database queries and CRUD operations with Prisma.
View on GitHubplugins/prisma-dev/skills/prisma-queries/SKILL.md
February 2, 2026
Select agents to install to:
npx add-skill https://github.com/nthplusio/functional-claude/blob/main/plugins/prisma-dev/skills/prisma-queries/SKILL.md -a claude-code --skill prisma-queriesInstallation paths:
.claude/skills/prisma-queries/# Prisma Queries
Query and mutate data using Prisma Client with type-safe operations.
## Client Setup
```typescript
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
// With logging
const prisma = new PrismaClient({
log: ['query', 'info', 'warn', 'error'],
})
```
## CRUD Operations
### Create
```typescript
// Create single record
const user = await prisma.user.create({
data: {
email: 'alice@example.com',
name: 'Alice',
},
})
// Create with relations
const user = await prisma.user.create({
data: {
email: 'alice@example.com',
posts: {
create: [
{ title: 'Post 1' },
{ title: 'Post 2' },
],
},
},
include: { posts: true },
})
// Create many
const count = await prisma.user.createMany({
data: [
{ email: 'alice@example.com' },
{ email: 'bob@example.com' },
],
skipDuplicates: true,
})
```
### Read
```typescript
// Find unique (by unique field)
const user = await prisma.user.findUnique({
where: { email: 'alice@example.com' },
})
// Find first matching
const user = await prisma.user.findFirst({
where: { name: { contains: 'Alice' } },
})
// Find many
const users = await prisma.user.findMany({
where: { role: 'ADMIN' },
orderBy: { createdAt: 'desc' },
take: 10,
skip: 0,
})
// Find or throw
const user = await prisma.user.findUniqueOrThrow({
where: { id: 1 },
})
```
### Update
```typescript
// Update single
const user = await prisma.user.update({
where: { id: 1 },
data: { name: 'New Name' },
})
// Update many
const count = await prisma.user.updateMany({
where: { role: 'USER' },
data: { verified: true },
})
// Upsert (update or create)
const user = await prisma.user.upsert({
where: { email: 'alice@example.com' },
update: { name: 'Alice Updated' },
create: { email: 'alice@example.com', name: 'Alice' },
})
```
### Delete
```typescript
// Delete single
const user = await prisma.user.delete({
where: { id: 1 },
})
// Delete many
const