MCPInstall

drizzle-orm

Drizzle ORM for type-safe SQL with PostgreSQL, MySQL, and SQLite. Use when defining schemas, writing queries, managing relations, running migrations, or using drizzle-kit. Use for drizzle, orm, schema, query, migration, pgTable, relations, drizzle-kit, drizzle-zod.

Installs
238
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/oakoss/agent-skills --skill drizzle-orm
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads drizzle-orm automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Drizzle ORM

Overview

Drizzle ORM is a lightweight, type-safe TypeScript ORM that maps directly to SQL for PostgreSQL, MySQL, and SQLite. It provides both a SQL-like query builder and a relational queries API, with zero dependencies and full serverless compatibility. Use Drizzle when you need compile-time type safety with SQL-level control; avoid it when you need a full active-record ORM with automatic migrations (use Prisma) or when working with MongoDB/NoSQL databases.

Quick Reference

PatternAPIKey Points
Schema definitionpgTable('name', { columns }, (t) => [indexes])Third arg returns array of indexes/constraints
Column typestext(), integer(), boolean(), timestamp()Import from drizzle-orm/pg-core
Type inferencetypeof table.$inferSelect, $inferInsertDerive TS types directly from schema
Relational queriesdb.query.table.findMany({ with, where })Requires schema passed to drizzle() client
SQL-like queriesdb.select().from(table).where()Chainable, returns array of rows
Insertdb.insert(table).values({}).returning().returning() for getting inserted rows
Updatedb.update(table).set({}).where().returning()Always include .where() to avoid full-table updates
Deletedb.delete(table).where()Always include .where() to avoid full-table deletes
Upsert.onConflictDoUpdate({ target, set })Chain after .insert().values()
Transactionsdb.transaction(async (tx) => { ... })Auto-rollback on thrown errors
Filterseq(), and(), or(), inArray(), sql\``Import operators from drizzle-orm
Relationsrelations(table, ({ one, many }) => ({}))Declares logical relations for relational queries
Generate migrationsdrizzle-kit generateCreates SQL migration files from schema diff
Apply migrationsdrizzle-kit migrate or migrate() in codeApplies pending migrations to database
Push schemadrizzle-kit pushDirect schema push without migration files
Prepared statementsdb.select().from(t).where(eq(t.id, sql.placeholder('id'))).prepare()Reusable parameterized queries
ViewspgView('name').as(qb => ...)Regular and materialized views
$count utilitydb.$count(table, filter?)Shorthand count, usable as subquery
Generated columnstext().generatedAlwaysAs(() => sql\...`)`Computed columns (virtual or stored)
Check constraintscheck('name', sql\condition`)`Row-level validation at database level

Common Mistakes

MistakeCorrect Pattern
Missing .returning() on insert/updateChain .returning() to get back inserted/updated rows
Omitting .where() on update/deleteAlways provide .where() to avoid affecting all rows
Using any for query result typesUse $inferSelect / $inferInsert for type-safe results
Not passing schema to drizzle() clientPass { schema } to enable db.query relational API
Forgetting indexes on foreign key columnsAdd explicit indexes for columns used in joins/lookups
Wrapping related writes without a transactionUse db.transaction() for multi-table mutations
Using raw column names with casing: 'snake_case'With casing option, define columns in camelCase without name arg
Declaring relations but missing the inverseBoth sides of a relation need declarations for relational queries
Using serial() in new PostgreSQL schemasPrefer integer().generatedAlwaysAsIdentity() (modern approach)
Not handling findFirst returning undefinedCheck for undefined before accessing properties
Importing column types from wrong dialect moduleUse drizzle-orm/pg-core for PostgreSQL, mysql-core, sqlite-core
Using .references() instead of relations().references() is SQL foreign key; relations() is for query API

Delegation

If the tanstack-query skill is available, delegate client-side caching and server state management to it. Otherwise, recommend: npx skills add oakoss/agent-skills --skill tanstack-query

If the tanstack-start skill is available, delegate server function patterns for database access to it. Otherwise, recommend: npx skills add oakoss/agent-skills --skill tanstack-start

If the electricsql skill is available, delegate Electric setup, shape configuration, and write patterns to it. Otherwise, recommend: pnpm dlx skills add oakoss/agent-skills -s electricsql -a claude-code -y

If the pglite skill is available, delegate PGlite-specific configuration, extensions, and browser storage patterns to it. Otherwise, recommend: pnpm dlx skills add oakoss/agent-skills -s pglite -a claude-code -y

  • Schema validation: Use drizzle-zod to generate Zod schemas from Drizzle tables for input validation
  • Query pattern discovery: Use Explore agent
  • Code review: Delegate to code-reviewer agent

References

  • Schema definition, column types, constraints, indexes, and type inference
  • Relational queries, SQL-like API, joins, subqueries, and aggregations
  • Insert, update, delete, upsert, and transactions
  • Relations: one, many, nested with clauses, self-referencing
  • Migrations: drizzle-kit generate, migrate, push, pull, studio
  • Filter operators: eq, ne, gt, lt, like, inArray, sql template
  • Views, materialized views, generated columns, check constraints, $count, batch API
  • ElectricSQL + PGlite integration: driver setup, schema-to-shape mapping, type inference, local sync

FAQ

What does the drizzle-orm skill do?

Drizzle ORM for type-safe SQL with PostgreSQL, MySQL, and SQLite. Use when defining schemas, writing queries, managing relations, running migrations, or using drizzle-kit. Use for drizzle, orm, schema, query, migration, pgTable, relations, drizzle-kit, drizzle-zod.

How do I install drizzle-orm?

Run npx skills add https://github.com/oakoss/agent-skills --skill drizzle-orm in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/drizzle-orm/ (personal) or .claude/skills/drizzle-orm/ (project).

Which AI agents can use drizzle-orm?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is drizzle-orm safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains drizzle-orm?

It is published by oakoss in oakoss/agent-skills. It has 238 recorded installs.

More from oakoss/agent-skills

View all →

ui-ux-polish

oakoss/agent-skills

Iterative UI/UX polishing workflow for web applications. Use when improving visual polish, refining desktop and mobile UX separately, running iterative enhancement cycles, applying design patterns like glassmorphism or bento grids, or auditing accessibility and WCAG compliance. Use for Stripe-level visual quality, responsive optimization, and design system alignment.

Frontend & Design541 installs

playwright

oakoss/agent-skills

Open the skill to read its SKILL.md instructions.

Testing & QA453 installs

coolify

oakoss/agent-skills

Coolify self-hosted PaaS for deploying applications, databases, and services via REST API and Git integration. Covers API authentication, deployment triggers, build packs (Nixpacks, Dockerfile, Compose), CI/CD with GitHub Actions webhooks, environment management, and Traefik proxy configuration. Use when deploying apps to Coolify, triggering deployments via API, configuring build packs, setting up GitHub Actions CI/CD pipelines, managing environment variables, or troubleshooting deployment failures.

DevOps & Cloud361 installs

application-security

oakoss/agent-skills

Application security covering threat modeling (STRIDE), OWASP Top 10 (2025), OWASP API Security Top 10 (2023), secure coding review, authentication/authorization patterns, input validation, encryption, security headers, supply chain security, compliance (GDPR/HIPAA/SOC2/PCI-DSS), and security monitoring. Use when reviewing code for vulnerabilities, implementing auth patterns, securing APIs, configuring security headers, hardening supply chain, preventing injection attacks, or preparing for compliance audits.

Security272 installs

find-skills

oakoss/agent-skills

Discovers and installs agent skills from the open ecosystem. Enriches search results with descriptions fetched from skills.sh. Use when a user asks "how do I do X", "find a skill for X", "is there a skill that can...", or wants to extend agent capabilities. Use for skill discovery, skill search, skill install, finding tools.

AI & Agents256 installs

brand-designer

oakoss/agent-skills

Creates cohesive brand identities including logos, color palettes, typography systems, and brand guidelines documents. Generates SVG logo components with variants, configures Tailwind color tokens, builds type scales, and produces social media and business card templates. Use when designing a logo, building a color palette, setting up typography systems, creating brand guidelines, generating social media templates, or organizing brand asset files. Use for branding, visual identity, logo design, brand guidelines, color systems.

Marketing & SEO229 installs

Popular data & databases skills

View category →

Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pgcron, pgmq), vector/semantic search (pgvector), and restoring dumps (pgrestore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.

OfficialData & Databases462.2K installs

prisma-client-api

prisma/skills

Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".

OfficialData & Databases393.5K installs

Deprecated compatibility name for prisma-orm-setup. Use only when a user or existing integration explicitly invokes prisma-database-setup; otherwise select prisma-orm-setup.

OfficialData & Databases392.3K installs

prisma-cli

prisma/skills

Prisma ORM 7 CLI reference for existing Prisma 7 applications or explicitly selected Prisma 7 workflows. Covers prisma init, generate, migrate, db, dev, studio, and mcp. For setup, connection repair, or Prisma 8, use prisma-orm-setup; not the Prisma Platform CLI.

OfficialData & Databases390.8K installs

prisma-postgres

prisma/skills

Deprecated compatibility name for prisma-postgres-setup. Use only when a user or existing integration explicitly invokes prisma-postgres; otherwise select prisma-postgres-setup.

OfficialData & Databases384.4K installs

Required reference for Prisma ORM 7 SQL driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter, Transaction, savepoint, result mapping, or DriverAdapterError behavior. Covers current transaction lifecycle, optional savepoint hooks, original database-error preservation, and verification.

OfficialData & Databases378.9K installs