prisma-expert

Diagnoses and fixes Prisma schema, migration, query, and connection issues.

3|Updated Jan 15, 2026
One-click install
npx skills add https://github.com/trudyan141/my-antigravity-agents-kit --skill prisma-expert-trudyan141
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-expert
Source: https://github.com/trudyan141/my-antigravity-agents-kit/tree/main/templates/.agent/skills/prisma-expert
Command: npx skills add https://github.com/trudyan141/my-antigravity-agents-kit --skill prisma-expert-trudyan141

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Prisma projects often hit schema design errors, failed migrations, N+1 query bottlenecks, and connection pool exhaustion that are hard to diagnose without deep ORM expertise. This Skill provides structured playbooks to detect, diagnose, and fix these issues across PostgreSQL, MySQL, and SQLite. ## Core Features & Use Cases - Schema Design Review: Validates relation definitions, indexes, enums, and field types with prisma validate and prisma migrate diff, then applies prioritized fixes. - Migration Management: Handles migration conflicts, failed production deployments, and shadow database issues using migrate dev, migrate deploy, and migrate resolve workflows. - Query Optimization: Detects N+1 problems and over-fetching, then rewrites queries with include, select, or $queryRaw for complex aggregations. - Use Case: Your serverless app on Vercel throws "too many connections" errors. The Skill detects the environment, applies the global PrismaClient singleton pattern, and configures connection_limit in the DATABASE_URL. ## Quick Start Ask the assistant to review your prisma/schema.prisma file and fix any relation or index issues, then optimize a slow query in your repository.

Frequently Asked Questions about prisma-expert

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix N+1 query problems in Prisma?

Fix N+1 queries in Prisma by using include to fetch relations in a single query, or select to retrieve only needed fields. For complex aggregations, use $queryRaw with a hand-written SQL JOIN instead of looping over findMany results.

How to resolve a failed Prisma migration in production?

Resolve a failed production migration with prisma migrate resolve, marking it as applied or rolled-back depending on its actual database state. Never run migrate dev in production; always use migrate deploy for releases.

Does Prisma work with serverless platforms like Vercel?

Prisma works on serverless platforms but requires a global PrismaClient singleton to avoid exhausting connections across function invocations. Set connection_limit and pool_timeout in the DATABASE_URL, and consider a pooler like PgBouncer for high traffic.

Why does Prisma throw too many connections errors?

This error occurs when the connection pool is exhausted, typically from creating multiple PrismaClient instances or unconfigured pool limits. Reuse a single client instance, set connection_limit in the connection string, and call $disconnect on shutdown.

When should I use raw SQL instead of Prisma queries?

Use $queryRaw only for complex aggregations or queries Prisma's API cannot express, such as multi-table GROUP BY reports. Standard CRUD and relation fetching should stay in Prisma queries to keep type safety and maintainability.