Prisma Client API
Gives the agent a Prisma Client reference: CRUD and bulk methods, select and include, filters, nested relation writes, transactions, safe raw SQL and client extensions, with Prisma 7 examples. Use when writing or reviewing Prisma queries.
prisma-client-api- Author
- Prisma
- Source
- prisma/skills/prisma-client-api @ a6f1929
- License
- MIT · Copyright (c) 2025 Prisma
About this skill
What it does
The skill is a reference the agent reads while writing Prisma Client code. SKILL.md holds quick tables: model methods from findUnique to groupBy, query options (select, include, omit, cursor, distinct), filter and relation operators, client methods. The detail is in eight files in references/:
constructor.md:PrismaClientwith a driver adapter oraccelerateUrl, logging, SQL commenter plugins for tracing and query tags, default transaction options,queryPlanCacheMaxSize, and singleton patterns for Node and Next.js so hot reload does not open new connection pools.model-queries.md: CRUD, bulk writes,createManyAndReturn, atomic updates such asincrement, aggregation.query-options.md,filters.md,relations.md: shaping results, JSON, array and full-text filters, nested writes withconnectOrCreate,setanddisconnect.transactions.md: array versus interactive transactions, isolation levels, timeouts.raw-queries.md:$queryRawwith tagged templates,Prisma.sqlandPrisma.join, why theUnsafevariants invite SQL injection, BigInt and date handling.client-methods.md:$connect,$disconnect,$on,$extends, andsatisfiesfor typed query fragments.
The examples are in Prisma 7 form: the prisma-client generator, an import from ../generated/client, an adapter such as @prisma/adapter-pg. The skill's version field reads 7.9.1. It runs nothing and needs no CLI or keys.
When to use it, and when not
Use it when writing or reviewing Prisma Client queries: filters, relations, pagination, transactions, raw SQL, extensions.
It does not set up Prisma or the database connection and does not touch schema or migrations. For a Prisma 8 app, Prisma ORM setup points to the prisma-8 skill shipped with the ORM package, which owns Prisma 8 queries.
How to run it
The install command below puts the whole folder in place. The agent picks the skill up when Prisma queries are being written; to call it yourself:
- Claude Code:
/prisma-client-api, or ask for the skill by name. - Codex:
$prisma-client-api. - Cursor: type
/in the Agent chat and pickprisma-client-api.
Example: /prisma-client-api Write a transfer between two accounts as an interactive transaction that fails when the balance goes below zero.
How it differs from similar skills
SQL query review checks a finished query for wrong results, N+1, missing indexes and injection, using the real EXPLAIN plan; this skill tells the agent how to write the query in Prisma's API. Run the review when a Prisma query turns out slow. Prisma CLI covers generating the client and migrations, and Postgres best practices by Supabase the database side: indexes, locks, pooling.
Install
Run one command — it saves SKILL.md and the files it uses into your agent's skills folder. Claude Code and Codex pick up a new skill without a restart; if it does not show up, restart the agent.
curl -fsSL --create-dirs -o ~/.claude/skills/prisma-client-api/SKILL.md https://anymodel.org/en/skills/prisma/prisma-client-api/SKILL.md -o ~/.claude/skills/prisma-client-api/LICENSE https://anymodel.org/en/skills/prisma/prisma-client-api/LICENSE -o ~/.claude/skills/prisma-client-api/references/client-methods.md https://anymodel.org/en/skills/prisma/prisma-client-api/references/client-methods.md -o ~/.claude/skills/prisma-client-api/references/constructor.md https://anymodel.org/en/skills/prisma/prisma-client-api/references/constructor.md -o ~/.claude/skills/prisma-client-api/references/filters.md https://anymodel.org/en/skills/prisma/prisma-client-api/references/filters.md -o ~/.claude/skills/prisma-client-api/references/model-queries.md https://anymodel.org/en/skills/prisma/prisma-client-api/references/model-queries.md -o ~/.claude/skills/prisma-client-api/references/query-options.md https://anymodel.org/en/skills/prisma/prisma-client-api/references/query-options.md -o ~/.claude/skills/prisma-client-api/references/raw-queries.md https://anymodel.org/en/skills/prisma/prisma-client-api/references/raw-queries.md -o ~/.claude/skills/prisma-client-api/references/relations.md https://anymodel.org/en/skills/prisma/prisma-client-api/references/relations.md -o ~/.claude/skills/prisma-client-api/references/transactions.md https://anymodel.org/en/skills/prisma/prisma-client-api/references/transactions.md
curl -fsSL --create-dirs -o ~/.agents/skills/prisma-client-api/SKILL.md https://anymodel.org/en/skills/prisma/prisma-client-api/SKILL.md -o ~/.agents/skills/prisma-client-api/LICENSE https://anymodel.org/en/skills/prisma/prisma-client-api/LICENSE -o ~/.agents/skills/prisma-client-api/references/client-methods.md https://anymodel.org/en/skills/prisma/prisma-client-api/references/client-methods.md -o ~/.agents/skills/prisma-client-api/references/constructor.md https://anymodel.org/en/skills/prisma/prisma-client-api/references/constructor.md -o ~/.agents/skills/prisma-client-api/references/filters.md https://anymodel.org/en/skills/prisma/prisma-client-api/references/filters.md -o ~/.agents/skills/prisma-client-api/references/model-queries.md https://anymodel.org/en/skills/prisma/prisma-client-api/references/model-queries.md -o ~/.agents/skills/prisma-client-api/references/query-options.md https://anymodel.org/en/skills/prisma/prisma-client-api/references/query-options.md -o ~/.agents/skills/prisma-client-api/references/raw-queries.md https://anymodel.org/en/skills/prisma/prisma-client-api/references/raw-queries.md -o ~/.agents/skills/prisma-client-api/references/relations.md https://anymodel.org/en/skills/prisma/prisma-client-api/references/relations.md -o ~/.agents/skills/prisma-client-api/references/transactions.md https://anymodel.org/en/skills/prisma/prisma-client-api/references/transactions.md
foreach ($f in 'SKILL.md','LICENSE','references/client-methods.md','references/constructor.md','references/filters.md','references/model-queries.md','references/query-options.md','references/raw-queries.md','references/relations.md','references/transactions.md') { $p = Join-Path "$HOME\.claude\skills\prisma-client-api" $f; New-Item -ItemType Directory -Force (Split-Path $p) | Out-Null; Invoke-WebRequest "https://anymodel.org/en/skills/prisma/prisma-client-api/$f" -UseBasicParsing -OutFile $p }foreach ($f in 'SKILL.md','LICENSE','references/client-methods.md','references/constructor.md','references/filters.md','references/model-queries.md','references/query-options.md','references/raw-queries.md','references/relations.md','references/transactions.md') { $p = Join-Path "$HOME\.agents\skills\prisma-client-api" $f; New-Item -ItemType Directory -Force (Split-Path $p) | Out-Null; Invoke-WebRequest "https://anymodel.org/en/skills/prisma/prisma-client-api/$f" -UseBasicParsing -OutFile $p }Any other agent: save the file into its skills folder, or give it the link to the file: https://anymodel.org/en/skills/prisma/prisma-client-api/SKILL.md
SKILL.md
Prisma Client API Reference
Complete API reference for Prisma Client. This skill provides guidance on model queries, filtering, relations, and client methods for current Prisma projects.
When to Apply
Reference this skill when:
- Writing database queries with Prisma Client
- Performing CRUD operations (create, read, update, delete)
- Filtering and sorting data
- Working with relations
- Using transactions
- Configuring client options
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Client Construction | HIGH | constructor |
| 2 | Model Queries | CRITICAL | model-queries |
| 3 | Query Shape | HIGH | query-options |
| 4 | Filtering | HIGH | filters |
| 5 | Relations | HIGH | relations |
| 6 | Transactions | CRITICAL | transactions |
| 7 | Raw SQL | CRITICAL | raw-queries |
| 8 | Client Methods | MEDIUM | client-methods |
Quick Reference
constructor-PrismaClientsetup, adapter wiring, logging, and SQL commenter pluginsmodel-queries- CRUD operations and bulk operationsquery-options-select,include,omit, sort, paginationfilters- scalar and logical filter operatorsrelations- relation reads and nested writestransactions- array and interactive transaction patternsraw-queries-$queryRawand$executeRawsafetyclient-methods- lifecycle methods, extensions, andsatisfiespatterns forprisma-client
Client Instantiation
import { PrismaClient } from '../generated/client'
import { PrismaPg } from '@prisma/adapter-pg'
const adapter = new PrismaPg({
connectionString: process.env.DATABASE_URL
})
const prisma = new PrismaClient({ adapter })
Model Query Methods
| Method | Description |
|---|---|
findUnique() |
Find one record by unique field |
findUniqueOrThrow() |
Find one or throw error |
findFirst() |
Find first matching record |
findFirstOrThrow() |
Find first or throw error |
findMany() |
Find multiple records |
create() |
Create a new record |
createMany() |
Create multiple records |
createManyAndReturn() |
Create multiple and return them |
update() |
Update one record |
updateMany() |
Update multiple records |
updateManyAndReturn() |
Update multiple and return them |
upsert() |
Update or create record |
delete() |
Delete one record |
deleteMany() |
Delete multiple records |
count() |
Count matching records |
aggregate() |
Aggregate values (sum, avg, etc.) |
groupBy() |
Group and aggregate |
Query Options
| Option | Description |
|---|---|
where |
Filter conditions |
select |
Fields to include |
include |
Relations to load |
omit |
Fields to exclude |
orderBy |
Sort order |
take |
Limit results |
skip |
Skip results (pagination) |
cursor |
Cursor-based pagination |
distinct |
Unique values only |
Client Methods
| Method | Description |
|---|---|
$connect() |
Explicitly connect to database |
$disconnect() |
Disconnect from database |
$transaction() |
Execute transaction |
$queryRaw() |
Execute raw SQL query |
$executeRaw() |
Execute raw SQL command |
$on() |
Subscribe to events |
$extends() |
Add extensions |
Quick Examples
Find records
// Find by unique field
const user = await prisma.user.findUnique({
where: { email: '[email protected]' }
})
// Find with filter
const users = await prisma.user.findMany({
where: { role: 'ADMIN' },
orderBy: { createdAt: 'desc' },
take: 10
})
Create records
const user = await prisma.user.create({
data: {
email: '[email protected]',
name: 'Alice',
posts: {
create: { title: 'Hello World' }
}
},
include: { posts: true }
})
Update records
const user = await prisma.user.update({
where: { id: 1 },
data: { name: 'Alice Smith' }
})
Delete records
await prisma.user.delete({
where: { id: 1 }
})
Transactions
const [user, post] = await prisma.$transaction([
prisma.user.create({ data: { email: '[email protected]' } }),
prisma.post.create({ data: { title: 'Hello', authorId: 1 } })
])
Rule Files
Detailed API documentation:
references/constructor.md - PrismaClient constructor options
references/model-queries.md - CRUD operations
references/query-options.md - select, include, omit, where, orderBy
references/filters.md - Filter conditions and operators
references/relations.md - Relation queries and nested operations
references/transactions.md - Transaction API
references/raw-queries.md - $queryRaw, $executeRaw
references/client-methods.md - $connect, $disconnect, $on, $extends
Filter Operators
| Operator | Description |
|---|---|
equals |
Exact match |
not |
Not equal |
in |
In array |
notIn |
Not in array |
lt, lte |
Less than |
gt, gte |
Greater than |
contains |
String contains |
startsWith |
String starts with |
endsWith |
String ends with |
mode |
Case sensitivity |
Relation Filters
| Operator | Description |
|---|---|
some |
At least one related record matches |
every |
All related records match |
none |
No related records match |
is |
Related record matches (1-to-1) |
isNot |
Related record doesn't match |
Resources
How to Use
Pick the category from the table above, then open the matching reference file for implementation details and examples.
Connect through AnyModel API
This skill runs on whatever model your agent uses. Point Claude Code, Codex or Cursor at AnyModel to run it on Claude, GPT, Gemini and more with one key — pay per token, no subscription.
AnyModel