prisma-client-api

Reference Prisma Client API for model queries, filters, relations, and transactions.

Updated Jul 28, 2026
One-click install
npx skills add https://github.com/ArvindIyer1/prediction-market-project --skill prisma-client-api-arvindiyer1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-client-api
Source: https://github.com/ArvindIyer1/prediction-market-project/tree/main/packages/.windsurf/skills/prisma-client-api
Command: npx skills add https://github.com/ArvindIyer1/prediction-market-project --skill prisma-client-api-arvindiyer1

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing correct Prisma Client queries requires knowing dozens of methods, filter operators, and transaction patterns, and mistakes lead to runtime errors or inefficient database access. ## Core Features & Use Cases - Model Query Reference: Covers CRUD methods like findUnique, findMany, create, update, upsert, delete, plus aggregation and groupBy operations. - Filtering and Relations: Documents scalar and logical filter operators, relation filters (some, every, none, is), and nested writes for create, connect, and disconnect. - Transactions and Raw SQL: Explains sequential and interactive $transaction patterns, isolation levels, and safe $queryRaw/$executeRaw usage with SQL injection prevention. - Use Case: When building a Next.js API route that paginates users, filters by role, and includes post counts, consult this skill to compose the correct findMany call with where, orderBy, take, skip, and _count options. ## Quick Start Ask the AI to write a Prisma query that finds all published posts by a specific author ordered by creation date with pagination.

Frequently Asked Questions about prisma-client-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I filter records with Prisma Client findMany?

Use the where option with filter operators like equals, contains, gt, lt, in, and logical operators AND, OR, NOT. For example, where: { role: 'ADMIN', email: { contains: '@prisma.io' } } returns admins with matching emails.

How to use transactions in Prisma Client?

Use prisma.$transaction with an array for sequential operations or an async callback for interactive transactions with dependent logic. Interactive transactions accept options like maxWait, timeout, and isolationLevel such as Serializable.

What is the difference between select and include in Prisma?

select returns only the specified scalar fields, while include adds related records to the result. You cannot combine select and omit on the same query, but select and include can be nested within relation options.

Does Prisma Client support raw SQL queries safely?

Yes, $queryRaw and $executeRaw use tagged templates that parameterize interpolated values, preventing SQL injection. Avoid $queryRawUnsafe with string concatenation, and use Prisma.raw only for trusted identifiers like column names.

Why does my Prisma query fail with a unique constraint error?

Error code P2002 indicates a unique constraint violation, typically from create or update with a duplicate unique field. Use upsert to update-or-create atomically, or catch the error inside a transaction to handle it gracefully.