prisma-client-api

Provides Prisma Client API reference for database queries, filters, relations, and transactions.

Updated Jul 1, 2026
One-click install
npx skills add https://github.com/son1cleo/databrief --skill prisma-client-api-son1cleo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-client-api
Source: https://github.com/son1cleo/databrief/tree/main/frontend/.windsurf/skills/prisma-client-api
Command: npx skills add https://github.com/son1cleo/databrief --skill prisma-client-api-son1cleo

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. This Skill gives you an on-demand reference so you can write accurate database queries without leaving your workflow or guessing API syntax. ## Core Features & Use Cases - Complete Query Reference: Covers all model query methods including findUnique, findMany, create, update, upsert, delete, count, aggregate, and groupBy with return types. - Filtering and Relations: Documents scalar and logical filter operators, relation filters (some, every, none, is), nested writes, and connect/disconnect patterns. - Transactions and Raw SQL: Explains sequential and interactive transactions, isolation levels, and safe $queryRaw/$executeRaw usage with SQL injection prevention. - Use Case: When building a Next.js API route that needs paginated, filtered user records with related posts in a transaction, consult this Skill to get the exact Prisma Client syntax and best practices. ## 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 write Prisma Client queries with filters?

Use the where clause with filter operators like equals, contains, gt, lt, in, and logical operators AND, OR, NOT. For example, prisma.user.findMany({ where: { email: { contains: '@prisma.io' }, role: 'ADMIN' } }) filters by multiple conditions.

How to use transactions in Prisma Client?

Prisma supports sequential transactions via prisma.$transaction([op1, op2]) and interactive transactions via prisma.$transaction(async (tx) => {...}). Interactive transactions allow dependent operations and conditional logic, with options for maxWait, timeout, and isolationLevel.

What is the difference between findUnique and findFirst in Prisma?

findUnique locates a record by a unique field or composite unique key, while findFirst returns the first record matching any filter condition. Both have OrThrow variants that raise an error when no record is found.

Does Prisma Client support raw SQL queries safely?

Yes, use $queryRaw and $executeRaw with tagged template literals, which automatically parameterize values to prevent SQL injection. Avoid $queryRawUnsafe with string concatenation, and use Prisma.sql and Prisma.join for dynamic query construction.

How do I include related records in a Prisma query?

Use the include option to load relations, or select for fine-grained field control. Both support nesting, filtering with where, ordering, and pagination on relations, plus _count for relation counts.

When should I use select versus omit in Prisma queries?

Use select to explicitly choose which fields to return, and omit to exclude specific fields like passwords while returning everything else. Note that select and omit cannot be used together in the same query.