$npx skillfedfor your agent

postgres-drizzle

Build type-safe database applications pairing PostgreSQL with Drizzle ORM. This skill covers schema design, relational queries, migrations via drizzle-kit, connection pooling, and common performance pitfalls like N+1 queries and missing indexes. Includes decision trees for modeling relationships and diagnosing slow queries.

postgres-drizzle helps you build type-safe PostgreSQL applications using Drizzle ORM with schema patterns, queries, and migrations.

AI-generated summary based on this skill's SKILL.md

55 3 MITupdated by ccheney

Decision gist · record as of 2026-07-07

postgres-drizzle helps you build type-safe PostgreSQL applications using Drizzle ORM with schema patterns, queries, and migrations. Build type-safe database applications pairing PostgreSQL with Drizzle ORM. This skill covers schema design, relational queries, migrations via drizzle-kit, connection pooling, and common performance pitfalls like N+1 queries and missing indexes. Includes decision trees for modeling relationships and diagnosing slow queries.

manual: git clone https://github.com/ccheney/robust-skills → cp -r robust-skills/skills/postgres-drizzle ~/.claude/skills/postgres-drizzle
skills/postgres-drizzle/SKILL.md · version 3b3085fa

Use it when

  • postgres-drizzle explains that drizzle-kit generate creates migration files from your schema changes.
  • postgres-drizzle teaches relational query patterns that prevent N+1 problems by using joins and eager loading instead of fetching parent.

Verify before relying

Read SKILL.md below before installing (9 files). Open directory: indexed for reading, not audited.

Same gist for agents: .md · .json

Install

ccheney/robust-skills/postgres-drizzle · repository language: JavaScript

Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I set up type-safe PostgreSQL with Drizzle ORM?

postgres-drizzle teaches you to initialize a PostgreSQL database with Drizzle ORM by installing drizzle-orm and drizzle-kit, configuring your database connection, and defining type-safe schemas. You'll learn to connect via environment variables, set up connection pooling for production, and use drizzle-kit to generate and apply migrations. The skill covers both local development and deployment patterns.

What does drizzle-kit generate migrate do and when do I use it?

postgres-drizzle explains that drizzle-kit generate creates migration files from your schema changes, while drizzle-kit migrate applies those migrations to your database. Use generate when your schema definition diverges from your database state, then migrate to sync them. The skill covers the push vs. generate vs. migrate workflow and helps you choose the right command for your development stage.

How can I avoid N+1 query problems in Drizzle relational queries?

postgres-drizzle teaches relational query patterns that prevent N+1 problems by using joins and eager loading instead of fetching parent records then looping to fetch children. You'll learn Drizzle's query builder syntax for left joins, inner joins, and relation helpers to load nested data in a single query. The skill includes examples of slow patterns and their optimized alternatives.

Why is my Drizzle query slow and how do I diagnose it?

postgres-drizzle covers query performance diagnosis by using PostgreSQL's EXPLAIN ANALYZE to identify missing indexes, sequential scans, and inefficient join orders. You'll learn to add indexes on foreign keys and frequently filtered columns, recognize N+1 patterns, and use connection pooling to avoid bottlenecks. The skill includes decision trees for common slow-query scenarios.

How do I model many-to-many relationships in Drizzle ORM?

postgres-drizzle teaches many-to-many modeling by creating a junction table with foreign keys to both parent tables, then defining Drizzle relations to query through it. You'll learn schema design patterns, how to insert and query junction records, and when to add extra columns (like timestamps) to the junction table. Examples cover both simple and complex many-to-many scenarios.

What connection pooling strategy should I use for Drizzle in production?

postgres-drizzle covers connection pooling setup using PgBouncer or native pool options in your Drizzle client, explaining pool size tuning, idle timeout configuration, and deployment patterns. You'll learn why pooling matters for serverless environments, how to monitor pool exhaustion, and best practices for graceful shutdown. The skill includes configuration examples for common hosting platforms.

SKILL.md

Rendered from the published skill. Quoted content, verbatim.

PostgreSQL + Drizzle ORM

Type-safe database applications with PostgreSQL 17/18 and Drizzle ORM.

Version Check (do this first)

Drizzle's API changed significantly between the stable 0.x line and v1.0. Check package.json before writing code, because the two relations APIs are incompatible and must not be mixed:

drizzle-orm version Relations API Query filters
^0.x (npm latest) relations() per table, drizzle(client, { schema }) where: eq(users.id, id)
1.0.0-beta.* / 1.0.0-rc.* defineRelations() once for all tables, drizzle(client, { relations })

(truncated - see the full file via the links below)

File tree — 9 files
skills/postgres-drizzle/README.md
skills/postgres-drizzle/SKILL.md
skills/postgres-drizzle/references/CHEATSHEET.md
skills/postgres-drizzle/references/MIGRATIONS.md
skills/postgres-drizzle/references/PERFORMANCE.md
skills/postgres-drizzle/references/POSTGRES.md
skills/postgres-drizzle/references/QUERIES.md
skills/postgres-drizzle/references/RELATIONS.md
skills/postgres-drizzle/references/SCHEMA.md

Let your AI agent find skills like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.

wish › “Set up type-safe PostgreSQL database with Drizzle ORM”

Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →

Related skills

drizzle-best-practices
by honra-io · honra-io/drizzle-best-practices

Comprehensive reference for building PostgreSQL applications with Drizzle ORM, covering schema design, query patterns, and relational modeling across eight prioritized categories. Includes version-specific guidance for both v1 RC and legacy 0.45.x APIs, with correct and incorrect code examples for each pattern.

MITupdated May 2026
★ 18repo stars
Drizzle Postgres
by pedronauck · pedronauck/skills

Build type-safe PostgreSQL applications using Drizzle ORM with guidance on schema design, migrations, and query optimization. Covers essential patterns for relationships, transactions, and connection pooling alongside performance best practices like indexing foreign keys and avoiding N+1 queries.

no license declared → metadata onlyupdated Jul 2026
★ 541repo stars
Drizzle
by triggerdotdev · triggerdotdev/trigger.dev

This skill covers Drizzle ORM usage in the `@internal/dashboard-agent-db` package, the agent's dedicated conversation store. Learn schema definition with pg-core, postgres.js driver configuration, drizzle-kit migrations, and the repo's access-pattern query layer enforcing tenant scoping and foreign-key-free design. Drizzle is isolated from the main Prisma database.

Apache-2.0for claude-codeupdated Jul 2026
★ 15,775repo stars
Drizzle Orm
by oakoss · oakoss/agent-skills

Drizzle ORM is a lightweight TypeScript ORM that delivers compile-time type safety while mapping directly to SQL across PostgreSQL, MySQL, and SQLite. It combines a SQL-like query builder with a relational queries API, serverless compatibility, and zero dependencies for full control over your database layer.

no license declared → metadata onlyupdated Mar 2026
★ 13repo stars
Drizzle Orm
by pedronauck · pedronauck/skills

This skill covers Drizzle ORM fundamentals for building type-safe database layers, including schema organization, prepared statements, and transaction patterns. Learn performance-first practices like indexing strategies, N+1 prevention, and safe migration workflows using package scripts. Covers common pitfalls and validation steps to ensure robust database code.

no license declared → metadata onlyupdated Jul 2026
★ 541repo stars
drizzle-orm
by Mindrally · Mindrally/skills

Drizzle ORM is a lightweight, type-safe TypeScript ORM that treats SQL as a first-class citizen. This skill covers schema definition, database connections across PostgreSQL, SQLite, and Turso, relational queries, and performance patterns like proper indexing and pagination.

Apache-2.0updated Jun 2026
★ 202repo stars

More skills drizzle-orm-patterns (MIT) · drizzle (MIT) · drizzle-migrations (MIT) · drizzle-orm-d1 (MIT) · Database Design (unlicensed)

Tags
type-safe-ormschema-versioningquery-optimizationconnection-poolingrelational-datamigration-managementpostgres-featuresperformance-tuningdatabase-design