Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
ccheney avatar

Postgres Drizzle

  • 1.2k installs
  • 57 repo stars
  • Updated July 7, 2026
  • ccheney/robust-skills

postgres-drizzle provides documented workflows for Proactively apply when creating APIs, backends, or data models. Triggers on PostgreSQL, Postgres, Drizzle, database, schema, tables, columns, indexes, queries,

About

The postgres-drizzle skill proactively apply when creating APIs backends or data models Triggers on PostgreSQL Postgres Drizzle database schema tables columns indexes queries migrations ORM relations joins transactions SQL drizzle-kit connection pooling N 1 JSONB RLS Use when writing database schemas queries migrations or any database-related code PostgreSQL and Drizzle ORM best practices PostgreSQL Drizzle ORM Type-safe database applications with PostgreSQL 18 and Drizzle ORM Essential Commands bash npx drizzle-kit generate Generate migration from schema changes npx drizzle-kit migrate Apply pending migrations npx drizzle-kit push Push schema directly dev only npx drizzle-kit studio Open database browser Quick Decision Trees How do I model this relationship Relationship type One-to-many user has posts FK on many side relations Many-to-many posts have tags Junction table relations One-to-one user has profile FK with unique constraint Self-referential comments FK to same table Why is my query slow Slow query Missing index on WHERE JOIN columns Add index N 1 queries in loop Use relational queries API Full table scan EXPLAIN ANALYZE add index Large result

  • **Official Documentation**: https://orm.drizzle.team
  • **GitHub Repository**: https://github.com/drizzle-team/drizzle-orm
  • **Drizzle Kit (Migrations)**: https://orm.drizzle.team/kit-docs/overview
  • **Official Documentation**: https://www.postgresql.org/docs/
  • **SQL Commands Reference**: https://www.postgresql.org/docs/current/sql-commands.html

Postgres Drizzle by the numbers

  • 1,233 all-time installs (skills.sh)
  • +34 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #198 of 1,039 Mobile Development skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
At a glance

postgres-drizzle capabilities & compatibility

Capabilities
**official documentation**: https://orm.drizzle. · **github repository**: https://github.com/drizzl · **drizzle kit (migrations)**: https://orm.drizzl · **official documentation**: https://www.postgres · **sql commands reference**: https://www.postgres
Use cases
documentation
From the docs

What postgres-drizzle says it does

# PostgreSQL + Drizzle ORM Type-safe database applications with PostgreSQL 18 and Drizzle ORM.
SKILL.md
npx skills add https://github.com/ccheney/robust-skills --skill postgres-drizzle

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1.2k
repo stars57
Security audit3 / 3 scanners passed
Last updatedJuly 7, 2026
Repositoryccheney/robust-skills

How do I use postgres-drizzle for the task described in its SKILL.md triggers?

Proactively apply when creating APIs, backends, or data models. Triggers on PostgreSQL, Postgres, Drizzle, database, schema, tables, columns, indexes, queries, migrations, ORM, relations, joins, tran.

Who is it for?

Teams invoking postgres-drizzle when the user request matches documented triggers and prerequisites.

Skip if: Skip when cached docs are missing, the request is a negative trigger, or another sibling skill owns the workflow.

When should I use this skill?

Proactively apply when creating APIs, backends, or data models. Triggers on PostgreSQL, Postgres, Drizzle, database, schema, tables, columns, indexes, queries, migrations, ORM, relations, joins, transactions, SQL, drizzl

What you get

Step-by-step guidance grounded in postgres-drizzle documentation and reference files.

  • Schema definitions
  • Migration files
  • Optimized queries

By the numbers

  • Covers 6 topic categories: Schema, Queries, Relations, Migrations, PostgreSQL, Performance
  • Documents PostgreSQL PG18 features

Files

SKILL.mdMarkdownGitHub ↗

PostgreSQL + Drizzle ORM

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

Essential Commands

npx drizzle-kit generate   # Generate migration from schema changes
npx drizzle-kit migrate    # Apply pending migrations
npx drizzle-kit push       # Push schema directly (dev only!)
npx drizzle-kit studio     # Open database browser

Quick Decision Trees

"How do I model this relationship?"

Relationship type?
├─ One-to-many (user has posts)     → FK on "many" side + relations()
├─ Many-to-many (posts have tags)   → Junction table + relations()
├─ One-to-one (user has profile)    → FK with unique constraint
└─ Self-referential (comments)      → FK to same table

"Why is my query slow?"

Slow query?
├─ Missing index on WHERE/JOIN columns  → Add index
├─ N+1 queries in loop                  → Use relational queries API
├─ Full table scan                      → EXPLAIN ANALYZE, add index
├─ Large result set                     → Add pagination (limit/offset)
└─ Connection overhead                  → Enable connection pooling

"Which drizzle-kit command?"

What do I need?
├─ Schema changed, need SQL migration   → drizzle-kit generate
├─ Apply migrations to database         → drizzle-kit migrate
├─ Quick dev iteration (no migration)   → drizzle-kit push
└─ Browse/edit data visually            → drizzle-kit studio

Directory Structure

src/db/
├── schema/
│   ├── index.ts          # Re-export all tables
│   ├── users.ts          # Table + relations
│   └── posts.ts          # Table + relations
├── db.ts                 # Connection with pooling
└── migrate.ts            # Migration runner
drizzle/
└── migrations/           # Generated SQL files
drizzle.config.ts         # drizzle-kit config

Schema Patterns

Basic Table with Timestamps

export const users = pgTable('users', {
  id: uuid('id').primaryKey().defaultRandom(),
  email: varchar('email', { length: 255 }).notNull().unique(),
  createdAt: timestamp('created_at').defaultNow().notNull(),
  updatedAt: timestamp('updated_at').defaultNow().notNull(),
});

Foreign Key with Index

export const posts = pgTable('posts', {
  id: uuid('id').primaryKey().defaultRandom(),
  userId: uuid('user_id').notNull().references(() => users.id),
  title: varchar('title', { length: 255 }).notNull(),
}, (table) => [
  index('posts_user_id_idx').on(table.userId), // ALWAYS index FKs
]);

Relations

export const usersRelations = relations(users, ({ many }) => ({
  posts: many(posts),
}));

export const postsRelations = relations(posts, ({ one }) => ({
  author: one(users, { fields: [posts.userId], references: [users.id] }),
}));

Query Patterns

Relational Query (Avoid N+1)

// ✓ Single query with nested data
const usersWithPosts = await db.query.users.findMany({
  with: { posts: true },
});

Filtered Query

const activeUsers = await db
  .select()
  .from(users)
  .where(eq(users.status, 'active'));

Transaction

await db.transaction(async (tx) => {
  const [user] = await tx.insert(users).values({ email }).returning();
  await tx.insert(profiles).values({ userId: user.id });
});

Performance Checklist

PriorityCheckImpact
CRITICALIndex all foreign keysPrevents full table scans on JOINs
CRITICALUse relational queries for nested dataAvoids N+1
HIGHConnection pooling in productionReduces connection overhead
HIGHEXPLAIN ANALYZE slow queriesIdentifies missing indexes
MEDIUMPartial indexes for filtered subsetsSmaller, faster indexes
MEDIUMUUIDv7 for PKs (PG18+)Better index locality

Anti-Patterns (CRITICAL)

Anti-PatternProblemFix
No FK indexSlow JOINs, full scansAdd index on every FK column
N+1 in loopsQuery per rowUse with: relational queries
No poolingConnection per requestUse @neondatabase/serverless or similar
`push` in prodData loss riskAlways use generate + migrate
Storing JSON as textNo validation, bad queriesUse jsonb() column type

Reference Documentation

FilePurpose
references/SCHEMA.mdColumn types, constraints
references/QUERIES.mdOperators, joins, aggregations
references/RELATIONS.mdOne-to-many, many-to-many
references/MIGRATIONS.mddrizzle-kit workflows
references/POSTGRES.mdPG18 features, RLS, partitioning
references/PERFORMANCE.mdIndexing, optimization
references/CHEATSHEET.mdQuick reference

Resources

Drizzle ORM

  • Official Documentation: https://orm.drizzle.team
  • GitHub Repository: https://github.com/drizzle-team/drizzle-orm
  • Drizzle Kit (Migrations): https://orm.drizzle.team/kit-docs/overview

PostgreSQL

  • Official Documentation: https://www.postgresql.org/docs/
  • SQL Commands Reference: https://www.postgresql.org/docs/current/sql-commands.html
  • Performance Tips: https://www.postgresql.org/docs/current/performance-tips.html
  • Index Types: https://www.postgresql.org/docs/current/indexes-types.html
  • JSON Functions: https://www.postgresql.org/docs/current/functions-json.html
  • Row Level Security: https://www.postgresql.org/docs/current/ddl-rowsecurity.html

Related skills

How it compares

Use postgres-drizzle for Drizzle-specific PostgreSQL patterns rather than generic SQL or Prisma-oriented database skills.

FAQ

What does postgres-drizzle do?

Proactively apply when creating APIs, backends, or data models. Triggers on PostgreSQL, Postgres, Drizzle, database, schema, tables, columns, indexes, queries, migrations, ORM, relations, joins, transactions, SQL, drizzl

When should I use postgres-drizzle?

Proactively apply when creating APIs, backends, or data models. Triggers on PostgreSQL, Postgres, Drizzle, database, schema, tables, columns, indexes, queries, migrations, ORM, relations, joins, transactions, SQL, drizzl

What are common prerequisites?

--- name: postgres-drizzle description: Proactively apply when creating APIs, backends, or data models.

Is Postgres Drizzle safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.