last update
Jun 2, 2026
license
MITv1.0.0
format
SKILL.md
- Install
// Downloads SKILL.md into ~/.claude/skills/prisma-orm-pro/
$ curl -fsSL --create-dirs -o ~/.claude/skills/prisma-orm-pro/SKILL.md https://claudeskil.com/skills/prisma-orm-pro/SKILL.md - Invoke
// Inside Claude Code, type the skill name as a slash command
> /prisma-orm-pro scaffold a typed REST endpoint - Or just ask
// Claude loads the skill by itself when a request matches its description
> scaffold a typed REST endpoint
- name:
- Prisma ORM Pro
- slug:
- prisma-orm-pro
- version:
- v1.0.0
- license:
- MIT
- author:
- @chiragthummar16
- categories:
- tags:
- #prisma#orm#postgres#typescript#migrations
- description:
Prisma schemas, migrations, relations, transactions, and the patterns that scale past 10k requests/min.
README.md
Prisma ORM Pro
A focused skill for building and operating Prisma in production — schema modeling, migrations, transactions, and the query patterns that hold up under serverless load and high request volume. It targets TypeScript backend engineers running Prisma 6 against Postgres (or MySQL) who keep hitting the same walls: connection exhaustion on Lambda, accidental N+1 queries, and migrations that work in dev but stall on deploy.
When to use it
- You're designing a
schema.prismawith non-trivial relations (many-to-many, self-relations, composite keys) and want the@relationwiring correct the first time. - Your serverless functions are throwing
too many connectionsorCan't reach database server. - A list endpoint is slow and you suspect a hidden per-row query.
- You need to choose between
migrate devandmigrate deploy, or recover from a failed/drifted migration. - You're adding interactive transactions and need correct isolation and timeout handling.
What it does
It works against the real Prisma surface area: the prisma CLI (migrate dev, migrate deploy, migrate resolve, db push, generate, studio), the schema.prisma file (datasource, generator, relationMode = "prisma" vs "foreignKeys"), and PrismaClient runtime APIs. On the query side it pushes you toward include/select and relation loading to kill N+1, batch transactions via prisma.$transaction([...]), and interactive transactions via prisma.$transaction(async (tx) => {...}, { timeout, isolationLevel }). For scale it covers connection pooling through the ?connection_limit= and ?pgbouncer=true params, the @prisma/adapter-* driver adapters, and Prisma Accelerate (@prisma/extension-accelerate) for connection pooling plus query-level cacheStrategy.
Example
curl -fsSL --create-dirs -o ~/.claude/skills/prisma-orm-pro/SKILL.md https://claudeskil.com/skills/prisma-orm-pro/SKILL.md
# dev: create + apply a migration from schema changes
npx prisma migrate dev --name add_orders
# prod: apply already-generated migrations, no prompts
npx prisma migrate deploy
// Accelerate + a cached, relation-loaded query (no N+1)
import { PrismaClient } from '@prisma/client'
import { withAccelerate } from '@prisma/extension-accelerate'
const prisma = new PrismaClient().$extends(withAccelerate())
const users = await prisma.user.findMany({
include: { orders: true }, // single JOIN-style fetch
cacheStrategy: { ttl: 60, swr: 30 }, // Accelerate edge cache
})
Tips & gotchas
relationMode = "prisma"skips DB-level foreign keys (needed for PlanetScale) but means Prisma emulates referential actions and you must add@@indexon FK columns yourself.- Never run
migrate devin CI/prod — it can reset the database. Usemigrate deploy. - In serverless, instantiate one PrismaClient per container (module scope), not per request, and cap
connection_limitlow (often 1–5) behind a pooler. - A failed migration blocks all future deploys until you run
prisma migrate resolve --appliedor--rolled-back.
FAQ
db push or migrate dev? db push syncs schema to DB with no migration history — good for prototyping. Use migrate dev once you need versioned, reviewable migrations.
How do I find an N+1? Set log: ['query'] on PrismaClient; repeated identical SELECTs per row mean you should fold the relation into one include/select.
Do I still need PgBouncer with Accelerate? No — Accelerate provides the pool. Use one or the other, and set pgbouncer=true when going through PgBouncer directly.
$ cat reviews/