skillfed

Drizzle Orm

This skill covers Drizzle ORM fundamentals for building type-safe database layers, including schema organization, prepared statements, and transaction patterns. Learn performance-first practices like indexing strategies, N+1 prevention, and safe migration workflows using package scripts. Covers common pitfalls and validation steps to ensure robust database code.

Drizzle Orm teaches type-safe database operations with schema definitions, queries, transactions, and migration best practices.

AI-generated summary based on this skill's SKILL.md

541 80 unlicensed — metadata only updated by pedronauck

Install

pedronauck/skills/drizzle-orm · repository language: JavaScript

CLI (skillfed)coming soon
git clone https://github.com/pedronauck/skills
cp -r skills ~/.claude/skills/drizzle-orm

generated, unverified - the skill's exact subdirectory could not be determined; check the repository on GitHub

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How to use Drizzle ORM for database operations?

Drizzle ORM provides a TypeScript-first approach to database management. Start by defining your schema using Drizzle's schema builders, then initialize a database connection. Drizzle ORM supports prepared statements for performance and type safety. Use the query builder to construct type-safe queries, leverage transactions for multi-step operations, and implement proper error handling. The skill covers setup workflows, common patterns, and validation steps to ensure robust database code.

What makes Drizzle ORM type-safe for database queries?

Drizzle ORM builds type-safe database queries by leveraging TypeScript's type system throughout the entire query lifecycle. When you define your schema, Drizzle generates corresponding TypeScript types automatically. This means your queries, results, and parameters are all type-checked at compile time. Prepared statements in Drizzle ORM further enhance safety by separating query structure from data, preventing SQL injection and ensuring predictable performance.

How do you define and manage database schemas in Drizzle?

Drizzle ORM uses a declarative schema definition approach where you define tables and columns using Drizzle's schema builders. Each table definition specifies column types, constraints, and relationships. Drizzle ORM generates migrations from your schema changes, which you manage through package scripts. The skill covers schema organization best practices, relationship configuration, and safe migration workflows to prevent data loss and maintain consistency.

What performance-first practices does Drizzle ORM recommend?

Drizzle ORM emphasizes performance through indexing strategies, N+1 query prevention, and efficient transaction patterns. Use prepared statements to reduce parsing overhead and leverage batch operations where possible. The skill teaches validation steps, common pitfalls to avoid, and monitoring approaches. Proper schema design with appropriate indexes, combined with thoughtful query construction, ensures your Drizzle ORM applications scale efficiently.

How does Drizzle ORM handle database migrations?

Drizzle ORM generates migrations automatically from your schema definitions, which you manage through package scripts. This approach ensures migrations stay synchronized with your TypeScript schema code. The skill covers safe migration workflows, including testing strategies and rollback procedures. Drizzle ORM supports both SQL and programmatic migrations, allowing you to handle complex schema changes while maintaining data integrity.

Can you manage database relationships and transactions in Drizzle?

Drizzle ORM supports relationship definitions through foreign keys and provides comprehensive transaction support for multi-step operations. Define relationships in your schema, then use Drizzle ORM's query builder to fetch related data efficiently. Transactions ensure data consistency across multiple operations. The skill covers relationship patterns, transaction best practices, and techniques to prevent common issues like N+1 queries when working with related data.

Related skills

Tags

type-safe-queries schema-builder sql-abstraction database-migration relational-mapping query-optimization typescript-first data-persistence