drizzle-orm-expert

A TypeScript guide for Drizzle ORM, a library that lets application code work with databases using typed schemas and queries. It covers PostgreSQL, SQLite, MySQL, migrations, relationships, and serverless database setups.

In plain words
What is it for?
Use it to define database schemas, write relational queries, create migrations, connect Drizzle to web frameworks, improve query performance, or migrate from Prisma, TypeORM, or Knex.
Why use it?
It reduces errors when designing database tables, writing queries, and changing schemas over time. It also helps teams move from other database libraries or adapt database access for edge and serverless environments.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/random6913/claude-code-superkit/drizzle-orm-expert
Any agent
npx skills add RaNDoM6913/claude-code-superkit --skill drizzle-orm-expert
Clone the repo
git clone --depth 1 https://github.com/RaNDoM6913/claude-code-superkit

Made for: Claude Code, Codex.

Per session 50 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,122 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00050 $0.02122
Opus 5 $0.00025 $0.01061
Sonnet 5 $0.00010 $0.00424
Haiku 4.5 $0.00005 $0.00212

Measured yesterday against content hash 050cc637c1ed, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

drizzle-orm-expert 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 yesterday.

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.

packages/codex/skills/drizzle-orm-expert/SKILL.md · 247 lines

How it starts

The opening of the file, as written. The whole thing — 247 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Drizzle ORM Expert

TypeScript-first ORM that compiles to raw SQL with zero runtime overhead. Ideal for edge runtimes and serverless. Two complementary APIs: SQL-like query builder and Prisma-style relational queries.

Use this skill when

  • Setting up Drizzle ORM in a new or existing project
  • Designing database schemas with Drizzle's TypeScript-first approach
  • Writing complex relational queries (joins, subqueries, aggregations)
  • Setting up or troubleshooting Drizzle Kit migrations
  • Integrating Drizzle with Next.js App Router, tRPC, or Hono
  • Optimizing performance (prepared statements, batching, pooling)
  • Migrating from Prisma, TypeORM, or Knex

Do not use this skill when

  • The DB layer uses Prisma, TypeORM, or raw SQL exclusively
  • You need a database-agnostic ORM guide
  • The task is about DB server configuration (use postgresql-optimization)

Workflow

  1. Identify the DB driver (PostgreSQL, SQLite, MySQL) and select the adapter
  2. Define schema in db/schema.ts (or domain-split db/schema/users.ts)
  3. Define relations separately so the relational query API (db.query.*) works
  4. Use InferSelectModel and InferInsertModel for type inference — never manual interfaces
  5. Run drizzle-kit generate then migrate for schema changes in production
  6. Never use drizzle-kit push in production

Core Architecture

Drizzle ORM compiles TypeScript schema definitions into prepared SQL statements at build time. There is no runtime query engine binary (unlike Prisma), which makes it edge-compatible (Cloudflare Workers, Vercel Edge Functions, Deno Deploy).

Two APIs coexist:

  • SQL-like builder: db.select().from().where().join().orderBy() — close to SQL semantics
  • Relational query API: db.query.users.findMany({ with: { posts: true } }) — Prisma-style nested fetching

Schema Design

import { pgTable, uuid, text, timestamp, pgEnum, index, uniqueIndex } from 'drizzle-orm/pg-core';

export const roleEnum = pgEnum('role', ['admin', 'user', 'guest']);

export const users = pgTable('users', {
  id: uuid('id').defaultRandom().primaryKey(),
  email: text('email').notNull().unique(),
  role: roleEnum('role').default('user').notNull(),
  createdAt: timestamp('created_at').defaultNow().notNull(),
}, (table) => ({
  emailIdx: uniqueIndex('users_email_idx').on(table.email),
  createdIdx: index('users_created_idx').on(table.createdAt),
}));

export const posts = pgTable('posts', {
  id: uuid('id').defaultRandom().primaryKey(),
  userId: uuid('user_id').references(() => users.id, { onDelete: 'cascade' }).notNull(),
  title: text('title').notNull(),
});

Read the full file on GitHub · 247 lines

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. yesterday First seen · 247 lines · 50 tokens per session scan A 050cc637c1ed

Subscribe to this mod's changes

drizzle-orm-expert is a skill published in the GitHub repository RaNDoM6913/claude-code-superkit (2 stars, last pushed 1mo ago), licensed MIT. It adds 50 tokens to every session and 2,122 once invoked, about $0.0003 per session on Opus 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-08-31.

Related

Other skills, from other repositories

apm-review-panel

Use this skill to run a multi-persona expert advisory review on a labelled pull request in microsoft/apm. The panel fans out to five mandatory specialists plus a test-coverage specialist (active on every PR that touches src/) plus three conditional specialists (auth, doc-writer, performance-expert), all running in…

microsoft/apm · 178 tokens

apm-issue-autopilot

Use this skill to drive any open microsoft/apm issue (bug, feature, docs, refactor, perf) from raw intake to a mergeable PR with triage as the central, paramount gate. Run the apm-triage-panel rubric per issue first, then present ONE consolidated triage review for the whole batch and escalate to the maintainer BY…

microsoft/apm · 238 tokens

apm-spec-guardian

Use this skill to run a four-panel adversarial advisory review on any pull request that touches the OpenAPM specification artifact (docs/src/content/docs/specs/openapm-.md), its inline / sidecar JSON Schemas (docs/src/content/docs/specs/schemas/.schema.json), or the conformance fixture seed…

microsoft/apm · 215 tokens

apm-triage-panel

Use this skill to triage one microsoft/apm issue selected by the daily sweep, the status/needs-triage fast path, or manual dispatch. Emit one synthesized comment with a decision, label set, exact milestone, and suggested next action.

microsoft/apm · 59 tokens

batch-bug-shepherd

Use this skill to drive a batch of suspected bugs in microsoft/apm from raw issue list to mergeable PR queue. Fan out one triage subagent per issue (LEGIT / UNCLEAR / FIXED-AT-HEAD), gate every legit bug against PRINCIPLES.md via an apm-ceo strategic-alignment pass, cross-reference legit issues against open PRs, then…

microsoft/apm · 227 tokens

cli-logging-ux

Use this skill when editing or creating CLI output, logging, warnings, error messages, progress indicators, or diagnostic summaries in the APM codebase. Activate whenever code touches console helpers (richsuccess, richwarning, richerror, richinfo, richecho), DiagnosticCollector, STATUSSYMBOLS, CommandLogger, or any…

microsoft/apm · 94 tokens