drizzle-orm

Implement type-safe database access with Drizzle ORM for TypeScript projects.

Updated May 20, 2026
One-click install
npx skills add https://github.com/Hollowvyn/cognipace-v2 --skill drizzle-orm-hollowvyn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: drizzle-orm
Source: https://github.com/Hollowvyn/cognipace-v2/tree/main/.agents/skills/drizzle
Command: npx skills add https://github.com/Hollowvyn/cognipace-v2 --skill drizzle-orm-hollowvyn

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Drizzle ORM eliminates the friction of writing database code by providing compile-time type safety while still generating SQL that is efficient and predictable, reducing runtime errors and refactor risk.

Core Features & Use Cases

  • Type-safe schema and queries: Define tables and infer TypeScript types for inserts, selects, and updates to catch mistakes early.
  • SQL-like control with safe composition: Write queries using Drizzle’s query builder, including joins, filters, pagination, relations, CTEs, and safe raw SQL via the sql template.
  • Practical production workflows: Support migrations with Drizzle Kit, handle relations (one-to-many and many-to-many), and cover performance patterns like pagination, indexing considerations, and batching.
  • Use case: You’re building a local-first extension that stores user progress in SQLite; you can define schema types once, then safely query and migrate the data layer as features evolve without losing type correctness.

Quick Start

Ask the AI: “Show me how to define a users table with Drizzle, run a type-safe insert and select, and outline the Drizzle Kit migration steps for a PostgreSQL or SQLite setup.”

Frequently Asked Questions about drizzle-orm

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build type-safe SQL queries in TypeScript without losing control over the generated SQL?

Type-safe SQL queries in TypeScript are built using Drizzle ORM's query builder, which infers types at compile time while generating predictable SQL. Developers define schemas once to catch insert, select, and update mistakes early without runtime overhead.

What is the best way to manage database migrations for a TypeScript PostgreSQL project?

Database migrations for TypeScript PostgreSQL projects are managed via Drizzle Kit, which handles schema evolution and migration generation. Developers define schema changes in TypeScript and use Drizzle Kit to generate and apply SQL migration files safely.

How do I compose safe raw SQL statements within a TypeScript ORM workflow?

Safe raw SQL composition in a TypeScript ORM workflow is achieved using Drizzle's sql template literals. This allows developers to inject dynamic values and raw SQL fragments into queries while maintaining type inference and preventing SQL injection vulnerabilities.

Does Drizzle ORM support complex querying like joins, CTEs, and window functions?

Drizzle ORM supports complex querying including joins, common table expressions (CTEs), window functions, and relation loading. It provides SQL-first ergonomics for advanced relational operations, pagination, and batching within TypeScript projects.

Can I use Drizzle ORM for SQLite local-first extensions and handle one-to-many relations?

Drizzle ORM supports SQLite local-first extensions and handles one-to-many and many-to-many relations. Developers define schema types once, then safely query, load relations, and migrate the data layer as features evolve without losing type correctness.

How do I run type-safe database transactions in a TypeScript application?

Type-safe database transactions in TypeScript are executed through Drizzle ORM's transaction API, ensuring compile-time type inference for queries inside the transaction block. This maintains data integrity during multi-step CRUD workflows and relational operations.