drizzle-orm

Installation
SKILL.md

Drizzle ORM patterns

The user's projects use Drizzle 1.0, Relations v2, and Relational Query Builder v2. Use this established API generation: db.query.* is the v2 API and relations are defined with defineRelations. Treat this as settled project context. Resolve concrete type errors, driver limits, and API details from the relevant code and package documentation when needed.

For formatting of relational queries and SQL builder chains, especially when a query mixes columns, where, and with or builder helpers like .select() and .where(), read references/formatting.md. Use that layout consistently in generated examples and code review suggestions because deep Drizzle configs get hard to scan when everything is packed onto a few lines.

API conventions

  • Use these Drizzle 1.0 patterns:

  • Use defineRelations(schema, (relationBuilder) => ...) from drizzle-orm.

  • Pass the resulting relations object to drizzle(client, { relations }).

  • Use db.query.table.findMany() and db.query.table.findFirst() for RQB v2.

  • Use object-shaped where and orderBy in relational queries.

  • Keep new relational queries in the v2 shape. Add compatibility code only for a reproduced project need within the requested task.

Driver caveats

Installs
33
First Seen
Apr 4, 2026