Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
prisma avatar

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)
At a glance

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
From the docs

What prisma-client-api-model-queries says it does

Model Queries. Reference when using this Prisma feature
SKILL.md
createManyAndReturn
SKILL.md
npx skills add https://github.com/prisma/cursor-plugin --skill prisma-client-api-model-queries

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs16
repo stars8
Last updatedFebruary 9, 2026
Repositoryprisma/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

SKILL.mdMarkdownGitHub ↗

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 found

findFirst

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 users

Update 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 users

upsert

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 record

deleteMany

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

MethodReturns
findUniqueRecord \
findUniqueOrThrowRecord (throws if not found)
findFirstRecord \
findFirstOrThrowRecord (throws if not found)
findManyRecord[]
createRecord
createMany{ count: number }
createManyAndReturnRecord[]
updateRecord
updateMany{ count: number }
deleteRecord
deleteMany{ count: number }
countnumber
aggregateAggregate result
groupByGroup result[]

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.

Databasesdatabases

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.