prisma-client-api

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

Updated Jun 9, 2026
One-click install
npx skills add https://github.com/dlptho356/TTTN --skill prisma-client-api-dlptho356
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-client-api
Source: https://github.com/dlptho356/TTTN/tree/main/DATN/backend/.windsurf/skills/prisma-client-api
Command: npx skills add https://github.com/dlptho356/TTTN --skill prisma-client-api-dlptho356

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 all CRUD methods including findUnique, findMany, createManyAndReturn, upsert, aggregate, and groupBy with return types. - Filtering and Relations: Documents scalar operators, logical operators (AND/OR/NOT), relation filters (some/every/none), and nested writes. - Transactions and Raw SQL: Explains sequential and interactive $transaction patterns, isolation levels, and safe $queryRaw/$executeRaw usage. - Use Case: When building a NestJS or Next.js backend endpoint that paginates users with filtered relations, consult this skill to write the correct findMany call with cursor pagination and included counts. ## Quick Start Ask the AI to write a Prisma query that finds all published posts with their authors, ordered by creation date and paginated by cursor.

Frequently Asked Questions about prisma-client-api

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

FAQPage Schema
How do I write a Prisma findMany query with filters and pagination?

Use prisma.model.findMany with where for filters, orderBy for sorting, and take/skip or cursor for pagination. For example, pass where: { role: 'ADMIN' }, orderBy: { createdAt: 'desc' }, and take: 10 to get the ten newest admins.

How do I use Prisma transactions for multiple operations?

Use prisma.$transaction with an array for independent sequential operations, or pass an async function for interactive transactions where later operations depend on earlier results. Interactive transactions accept maxWait, timeout, and isolationLevel options.

What is the difference between select and include in Prisma?

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

Is Prisma $queryRaw safe from SQL injection?

Yes, $queryRaw with tagged template literals parameterizes interpolated values automatically, preventing injection. Avoid $queryRawUnsafe with string concatenation of user input, and use Prisma.raw only for trusted identifiers like column names.

How do I filter Prisma queries by related records?

Use relation filters some, every, and none for to-many relations, and is/isNot for to-one relations. For example, where: { posts: { some: { published: true } } } returns users having at least one published post.

When should I use upsert instead of create in Prisma?

Use upsert when a record may already exist and you want to update it or create it otherwise, keyed by a unique field. It takes where, update, and create arguments, avoiding separate existence checks and race conditions.