prisma-patterns
Prisma ORM patterns for TypeScript backends — schema design, query optimization, transactions, pagination, and critical traps like updateMany returning count not records, $transaction timeouts, migrate dev resetting the DB, @updatedAt skipped on bulk writes, and serverless connection exhaustion.
npx skills add mturac/everything-openai-codex --skill prisma-patterns --agent codex
Same command for any agent — swap --agent for claude-code, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Prisma Patterns Production patterns and non-obvious traps for Prisma ORM in TypeScript backends. Tested against Prisma 5.x and 6.x. Some behaviors differ from Prisma 4. Check the Prisma version before applying version-specific patterns: ```bash npx prisma --version ``` Prisma 5 introduced `relationJoins`, which can load relations via JOIN rather than separate queries depending on query strategy and configuration. The `omit` field modifier and `prisma.$extends` Client Extensions API were also added. Note: `relationJoins` can cause row explosion on large 1:N relations or deep nested `include` — benchmark both approaches when relations may return many rows per parent. ## When to Activate - Designing or modifying Prisma schema models and relations - Writing queries, transactions, or pagination logic - Using `updateMany`, `deleteMany`, or any bulk operation - Running or planning database migrations - Deploying to serverless environments (Vercel, Lambda, Cloudflare Workers) - Implementing soft delete or multi-tenant row filtering ## Core Concepts ### ID Strategy | Strategy | Use When | Avoid When | |---|---|---| | `@default(cuid())` | Default choice — URL-safe, sortable, no collisions
- When to Activate
- Core Concepts
- ID Strategy
- Schema Defaults
- include vs select
- Transaction Form Selection
- PrismaClient Singleton
- N+1 Problem
- Code Examples
- Cursor Pagination (preferred for feeds and large datasets)
- Soft Delete
- Error Handling
- Connection Pool — Serverless
- Anti-Patterns
npx prisma --version With an external pooler (PgBouncer, Supabase pooler) NEVER on shared dev, staging, or production npx prisma migrate dev --name add_column Safe everywhere except local solo dev npx prisma migrate deploy Check drift without applying npx prisma migrate diff \ Step 1: create migration locally, then deploy npx prisma migrate dev --name add_new_column # local only
What does the prisma-patterns skill do?
Prisma ORM patterns for TypeScript backends — schema design, query optimization, transactions, pagination, and critical traps like updateMany returning count not records, $transaction timeouts, migrate dev resetting the DB, @updatedAt skipped on bulk writes, and serverless connection exhaustion.
How do I install it?
Run `npx skills add mturac/everything-openai-codex --skill prisma-patterns --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From mturac/everything-openai-codex, a repository with 84 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
