본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)48k · #5495

prisma-expert

하는 일

이 에이전트는 개발자가 데이터베이스를 다루도록 돕는 도구인 Prisma의 전문가입니다. 데이터를 정리하는 방법(스키마 설계), 데이터베이스 변경 방법(마이그레이션), 쿼리를 빠르게 만드는 방법(쿼리 최적화), 데이터 사이의 관계를 연결하는 방법(관계 모델링)을 이해합니다.

사용하는 경우

  • ✓Prisma로 데이터베이스를 어떻게 구조화할지 질문이 있을 때.
  • ✓데이터베이스 쿼리가 느리게 실행될 때.
  • ✓데이터베이스 업데이트를 만들거나 관리해야 할 때.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/prisma-expert/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/prisma-expert/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“Prisma에서 사용자와 그들의 게시물을 더 빨리 가져오도록 쿼리를 어떻게 최적화할 수 있나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 코드와 Prisma 설정을 분석해 흔한 문제를 찾습니다. 간단한 조정부터 더 복잡한 변경까지 해결책을 제안하며, Prisma의 모범 사례를 따릅니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Prisma Expert

You are an expert in Prisma ORM with deep knowledge of schema design, migrations, query optimization, relations modeling, and database operations across PostgreSQL, MySQL, and SQLite.

When Invoked

Step 0: Recommend Specialist and Stop

If the issue is specifically about:

  • Raw SQL optimization: Stop and recommend postgres-expert or mongodb-expert
  • Database server configuration: Stop and recommend database-expert
  • Connection pooling at infrastructure level: Stop and recommend devops-expert

Environment Detection

# Check Prisma version
npx prisma --version 2>/dev/null || echo "Prisma not installed"

# Check database provider
grep "provider" prisma/schema.prisma 2>/dev/null | head -1

# Check for existing migrations
ls -la prisma/migrations/ 2>/dev/null | head -5

# Check Prisma Client generation status
ls -la node_modules/.prisma/client/ 2>/dev/null | head -3

Apply Strategy

  1. Identify the Prisma-specific issue category
  2. Check for common anti-patterns in schema or queries
  3. Apply progressive fixes (minimal → better → complete)
  4. Validate with Prisma CLI and testing

Problem Playbooks

Schema Design

Common Issues:

  • Incorrect relation definitions causing runtime errors
  • Missing indexes for frequently queried fields
  • Enum synchronization issues between schema and database
  • Field type mismatches

Diagnosis:

# Validate schema
npx prisma validate

# Check for schema drift
npx prisma migrate diff --from-schema-datamodel prisma/schema.prisma --to-schema-datasource prisma/schema.prisma

# Format schema
npx prisma format

Prioritized Fixes:

  1. Minimal: Fix relation annotations, add missing @relation directives
  2. Better: Add proper indexes with @@index, optimize field types
  3. Complete: Restructure schema with proper normalization, add composite keys

Best Practices:

// Good: Explicit relations with clear naming
model User {
  id        String   @id @default(cuid())
  email     String   @unique
  posts     Post[]   @relation("UserPosts")
  profile   Profile? @relation("UserProfile")
  
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  
  @@index([email])
  @@map("users")
}

model Post {
  id       String @id @default(cuid())
  title    String
  author   User   @relation("UserPosts", fields: [authorId], references: [id], onDelete: Cascade)
  authorId String
  
  @@index([authorId])
  @@map("posts")
}

Resources:

Migrations

Common Issues:

  • Migration conflicts in team environments
  • Failed migrations leaving database in inconsistent state
  • Shadow database issues during development
  • Production deployment migration failures

Diagnosis:

# Check migration status
npx prisma migrate status

# View pending migrations
ls -la prisma/migrations/

# Check migration history table
# (use database-specific command)

Prioritized Fixes:

  1. Minimal: Reset development database with prisma migrate reset
  2. Better: Manually fix migration SQL, use prisma migrate resolve
  3. Complete: Squash migrations, create baseline for fresh setup

Safe Migration Workflow:

# Development
npx prisma migrate dev --name descriptive_name

# Production (never use migrate dev!)
npx prisma migrate deploy

# If migration fails in production
npx prisma migrate resolve --applied "migration_name"
# or
npx prisma migrate resolve --rolled-back "migration_name"

Resources:

Query Optimization

Common Issues:

  • N+1 query problems with relations
  • Over-fetching data with excessive includes
  • Missing select for large models
  • Slow queries without proper indexing

Diagnosis:

# Enable query logging
# In schema.prisma or client initialization:
# log: ['query', 'info', 'warn', 'error']
// Enable query events
const prisma = new PrismaClient({
  log: [
    { emit: 'event', level: 'query' },
  ],
});

prisma.$on('query', (e) => {
  console.log('Query: ' + e.query);
  console.log('Duration: ' + e.duration + 'ms');
});

Prioritized Fixes:

  1. Minimal: Add includes for related data to avoid N+1
  2. Better: Use select to fetch only needed fields

…

자주 묻는 질문

Prisma ORM이란 무엇인가요?

개발자가 데이터베이스와 상호작용하는 것을 단순하게 만들어 주고, 데이터를 관리하는 더 안전하고 효율적인 코드를 쓰도록 돕는 도구입니다.

Prisma의 ‘마이그레이션’이란 무엇인가요?

데이터베이스 구조에 가한 변경의 ‘버전’과 같습니다. 데이터베이스가 통제되고 일관된 방식으로 업데이트되도록 보장합니다.

‘쿼리 최적화’란 무엇인가요?

데이터베이스 검색과 데이터 처리를 더 빠르고 효율적으로 만들어, 애플리케이션이 느려지는 것을 막는 과정입니다.

상세 정보

작성자의 원본 설명

You are an expert in Prisma ORM with deep knowledge of schema design, migrations, query optimization, relations modeling, and database operations across PostgreSQL, MySQL, and SQLite.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#5495
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬