Prisma ORM

Enforce Prisma ORM architecture with singleton clients and migration-only schema changes.

1|Updated May 2, 2026
One-click install
npx skills add https://github.com/Levironexe/architect --skill prisma-orm-levironexe
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Prisma ORM
Source: https://github.com/Levironexe/architect/tree/main/skills/patterns/prisma
Command: npx skills add https://github.com/Levironexe/architect --skill prisma-orm-levironexe

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prisma ORM boundaries prevent risky, accidental database refactors that scatter query logic, create inconsistent schema changes, and cause runtime failures or connection exhaustion.

Core Features & Use Cases

  • Singleton Prisma Client: Centralizes PrismaClient creation to avoid multiple connection pools, especially in serverless and HMR-heavy environments.
  • Migration-Only Schema Changes: Ensures schema updates flow through Prisma migrations so generated types and migration history stay consistent.
  • Service/Repository/Data Access Separation: Keeps API routes and business logic from calling Prisma directly, making queries testable and enabling consistent select/include shapes to reduce N+1 queries.

Quick Start

Ask your coding agent to enforce a Prisma-first architecture by adding a single PrismaClient in src/lib/db.ts, moving all prisma.user/prisma.post queries into src/repositories, and applying schema changes exclusively via npx prisma migrate dev.

Frequently Asked Questions about Prisma ORM

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

FAQPage Schema
How do I prevent Prisma connection pool exhaustion in serverless environments?

To prevent Prisma connection pool exhaustion, instantiate a single PrismaClient in a shared module to avoid creating multiple database connection pools during serverless function execution and hot module replacement.

What's the best way to structure Prisma queries to avoid N+1 problems?

The best way to avoid N+1 problems is enforcing a repository pattern where repository modules own specific select and include query shapes, keeping API routes from calling Prisma directly.

Why does my Prisma schema drift during refactors and how do I fix it?

Schema drift happens when schema updates bypass migrations; fix it by applying schema changes exclusively through prisma migrate so generated types and migration history stay consistent.

Do I need a repository pattern if my API routes just call Prisma directly?

Yes, separating API routes from Prisma via a repository pattern makes queries testable, centralizes predictable query shapes, and prevents scattered database logic during refactors.

How do I handle Prisma known request errors consistently across service layers?

Handle Prisma known request errors consistently by moving queries into repository modules and service layers, ensuring predictable error handling and preventing scattered query logic.

Can I use Prisma migrations for schema changes in JavaScript and TypeScript codebases?

Yes, you can use Prisma migrations in JavaScript and TypeScript codebases by applying schema changes exclusively via npx prisma migrate to keep types and history consistent.