
Prisma Expert
Diagnose and fix Prisma schema, migration, and Client query issues across PostgreSQL, MySQL, and SQLite with CLI-backed validation steps.
Overview
Prisma Expert is an agent skill for the Build phase that troubleshoots Prisma schema, migrations, relations, and Client queries with staged fixes and CLI validation.
Install
npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill prisma-expertWhat is this skill?
- Step 0 escalation: raw SQL, DB server config, and infra pooling → postgres-expert, database-expert, or devops-expert
- Environment detection commands for Prisma version, provider, migrations folder, and generated client
- Progressive fix ladder: minimal → better → complete with CLI validation
- Problem playbooks for schema design anti-patterns and relation modeling
- 4-step apply strategy: categorize issue, check anti-patterns, progressive fixes, validate with Prisma CLI
Adoption & trust: 3.6k installs on skills.sh; 40.1k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your Prisma schema or migrations are failing and chat advice keeps mixing ORM fixes with DBA and DevOps concerns you do not need yet.
Who is it for?
Indie devs on Node/TypeScript stacks who own prisma/schema.prisma, migrations, and query bugs end to end.
Skip if: Pure Postgres query planner tuning, MongoDB-specific modeling, or Kubernetes-level pooler setup—those are explicit stop-and-escalate cases in the skill.
When should I use this skill?
Prisma-specific schema, migration, relation, or Client query issues after confirming the problem is not raw SQL, server config, or infra-level pooling.
What do I get? / Deliverables
You get a categorized Prisma fix path, environment checks run, and validation steps—while non-ORM issues are routed to the right specialist skill.
- Corrected schema or migration steps
- Validated generate/migrate outcomes
- Escalation note when issue is out of Prisma scope
Recommended Skills
Journey fit
Build is where schema.prisma, migrations, and Prisma Client queries are authored and debugged before ship. Backend subphase covers ORM schema design, relations, and application-level query optimization—not raw DBA server tuning.
How it compares
ORM-focused procedural skill for Prisma CLI workflows, not a replacement for postgres-expert on server-side SQL optimization.
Common Questions / FAQ
Who is prisma-expert for?
Solo builders and small teams using Prisma Client who need structured debugging for schema, migrations, and relations without drowning in generic database advice.
When should I use prisma-expert?
During Build/backend when designing schema.prisma, resolving migration errors, fixing relation cardinalities, or optimizing Prisma queries—not when you only need raw SQL or server config.
Is prisma-expert safe to install?
Check the Security Audits panel on this page; the skill suggests shell commands (`npx prisma`, `grep`, `ls`)—review before autonomous agent execution.
SKILL.md
READMESKILL.md - Prisma Expert
# 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 ```bash # 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:** ```bash # 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:** ```prisma // 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:** ```bash # 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:** ```bash # 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