From ravn-ai-toolkit
Provides Drizzle ORM patterns for typesafe schema design, relational queries, prepared statements, migrations, and transactions.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ravn-ai-toolkit:tech-drizzleThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Lightweight, headless TypeScript ORM with zero dependencies. Drizzle excels at:
rules/_sections.mdrules/migration-push-vs-generate.mdrules/migration-review-sql.mdrules/migration-transaction-safety.mdrules/qb-prepared-statements.mdrules/qb-use-for-aggregations.mdrules/rqb-prefer-relational.mdrules/rqb-select-columns.mdrules/rqb-with-eager-loading.mdrules/schema-export-order.mdrules/schema-infer-types.mdrules/schema-one-table-per-file.mdLightweight, headless TypeScript ORM with zero dependencies. Drizzle excels at:
.with() without manual joinsCore patterns: one table per file, relational API for nested queries, prepared statements for hot paths, transactions for consistency.
When working with Drizzle ORM:
defineRelations() for one-to-many, many-to-many; enables nested queriesdb.transaction()drizzle-kit migrate:dev before push; review generated SQLInferSelectModel for runtime types from schemaPatterns are organized by concern:
with() for nested data, partial columns, filteringSee rules/ for implementation patterns and examples.
User: "Define a Drizzle schema for orders with relations to users and products."
Expected behavior: Use tech-drizzle guidance, apply schema design with relational queries and type inference.
User: "Write a raw SQL migration for adding a column to the users table."
Expected behavior: Do not prioritize tech-drizzle; choose a more relevant skill or proceed without it.
Error: Running unprepared queries in tight loops
Cause: Query compiled every execution; no reuse of parsed SQL
Solution: Use .prepare() with placeholders; execute multiple times with different params
Error: Manual joins in code; fetching parent then children separately
Cause: Not using relational API; writing complex join logic
Solution: Define relations, use .with() to fetch nested data in single query
Error: Column not included in result when selecting from relation
Cause: Selecting from nested relation without explicitly including columns
Solution: Use columns: { id: true, name: true } to specify nested relation columns
Error: Transaction rolls back unexpectedly; no clear error
Cause: Unhandled promise rejection inside db.transaction()
Solution: Wrap transaction operations in try/catch; all errors must be caught
Error: Schema types not updating after migration
Cause: drizzle-kit didn't regenerate types; cache stale
Solution: Run drizzle-kit generate after migration changes
npx claudepluginhub ravnhq/ai-toolkitExpert in Drizzle ORM for TypeScript — schema design, relational queries, migrations, and serverless database integration. Use when building type-safe database layers with Drizzle.
Provides Drizzle ORM patterns for schema definition, CRUD operations, relations, queries, transactions, and migrations. Supports PostgreSQL, MySQL, SQLite, MSSQL, CockroachDB.
Provides type-safe SQL with Drizzle ORM for defining schemas, writing queries, setting relations, and running migrations across PostgreSQL, MySQL, SQLite, Cloudflare D1, and Durable Objects.