prisma-client-api
prisma/skills
모델 쿼리, 필터, 연산자 및 클라이언트 메서드를 다루는 Prisma Client API 참조 문서입니다. 데이터베이스 쿼리를 작성하거나, CRUD 작업을 수행하거나, 데이터를 필터링하거나, Prisma Client를 구성할 때 사용하십시오. “prisma query”, “findMany”, “create”, “update”, “delete”, “$transaction”에 대한 트리거.
...모든 것을 확장하십시오prisma-client-api 소개
prisma-client-api 스킬은 Prisma Client를 사용하여 데이터베이스와 상호작용하는 데 필요한 포괄적인 참고 자료를 제공합니다. 이 스킬은 Prisma 프로젝트 내에서 쿼리 작성, CRUD 작업 수행, 필터 적용, 관계 관리 및 트랜잭션 처리를 간소화합니다. 이 스킬은 클라이언트 인스턴스화, 모델 쿼리, 쿼리 옵션 및 원시 SQL 실행에 대한 상세한 지침을 제공함으로써, 개발자가 관계형 데이터베이스를 다룰 때 오류를 줄이고 효율성을 높일 수 있도록 돕습니다. 특히 쿼리가 올바르게 구성되었는지 확인하고, 중첩 쓰기나 트랜잭션과 같은 고급 작업이 안전하고 효과적으로 처리되도록 하는 데 유용합니다.
이 스킬은 findUnique, findMany, create, update, delete, upsert와 같은 모델 쿼리 메서드와 count, aggregate, groupBy와 같은 집계 함수를 포함한 광범위한 기능을 다룹니다. 또한 쿼리 옵션에 대한 포괄적인 지원을 제공하여, 개발자가 필터링, 선택, 포함, 생략, 정렬, 페이지 분할 및 고유 값 적용을 수행할 수 있도록 합니다. 라이프사이클 관리, 이벤트 구독, 원시 SQL 실행 및 클라이언트 확장을 위한 Prisma Client 메서드도 포함되어 있습니다. 이 스킬은 원시 SQL 쿼리의 안전한 실행을 보장하며, 데이터 무결성을 유지하기 위해 배열 기반 및 대화형 트랜잭션 사용에 대한 지침을 제공합니다.
대상 사용자는 Prisma를 통해 데이터베이스와 효율적으로 상호작용해야 하는 JavaScript 또는 TypeScript를 사용하는 백엔드 개발자, 데이터베이스 관리자, 풀스택 엔지니어입니다. 대표적인 사용 사례로는 정확한 데이터 검색, 조작 및 집계가 중요한 웹 애플리케이션, API 및 마이크로서비스 구축이 있습니다. 또한 프로덕션 환경에서 복잡한 관계형 로직을 구현하거나 일괄 처리를 수행할 때 일관된 쿼리 패턴과 모범 사례에 대한 표준 참조 자료가 필요한 팀에게도 적합합니다.
자주 묻는 질문
사용자 정의 어댑터를 사용하여 Prisma Client를 인스턴스화하려면 어떻게 해야 합니까?
제공된 TypeScript 예제에서 볼 수 있듯이, PrismaClient와 해당 어댑터를 임포트한 다음, 어댑터 구성을 클라이언트 생성자에 전달하여 Prisma Client를 인스턴스화할 수 있습니다.
Prisma Client는 어떤 데이터베이스 작업을 지원하나요?
Prisma Client는 findUnique, findMany, create, createMany, update, updateMany, upsert, delete, deleteMany를 포함한 모든 CRUD 작업을 지원합니다. 또한 집계 및 그룹화 메서드도 지원합니다.
Prisma Client는 트랜잭션을 처리할 수 있나요?
네, Prisma Client는 $transaction 메서드를 사용하여 배열 기반 트랜잭션과 대화형 트랜잭션을 모두 지원하므로, 단일 트랜잭션 내에서 여러 쿼리를 안전하게 실행할 수 있습니다.
원시 SQL이 지원되며 안전하게 사용할 수 있나요?
Prisma Client는 원시 SQL 쿼리를 실행하기 위한 $queryRaw 및 $executeRaw 메서드를 제공합니다. SQL 인젝션을 방지하기 위해 이 메서드들을 신중하게 사용해야 하며, 문서에는 안전한 사용법에 대한 지침이 포함되어 있습니다.
이 Prisma Client API 스킬을 사용하려면 어떤 조건이 필요한가요?
생성된 클라이언트가 포함된 Prisma 프로젝트, 지원되는 데이터베이스, 그리고 적절한 어댑터가 필요합니다. 클라이언트 인스턴스 생성 및 쿼리 실행을 위해서는 TypeScript 또는 JavaScript 환경이 필요합니다.
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 fieldconst user = await prisma.user.findUnique({ where: { email: '[email protected]' }})// Find with filterconst 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 optionsreferences/model-queries.md - CRUD operationsreferences/query-options.md - select, include, omit, where, orderByreferences/filters.md - Filter conditions and operatorsreferences/relations.md - Relation queries and nested operationsreferences/transactions.md - Transaction APIreferences/raw-queries.md - $queryRaw, $executeRawreferences/client-methods.md - $connect, $disconnect, $on, $extendsFilter 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
- Prisma Client API Reference
- CRUD Operations
- Filtering and Sorting
How to Use
Pick the category from the table above, then open the matching reference file for implementation details and examples.
모든 파일
9개 파일prisma-client-api 설치
스킬 파일을 다운로드하여 .claude/skills/ 디렉터리에 압축을 풀어주세요.
ZIP 다운로드저장소를 클론하고 스킬 파일을 프로젝트에 복사하세요.
git clone https://github.com/prisma/skills/blob/main/prisma-client-api/SKILL.md # Copy SKILL.md to your .claude/skills/ directory
복사





집
