mcpField
P
postgres-drizzle

postgres-drizzle

github.com/ccheneyData & databases611.5k installsUpdated 7w ago
Repository

About postgres-drizzle

A development skill for PostgreSQL and Drizzle ORM, aimed at developers working on schemas, queries, and migrations. It emphasizes checking the project's installed versions, driver, and deployment target before making changes.

Key features

  1. 01Guide table and constraint design
  2. 02Cover queries, transactions, and relations
  3. 03Explain migration generation and rollout
  4. 04Offer performance diagnosis guidance
  5. 05Organize references by topic

Use cases

  1. 01Write or review database queries
  2. 02Prepare migrations for schema changes
  3. 03Investigate performance using query plans

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/ccheney/robust-skills --skill postgres-drizzle

After installing, type/postgres-drizzlein Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
CHEATSHEET.md
MIGRATIONS.md
PERFORMANCE.md
POSTGRES.md
QUERIES.md
RELATIONS.md
SCHEMA.md

Details

From the project README

PostgreSQL and Drizzle ORM

Match database work to the project's installed API and deployment context. The user's explicit instructions take precedence over this skill's guidelines.

Establish the database contract

Use the relevant schema/query, migration history, and requested behavior as input. For Drizzle code, inspect installed drizzle-orm/drizzle-kit versions and the driver; for SQL, establish the PostgreSQL version when a version-specific feature matters.

The references cover PostgreSQL 17/18 and distinguish Drizzle's 0.x relations() API from the v1 defineRelations() API. Do not mix them or infer the installed API from an npm dist-tag. When the version is unknown, use imports/lockfiles or ask for the missing version before giving version-dependent code.

Keep changes consistent

  • Declare database foreign keys separately from ORM relation metadata. Match nullability, uniqueness, and delete behavior to the actual relationship.
  • Use the transaction handle for every statement in that transaction; a query through the outer connection can escape it.
  • Diagnose slow queries from plans and workload evidence. Evaluate indexes on referencing columns; PostgreSQL does not create them automatically.
  • Generate and inspect migration SQL for schema changes. Preserve applied migration history; use a new migration for subsequent changes.
  • Establish the target before applying migrations or push. Authoring or reviewing SQL does not itself require executing it against a database. Continue execution when the user has already authorized that target and action.
  • Treat EXPLAIN ANALYZE as query execution, including writes. Use a suitable test target or non-executing plan when execution is outside the task.

Deliver the requested SQL/code, migration, or diagnosis, with compatibility assumptions and relevant verification. If execution is requested but the target is missing, prepare the change and ask only for that missing target.

References

Read the topic required for the current operation.

TaskReference
Tables, types, constraints, indexes, generated columnsSCHEMA.md
Reads, writes, joins, transactions, prepared queriesQUERIES.md
Relationships and version-specific relational query APIsRELATIONS.md
drizzle-kit configuration, migration generation and rolloutMIGRATIONS.md
PostgreSQL features, RLS, partitioning, JSONB, full-text searchPOSTGRES.md
Query plans, indexing, pooling, pagination, bulk workPERFORMANCE.md
Compact syntax or connection setup lookupCHEATSHEET.md

For APIs or support not established by the installed project and references, consult version-matched Drizzle and PostgreSQL documentation.

Comments

Markdown supported