prisma-expert
Helps your agent work with databases using Prisma. It understands how to organize information and make efficient queries.
What it does
This agent is an expert in Prisma, a tool that helps developers work with databases. It understands how to organize data (schema design), how to make database changes (migrations), how to make queries faster (query optimization), and how to connect different parts of your data (relations modeling).
When to use it
- ✓When you have questions about how to structure your database with Prisma.
- ✓If your database queries are running slowly.
- ✓When needing to create or manage your database updates.
Example of what to ask your AI
“How can I optimize my queries to fetch users and their posts faster in Prisma?”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
The agent analyzes your code and Prisma configurations to identify common issues. It suggests fixes, ranging from simple adjustments to more complex changes, following Prisma's best practices.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add sickn33/agentic-awesome-skills --skill prisma-expertOr download just the file:
curl -L https://raw.githubusercontent.com/sickn33/agentic-awesome-skills/main/plugins/agentic-awesome-skills-claude/skills/prisma-expert/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from 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
- Identify the Prisma-specific issue category
- Check for common anti-patterns in schema or queries
- Apply progressive fixes (minimal → better → complete)
- 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:
- Minimal: Fix relation annotations, add missing
@relationdirectives - Better: Add proper indexes with
@@index, optimize field types - 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:
- https://www.prisma.io/docs/concepts/components/prisma-schema
- https://www.prisma.io/docs/concepts/components/prisma-schema/relations
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:
- Minimal: Reset development database with
prisma migrate reset - Better: Manually fix migration SQL, use
prisma migrate resolve - 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:
- https://www.prisma.io/docs/concepts/components/prisma-migrate
- https://www.prisma.io/docs/guides/deployment/deploy-database-changes
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:
- Minimal: Add includes for related data to avoid N+1
- Better: Use select to fetch only needed fields
…
FAQ
What is Prisma ORM?
Prisma ORM is a tool that simplifies database interactions for developers, helping them write more secure and efficient code for managing data.
What are 'migrations' in Prisma?
Migrations are like 'versions' of changes made to your database structure. They ensure your database is updated in a controlled and consistent manner.
What does 'query optimization' mean?
Query optimization is the process of making database searches and data manipulations faster and more efficient, preventing application slowdowns.
Details
Original description by the author
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.
Popularity
- GitHub stars
- 48k
- Ranking position
- #3881
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
00-andruia-consultant
Helps your agent start or improve AI projects. It analyzes code, suggests tools, and creates action plans in Spanish.
sickn33/agentic-awesome-skills
007
Lets your agent perform security audits and threat modeling. It's useful for protecting projects against attacks and vulnerabilities.
sickn33/agentic-awesome-skills
10-andruia-skill-smith
Helps your agent create or improve AI tools. It defines how tools work, writes documentation, and validates the structure.
sickn33/agentic-awesome-skills
20-andruia-niche-intelligence
Lets your agent create a summary about a specific industry. It's useful for understanding the context, rules, usage patterns, and risks of a project, using reliable sources.
sickn33/agentic-awesome-skills
Similar skills
api-connector-builder
Has your agent build new API connections following the existing pattern. Use when you need to add one more integration without creating a new way of doing things.
affaan-m/ECC
api-design
Helps your agent design REST APIs following best practices. It's useful for defining how APIs communicate, how errors are shown, and how to organize data.
affaan-m/ECC
backend-patterns
Helps your agent with server-side architecture patterns and database optimization. It's useful for building or reviewing code that runs on the server.
affaan-m/ECC