drizzle-nextjs-postgres
Drizzle + PostgreSQL in Next.js
Library-reference skill for Drizzle ORM on PostgreSQL inside the Next.js App Router — 36 rules across 7 categories. Each rule names the wrong default it corrects; there is no rule for things a capable model already gets right.
This skill is self-contained: it includes the migration-workflow and type-inference rules a Postgres + Next.js developer needs even where the underlying wrong default is not Postgres-specific, so you never have to load a second skill mid-task. A few of those knowingly overlap the sibling drizzle-sqlite skill (same wrong default, restated for this context); the rest are decisions that only exist, or only bite differently, because the dialect is PostgreSQL or the code runs in the App Router.
Pinned to drizzle-orm 0.45.2, drizzle-kit 0.31.10, Next.js 16.2.11, PostgreSQL 14+.
When to Apply
- Writing or reviewing the
lib/dbmodule — driver choice, pooling, singletons,server-only - Fetching data in a Server Component, Route Handler, or
generateMetadatawithdb.select()/db.query.* - Deciding what to cache:
use cache,cacheLife,cacheTag, Reactcache(), or nothing - Writing a Server Action that mutates rows and has to invalidate what the read path cached
- Defining or changing a
pgTable— column types, indexes, enums, constraints - Running
drizzle-kit generate/migrate/push, or hand-editing a generated.sqlfile - Wrapping work in
db.transaction(), or debugging a race, deadlock, or exhausted pool - Reviewing a list, count, or pagination query that is fine locally and slow in production