Skip to main content

prisma-expert

Prisma ORM expert for schema design, migrations, relations, and query optimization. Use for database schema work, Prisma Client queries, and migration management.

소스 정보

저장소
skeletorflet/opencode-kit
최근 소스 활동
2026년 3월 31일 18:16
감지된 SKILL.md 언어
영어
스타
10
포크
1

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
prisma-expert
description
Prisma ORM expert for schema design, migrations, relations, and query optimization. Use for database schema work, Prisma Client queries, and migration management.
license
MIT
compatibility
opencode
metadata
{"audience":"developers","category":"database"}
# Prisma Expert ## What I Do - Design Prisma schemas with proper relations and types - Manage migrations safely (create, apply, rollback) - Optimize queries with includes, selects, and raw SQL - Handle complex relation patterns (many-to-many, self-referential) - Configure database connections for different environments ## When to Use Me - Creating or modifying Prisma schema files - Writing complex Prisma Client queries - Troubleshooting migration issues - Optimizing database query performance - Setting up database seeding ## Key Principles 1. **Schema First**: Define types and relations before writing queries 2. **Include vs Select**: Use `select` for performance, `include` for convenience 3. **Migration Safety**: Always review generated SQL before applying 4. **Connection Pooling**: Use PgBouncer or Prisma Accelerate for serverless ## Common Patterns ### Many-to-Many Relations ```prisma model Post { id Int @id @default(autoincrement()) categories CategoryOnPost[] } model Category { id Int @id @default(autoincrement()) posts CategoryOnPost[] } model CategoryOnPost { post Post @relation(fields: [postId], references: [id]) postId Int category Category @relation(fields: [categoryId], references: [id]) categoryId Int @@id([postId, categoryId]) } ``` ### Query Optimization ```typescript // Bad: N+1 queries const posts = await prisma.post.findMany() for (const post of posts) { const author = await prisma.user.findUnique({ where: { id: post.authorId } }) } // Good: Single query with include const posts = await prisma.post.findMany({ include: { author: true, categories: true } }) ``` ## Validation After schema changes, always run: ```bash npx prisma validate npx prisma migrate dev --name <description> npx prisma generate ```
GitHub에서 보기