
Prisma Client Api Model Queries
- 16 installs
- 8 repo stars
- Updated February 9, 2026
- prisma/cursor-plugin
prisma-client-api-model-queries references Prisma Client model CRUD query APIs.
About
The prisma-client-api-model-queries skill is a reference for Prisma Client model-level queries including findMany, findUnique, create, update, delete, upsert, and batch helpers such as createMany and createManyAndReturn. It documents filter objects, select and include relation loading, ordering, pagination with skip and take, and aggregate counts. Examples show typed results, handling nullable unique fields, and returning arrays from batch creates. Guidance covers when to use transactions for multi-write consistency and how to structure where clauses for compound unique constraints. The skill helps agents choose the correct query method for CRUD operations without inventing unsupported APIs. It also explains deleteMany and updateMany batch patterns, cursor-based pagination for large tables, and distinct filters when deduplicating results. Relation writes use nested create and connect syntax with explicit include plans to avoid N+1 fetches in service layers. Pair with prisma-cli-generate after schema changes and prisma-cli-dev for local database workflows during iterative query development.
- Covers CRUD and batch Prisma Client model queries.
- Documents select, include, filter, and pagination patterns.
- Shows createManyAndReturn and upsert examples.
- Guides relation loading and compound unique filters.
- Pairs with generate and dev skills for schema iteration.
Prisma Client Api Model Queries by the numbers
- 16 all-time installs (skills.sh)
- Ranked #585 of 911 Databases skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
prisma-client-api-model-queries capabilities & compatibility
- Capabilities
- model query method reference · filter and include patterns · batch operation examples
- Works with
- postgres · mysql
- Use cases
- database · api development
- IDEs
- vscode · cursor ide
What prisma-client-api-model-queries says it does
Model Queries. Reference when using this Prisma feature
createManyAndReturn
npx skills add https://github.com/prisma/cursor-plugin --skill prisma-client-api-model-queriesAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 16 |
|---|---|
| repo stars | ★ 8 |
| Last updated | February 9, 2026 |
| Repository | prisma/cursor-plugin ↗ |
How do I write a Prisma findMany with relations included?
Write Prisma Client model queries for create, read, update, delete, and batch operations.
Who is it for?
Developers writing Prisma data access in TypeScript services.
Skip if: Skip for raw SQL migrations without Prisma Client usage.
When should I use this skill?
User asks about Prisma model queries, createMany, or relation includes.
What you get
Correct Prisma Client query with filters, includes, and typed results.
Files
Model Queries
CRUD operations for your Prisma models.
Read Operations
findUnique
Find a single record by unique field:
const user = await prisma.user.findUnique({
where: { id: 1 }
})
const user = await prisma.user.findUnique({
where: { email: 'alice@prisma.io' }
})With composite unique key
// Model with @@unique([firstName, lastName])
const user = await prisma.user.findUnique({
where: {
firstName_lastName: {
firstName: 'Alice',
lastName: 'Smith'
}
}
})findUniqueOrThrow
Same as findUnique but throws if not found:
const user = await prisma.user.findUniqueOrThrow({
where: { id: 1 }
})
// Throws PrismaClientKnownRequestError if not foundfindFirst
Find first matching record:
const user = await prisma.user.findFirst({
where: { role: 'ADMIN' },
orderBy: { createdAt: 'desc' }
})findFirstOrThrow
const user = await prisma.user.findFirstOrThrow({
where: { role: 'ADMIN' }
})findMany
Find multiple records:
const users = await prisma.user.findMany({
where: { role: 'USER' },
orderBy: { name: 'asc' },
take: 10,
skip: 0
})Create Operations
create
Create a single record:
const user = await prisma.user.create({
data: {
email: 'alice@prisma.io',
name: 'Alice'
}
})With relations
const user = await prisma.user.create({
data: {
email: 'alice@prisma.io',
posts: {
create: [
{ title: 'First Post' },
{ title: 'Second Post' }
]
}
},
include: { posts: true }
})createMany
Create multiple records:
const result = await prisma.user.createMany({
data: [
{ email: 'alice@prisma.io', name: 'Alice' },
{ email: 'bob@prisma.io', name: 'Bob' }
],
skipDuplicates: true // Skip records with duplicate unique fields
})
// Returns { count: 2 }createManyAndReturn
Create multiple and return them:
const users = await prisma.user.createManyAndReturn({
data: [
{ email: 'alice@prisma.io', name: 'Alice' },
{ email: 'bob@prisma.io', name: 'Bob' }
]
})
// Returns array of created usersUpdate Operations
update
Update a single record:
const user = await prisma.user.update({
where: { id: 1 },
data: { name: 'Alice Smith' }
})Atomic operations
const post = await prisma.post.update({
where: { id: 1 },
data: {
views: { increment: 1 },
likes: { decrement: 1 },
score: { multiply: 2 },
rating: { divide: 2 },
version: { set: 5 }
}
})updateMany
Update multiple records:
const result = await prisma.user.updateMany({
where: { role: 'USER' },
data: { verified: true }
})
// Returns { count: 42 }updateManyAndReturn
const users = await prisma.user.updateManyAndReturn({
where: { role: 'USER' },
data: { verified: true }
})
// Returns array of updated usersupsert
Update or create:
const user = await prisma.user.upsert({
where: { email: 'alice@prisma.io' },
update: { name: 'Alice Smith' },
create: { email: 'alice@prisma.io', name: 'Alice' }
})Delete Operations
delete
Delete a single record:
const user = await prisma.user.delete({
where: { id: 1 }
})
// Returns deleted recorddeleteMany
Delete multiple records:
const result = await prisma.user.deleteMany({
where: { role: 'GUEST' }
})
// Returns { count: 5 }
// Delete all
const result = await prisma.user.deleteMany({})Aggregation Operations
count
const count = await prisma.user.count({
where: { role: 'ADMIN' }
})aggregate
const result = await prisma.post.aggregate({
_avg: { views: true },
_sum: { views: true },
_min: { views: true },
_max: { views: true },
_count: { _all: true }
})groupBy
const groups = await prisma.user.groupBy({
by: ['country'],
_count: { _all: true },
_avg: { age: true },
having: {
age: { _avg: { gt: 30 } }
}
})Return Types
| Method | Returns |
|---|---|
findUnique | Record \ |
findUniqueOrThrow | Record (throws if not found) |
findFirst | Record \ |
findFirstOrThrow | Record (throws if not found) |
findMany | Record[] |
create | Record |
createMany | { count: number } |
createManyAndReturn | Record[] |
update | Record |
updateMany | { count: number } |
delete | Record |
deleteMany | { count: number } |
count | number |
aggregate | Aggregate result |
groupBy | Group result[] |
{
"name": "prisma-client-api-model-queries",
"version": "7.0.0",
"author": "prisma",
"license": "MIT"
}Related skills
FAQ
What does prisma-client-api-model-queries do?
prisma-client-api-model-queries references Prisma Client model CRUD query APIs.
When should I use prisma-client-api-model-queries?
User asks about Prisma model queries, createMany, or relation includes.
Is this skill safe to install?
Review the Security Audits panel on this page before installing in production.