Drizzle

Build type-safe database queries with Drizzle ORM patterns.

MIT-0 · Free to use, modify, and redistribute. No attribution required.
2 · 955 · 9 current installs · 9 all-time installs
byIván@ivangdavila
MIT-0
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name/description align with content: SKILL.md contains Drizzle ORM patterns, migration notes, driver specifics and performance tips. Declaring npx as a required binary is appropriate for an npm-based CLI workflow.
Instruction Scope
The instructions are scoped to schema, queries, migrations and driver-specific behavior (expected for an ORM helper). They mention CLI commands (drizzle-kit push/generate/migrate) and config files (drizzle.config.ts, schema file). These are relevant, but the mention of destructive commands (drizzle-kit push) means an agent that actually executes these could alter or destroy databases — the doc itself warns about dev vs production, but exercising the skill in an environment with live DB credentials would be risky.
Install Mechanism
Instruction-only skill with no install spec and no code files. This is the lowest-risk install posture. Required binary npx is declared and appropriate.
Credentials
Skill declares no environment variables or credentials, which matches the guidance-only nature. Note: actual use of Drizzle CLI against a database will require DB connection credentials — the skill doesn't request them, but an agent using the skill may need them to run migrations or queries.
Persistence & Privilege
always is false and the skill doesn't request persistent system changes or modify other skills. Autonomous invocation is allowed (platform default) but not combined with other concerning privileges.
Assessment
This is a documentation-only skill about Drizzle ORM and appears coherent. Before installing: ensure npx is available; do not let the agent run migration commands against production databases — migration commands (especially drizzle-kit push) can be destructive; be prepared to provide DB credentials when you actually run CLI commands (the skill itself doesn't request them); review any commands the agent proposes to execute and run them manually in a safe/dev environment first.

Like a lobster shell, security has layers — review code before you run it.

Current versionv1.0.0
Download zip
latestvk975frzndg0hf3h5p6ses5rdth80wwy2

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

Runtime requirements

💧 Clawdis
OSLinux · macOS · Windows
Binsnpx

SKILL.md

Schema Definition

  • Export every table from schema file — queries fail silently if table isn't exported
  • Use $inferSelect for query return types, $inferInsert for insert input — they differ (select has defaults filled, insert has optionals)
  • Define relations() in a separate call, not inline with table — Drizzle separates schema from relations

Query Syntax Traps

  • Conditions use functions, not objects: where: eq(users.id, 5) not where: { id: 5 } — Prisma syntax doesn't work
  • Combine conditions with and() / or(): where: and(eq(users.active, true), gt(users.age, 18))
  • db.query.users.findMany() for relational queries with with:, db.select().from(users) for SQL-like — mixing them causes type errors

Migrations

  • drizzle-kit push is dev-only (destructive) — production needs drizzle-kit generate then drizzle-kit migrate
  • Schema changes require regenerating migrations — editing generated SQL breaks the migration hash
  • Set strict: true in drizzle.config.ts to catch schema drift before it hits production

Driver-Specific

  • PostgreSQL: use pgTable, imports from drizzle-orm/pg-core
  • MySQL: use mysqlTable, imports from drizzle-orm/mysql-core
  • SQLite: use sqliteTable, imports from drizzle-orm/sqlite-core
  • Mixing imports across drivers compiles but fails at runtime with cryptic errors

Performance

  • Wrap multi-query operations in db.transaction(async (tx) => {}) — Drizzle doesn't auto-batch
  • Use .prepare() for queries executed repeatedly — skips query building overhead
  • Add .limit() to every findMany() / select() — no default limit means full table scans

Common Mistakes

  • Forgetting await on queries returns a Promise, not results — TypeScript doesn't catch this if you ignore the return
  • returning() is required to get inserted/updated rows back — without it you get { rowCount } only
  • JSON columns: PostgreSQL uses jsonb(), MySQL uses json() — wrong function = wrong serialization

Files

1 total
Select a file
Select a file to preview.

Comments

Loading comments…