What problem does it solve? Writing database code in TypeScript often means choosing between unsafe raw SQL and heavy ORM runtimes. This Skill provides patterns for building compile-time type-safe database layers with Drizzle ORM, covering schema definition, relations, queries, transactions, and migrations across PostgreSQL, MySQL, and SQLite. ## Core Features & Use Cases - Type-Safe Schema Definition: Define tables, columns, enums, indexes, and constraints in TypeScript with automatic type inference via $inferSelect and $inferInsert. - Query & Relation Patterns: Build filters, joins, aggregations, CTEs, subqueries, and one-to-many or many-to-many relations with SQL-like syntax. - Migrations & Performance: Generate and apply SQL migrations with Drizzle Kit, configure connection pooling, cursor-based pagination, caching, and edge runtime integration. - Use Case: When building a Next.js or serverless API backed by PostgreSQL, use this Skill to define the schema, write optimized queries with relations, and generate migrations without a heavy ORM runtime. ## Quick Start Ask the AI to define a Drizzle schema for your tables and write a type-safe query with a migration using Drizzle Kit.