mcpField
D
drizzle-nextjs-postgres

drizzle-nextjs-postgres

github.com/pproencaDevelopment21871 installsUpdated 11w ago
Repository

About drizzle-nextjs-postgres

A reference skill for developers using Drizzle ORM with PostgreSQL in the Next.js App Router. Its 36 focused rules cover database access, caching, schema changes, transactions, and query-building decisions, with version-specific guidance.

Key features

  1. 0136 rules in seven categories
  2. 02Driver and connection-pool guidance
  3. 03Server Component reads and caching
  4. 04Server Action mutation practices
  5. 05Schema, migration, and transaction guidance
  6. 06PostgreSQL query-building advice

Use cases

  1. 01Setting up a Drizzle database module
  2. 02Reviewing cached Server Component reads
  3. 03Planning PostgreSQL schema changes
  4. 04Diagnosing slow queries or pool issues

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/pproenca/dot-skills --skill drizzle-nextjs-postgres

After installing, type/drizzle-nextjs-postgresin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

AGENTS.md
metadata.json
assets/templates/
_template.md
references/
_sections.md
conn-disable-prepare-behind-transaction-pooler.md
conn-driver-choice-follows-transactions.md
conn-pass-schema-for-relational-queries.md
conn-pool-sizing-for-serverless.md
conn-server-only-db-module.md
conn-singleton-across-hmr.md
migrate-add-constraints-not-valid-then-validate.md
migrate-concurrent-index-outside-transaction.md
migrate-generate-not-push.md
migrate-map-renames-explicitly.md
migrate-run-in-deploy-step-not-at-runtime.md
mut-after-for-post-response-writes.md
mut-authorize-inside-the-action.md
mut-updatetag-vs-revalidatetag.md
query-count-scans-the-table.md
query-execute-shape-is-driver-dependent.md
query-keyset-not-offset.md
query-not-in-null-trap.md
query-prepared-statements-need-names.md
rsc-dedupe-with-react-cache.md
rsc-no-request-apis-inside-use-cache.md
rsc-node-runtime-not-edge.md
rsc-suspense-around-uncached-reads.md
rsc-use-cache-is-per-instance-memory.md
rsc-use-cache-replaces-unstable-cache.md
schema-bigint-mode-truncation.md

Details

From the project README

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/db module — driver choice, pooling, singletons, server-only
  • Fetching data in a Server Component, Route Handler, or generateMetadata with db.select() / db.query.*
  • Deciding what to cache: use cache, cacheLife, cacheTag, React cache(), 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 .sql file
  • 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

Rule Categories

#CategoryPrefixCovers
1Client Construction & Driver Choiceconn-Singletons across HMR, serverless pool sizing, poolers, driver capability, server-only, passing schema
2Reads in Server Componentsrsc-Suspense boundaries, use cache / cacheLife / cacheTag, request dedupe, waterfalls, runtime choice
3Server Actions & Mutationsmut-Authorization and validation in the action, cache invalidation, deferred writes
4Postgres Schema Definitionschema-timestamptz, identity columns, text vs varchar, numeric, jsonb, bigint modes, table config, enums
5Migrations & Schema Change Safetymigrate-generate vs push, concurrent indexes, where migrations run, renames, lock-safe constraints
6Transactions & Pooled Connectionstx-Connection cost of a held transaction, row locking, serialization retries
7Postgres Query Buildingquery-Keyset pagination, count cost, driver-dependent execute shape, NULL semantics, prepared statements

Quick Reference

1. Client Construction & Driver Choice
2. Reads in Server Components
3. Server Actions & Mutations
4. Postgres Schema Definition
5. Migrations & Schema Change Safety
6. Transactions & Pooled Connections
7. Postgres Query Building

How to Use

Read a reference file when its decision comes up. Each rule names the wrong default it corrects, then shows the canonical way (with an incorrect/correct contrast only where the wrong way is a real trap).

Related Skills

  • drizzle-sqlite — the same ORM against SQLite-family backends; covers the dialect-agnostic query-building rules this skill deliberately omits
  • nextjs — App Router patterns beyond the data layer
  • relational-database-design — choosing the schema this skill teaches you to declare

Reference Files

FileDescription
references/_sections.mdCategory definitions and ordering
assets/templates/_template.mdTemplate for new rules
metadata.jsonVersion and source references

Comments

Markdown supported