data-layer-handbook
Installation
SKILL.md
Instructions
When to Use
- Use when choosing Prisma vs Drizzle vs SQL for Next.
- Prefer
database-schema-agentafter ORM choice for Prisma schema work. - Prefer
auth-handbookif the question is sessions, not storage.
Pick a data layer for Next.js when Prisma is not assumed.
- Prisma: best when team wants migrations, studio, rich relation API, and mostly Node runtime. Use
database-schema-agentfor schema design and audits. - Drizzle: strong when you want SQL-first, lighter runtime, edge-friendly drivers with explicit SQL; migrations via
drizzle-kit- verify driver supports your DB (Postgres, SQLite, etc.). - Raw SQL / Kysely: acceptable for reporting or tight performance paths - isolate in repository modules; parameterize queries (no string concat for user input).
- Serverless pooling: avoid unbounded
new Client()per request; use connection pooler (PgBouncer, Neon, Supavisor, etc.) - name pattern, not vendor mandate. - Edge: Prisma often needs Data Proxy or separate Node path; Drizzle edge drivers still have SQL dialect limits - align with
edge-runtime-handbook. - Transactions: boundary at use-case level; retry idempotency for user-facing writes documented in
api-handbook.