drizzle-orm

drizzle-orm is a skill for Claude Code, Codex from monkilabs/opencastle. It costs 48 tokens per session (492 once invoked), scanned A, original, MIT.

A guide to Drizzle ORM, a TypeScript library that lets code define database tables and run type-checked queries. It covers PostgreSQL, MySQL, and SQLite projects.

In plain words
What is it for?
Defining schemas, writing joins and relational queries, performing CRUD operations, running transactions, and generating or applying migrations.
Why use it?
It helps avoid mismatches between application code and database structure, and makes migrations safer to review and apply.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Defining schemas, writing joins and relational queries, performing CRUD operations, running transactions, and generating or applying migrations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/monkilabs/opencastle/drizzle-orm
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add monkilabs/opencastle --skill drizzle-orm
Clone the repo
git clone --depth 1 https://github.com/monkilabs/opencastle

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for drizzle-orm

README.md
[![agentmods](https://agentmods.dev/badge/skills/monkilabs/opencastle/drizzle-orm/github.svg)](https://agentmods.dev/skills/monkilabs/opencastle/drizzle-orm)
Your own site
<a href="https://agentmods.dev/skills/monkilabs/opencastle/drizzle-orm"><img src="https://agentmods.dev/badge/skills/monkilabs/opencastle/drizzle-orm/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for drizzle-orm

Your own site · 80×15
<a href="https://agentmods.dev/skills/monkilabs/opencastle/drizzle-orm"><img src="https://agentmods.dev/badge/skills/monkilabs/opencastle/drizzle-orm.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 492 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00048 $0.00492
Opus 5.5 $0.00019 $0.00197
Sonnet 5.5 $0.00010 $0.00098
Haiku 4.5 $0.00005 $0.00049

Measured 11d ago against content hash ba6a25840570, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

drizzle-orm scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

src/orchestrator/plugins/drizzle/skills/drizzle-orm/SKILL.md · 27 lines

What it actually says

Drizzle ORM

Gotchas

  • drizzle(client, { schema }) — omit { schema } and the db.query.* relational API silently does not exist.
  • relations() is ORM-level metadata only and creates no constraint. Define references(() => users.id, { onDelete: 'cascade' }) as well; you need both.
  • Types come from typeof table.$inferSelect / $inferInsert — never hand-write them.
  • SQL-like API (db.select().from()) for joins and aggregates; relational API (db.query.x.findMany({ with: {...} })) for nested reads. insert/update/delete give back nothing usable without .returning().
  • Inside db.transaction(async (tx) => ...) every call must use tx; a stray db call runs outside the transaction.
  • Prepared statements need sql.placeholder('id') + .prepare('name'), then .execute({ id }).
  • Partial selects (db.select({ id: users.id })) avoid loading unused columns; declare indexes in the table definition.

drizzle-kit

  • generate → review the SQL in the out dir → migrate. push is dev-only. Never edit generated SQL; fix the schema and regenerate. check validates migration history consistency.
  • A column rename generates DROP + ADD, i.e. data loss. Hand-write the migration file instead — ALTER TABLE users RENAME COLUMN old_name TO new_name; — then migrate applies it.
  • A new non-nullable column takes two migrations: add nullable → backfill → add .notNull() → migrate again.
  • The programmatic migrator needs a single connection: postgres(url, { max: 1 }), then migrate(drizzle(client), { migrationsFolder: './drizzle' }), then close it.
  • drizzle.config.ts must supply dialect, schema, out, and dbCredentials.url before any command runs.

Docs: https://orm.drizzle.team/

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago Changed · -21 tokens per session ba6a25840570
  2. 12d ago First seen · 27 lines · 69 tokens per session scan A 7a7e37481dab

Subscribe to this mod's changes

drizzle-orm is a skill published in the GitHub repository monkilabs/opencastle (80 stars, last pushed yesterday), licensed MIT. It adds 48 tokens to every session and 492 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-04.

Related

Other skills, from other repositories

transactional-patterns

Use when defining or debugging Spring Boot 3 database transaction boundaries, rollback, propagation, optimistic-lock retries, or commit-bound events. For duplicate HTTP commands use idempotency-patterns; for reactive transactions use webflux-reactive-patterns.

rrezartprebreza/spring-boot-skills · 53 tokens

spring-data-jpa

Use when generating JPA entities, repositories, queries, or anything touching the persistence layer. Covers entity conventions, N+1 prevention, projections, and query patterns.

rrezartprebreza/spring-boot-skills · 38 tokens

spring-data-redis

Use when implementing caching, session storage, rate limiting, or any Redis integration. Covers cache-aside pattern, key naming, TTL strategy, and serialization config.

rrezartprebreza/spring-boot-skills · 37 tokens

flyway-migrations

Use when creating database migrations, schema changes, seed data, or any SQL that modifies database structure. Covers Flyway naming conventions, versioning, and safe migration patterns.

rrezartprebreza/spring-boot-skills · 39 tokens

idempotency-patterns

Use when making retried HTTP commands or message processing safe against duplicate effects, including database-backed request keys, payload conflicts and concurrent retries. Do not apply caching as a substitute for business idempotency.

rrezartprebreza/spring-boot-skills · 46 tokens

multi-tenancy

Use when implementing tenant resolution, database or schema isolation, tenant-aware JPA, reactive tenant context, migrations, caching, jobs, or authorization in Spring Boot 3.

rrezartprebreza/spring-boot-skills · 38 tokens