drizzle-orm-best-practices
/drizzle-orm-best-practices
Dialect-aware Drizzle ORM conventions for safe query, mutation, and transaction boundaries. Use when writing, debugging, or reviewing schemas, queries, transactions, or raw SQL.
- Author
- bastidood ↗
- Repository
- skills ↗
- Licence
- MPL-2.0
- Last repository change
- 13.11.2026
Assessment and security
- Files in this package
- 9
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 13.11.2026, without references to retired models or APIs.
MPL-2.0, otwarta.
What it does and when to use it
Dialect-aware Drizzle ORM conventions for safe query, mutation, and transaction boundaries. Use when writing, debugging, or reviewing schemas, queries, transactions, or raw SQL.
Original author description
Dialect-aware Drizzle ORM conventions for safe query, mutation, and transaction boundaries. Use when writing, debugging, or reviewing schemas, queries, transactions, or raw SQL.
How it works
- Library Sources
- Effective Strategies for Drizzle ORM
SKILL.md preview
--- name: drizzle-orm-best-practices description: Dialect-aware Drizzle ORM conventions for safe query, mutation, and transaction boundaries. Use when writing, debugging, or reviewing schemas, queries, transactions, or raw SQL. --- # Drizzle ORM Best Practices Treat Drizzle as a typed SQL builder over SQL dialect and driver contracts. Search its builders, operators, and helpers before writing `sql`. Keep data scope and invariants in SQL, read mutation metadata from the configured driver, let the database own persisted current time, and decode every unavoidable raw result at runtime. ## Library Sources - GitHub repository ID: `drizzle-team/drizzle-orm` - Context7 library ID: `/drizzle-team/drizzle-orm-docs` - DeepWiki repository ID: `drizzle-team/drizzle-orm` Use Context7 for current documentation and DeepWiki when documentation is insufficient or conflicts with implementation. ## Effective Strategies for Drizzle ORM Read the linked guidance that governs the current task before writing or reviewing Drizzle code. 1. Keep SQL construction, data scope, and write contracts in the database boundary. - Before introducing any raw SQL, exhaust the [built-in query builders and helpers](./references/built-in-query-helpers.md) so Drizzle keeps ownership of SQL generation, parameterization, and result decoding. - When a read exposes more data than its caller needs or checks access after retrieval, enforce [query scope at the database boundary](./references/query-scope.md). - When behavior depends on whether a write changed zero, one, or many rows, interpret [mutation cardinality from the driver result](./references/mutation-cardinality.md) without returning row data solely to count it. - When several statements preserve one invariant, define a [transaction boundary](./references/transaction-boundaries.md) that passes the transaction through every participating helper. - When persisted timestamps mean the database's current time, use [database-generated timestamps](./references/database-timestamps.md) instead of an application clock. 2. Treat every raw result as untrusted at the ORM boundary. - When an unavoidable `sql` expression returns a value, apply [runtime expression decoding](./references/sql-expression-decoding.md) and ban compile-time-only result annotations. - When a builder cannot represent a result-bearing operation, contain it behind [complete raw-result validation](./references/raw-query-results.md) rather than trusting a generic result type.
Files in this package (9)
- SKILL.md 2 KB
- agents/openai.yaml 1 KB
- references/built-in-query-helpers.md 4 KB
- references/database-timestamps.md 1 KB
- references/mutation-cardinality.md 2 KB
- references/query-scope.md 1 KB
- references/raw-query-results.md 1 KB
- references/sql-expression-decoding.md 2 KB
- references/transaction-boundaries.md 2 KB
Versions
The database has no other skills named drizzle-orm-best-practices.
Database snapshot: 13.11.2026 · package version 20e91d7a1523 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 1 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100drizzle-orm
Apply Drizzle ORM patterns for schemas, migrations, queries, branded types, and Postgres or D1 boundaries. Use when working with Drizzle or typed SQL, not raw `bun:sqlite` or non-Drizzle engines. - 100drizzle-orm-patterns
Provides comprehensive Drizzle ORM patterns for schema definition, CRUD operations, relations, queries, transactions, and migrations. Proactively use for any Drizzle ORM development including defining database schemas, writing type-safe queries, implementing relations, managing… - 100drizzle-orm-sql-first-schema
Use this skill when defining lightweight, zero-overhead relational schemas and executing queries with Drizzle ORM. - 100drizzle-orm-expert
Provides Drizzle ORM schema design, query patterns, migrations, and TypeScript integration for SQL databases. Use when working with Drizzle files (schema.ts, drizzle.config.ts) or when the user mentions Drizzle ORM or drizzle-kit. - 85Drizzle ORM
Expert guidance for Drizzle ORM including schema definition, queries, relations, migrations, TypeScript integration with SQLite/PostgreSQL, and Drizzle Studio. Use this when working with type-safe database operations, schema management, or ORM queries. - 100drizzle-orm-d1
| Type-safe ORM for Cloudflare D1 databases using Drizzle. Use when: building D1 database schemas, writing type-safe SQL queries, managing migrations with Drizzle Kit, defining table relations, implementing prepared statements, using D1 batch API, or encountering D1_ERROR,…