roninforge/roninforge-drizzle/drizzle-validate

Claude Code and agent skill by roninforge/roninforge-drizzle

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Scan a Drizzle codebase for tracked anti-patterns. ~17 are reliably grep-detectable (Prisma include/select/nested-where leakage, removed casing API, old pgArray import path, deprecated drizzle-kit generate:pg, SQL injection via execute concatenation, .returning() on MySQL, missing await on builders, drizzle-kit push in production, relations() in same file as schema, drizzle-orm <0.45.2 SQL injection CVE). The remaining few (selectDistinct vs select, join nested-vs-flat shape, drizzle-kit pull skipped on existing DBs) need manual review.

Install

npx vskill@latest install roninforge/roninforge-drizzle/drizzle-validate

SKILL.md

The same SKILL.md was published earlier as roninforge/roninforge-drizzle/drizzle-validate.

Validate Drizzle Codebase

When to Use

When auditing AI-generated Drizzle code, reviewing a PR, or preparing a Drizzle project for production handoff. Output is a list of locations with severity tags.

Instructions

Run each grep against the project root. Severity tags map to the reviewer agent's output (CRITICAL / ERROR / WARN). Each hit is a candidate; review case by case.

CRITICAL: SQL injection via string concatenation in db.execute
bash
grep -rnE 'db\.execute\(\s*[`"][^`"]*\$\{' --include='*.ts' src/

Every hit is exploitable. Replace with sql\...\${var}...\``.

CRITICAL: drizzle-orm < 0.45.2 (sql.identifier injection CVE)
bash
grep -nE '"drizzle-orm":\s*"[~^]?0\.(2[0-9]|3[0-9]|4[0-4]|45\.[01])([."])' package.json

If this matches, bump to ^0.45.2. The CVE is in sql.identifier() and sql.as() escaping.

CRITICAL: drizzle-kit push in production deploy scripts
bash
grep -rn 'drizzle-kit\s\+push' .github/ scripts/ package.json deploy/ 2>/dev/null

push writes the schema diff with no migration history. Replace with migrate.

ERROR: Prisma include / select / nested-where leakage
bash
# Prisma `include:` inside db.query.X.findMany / findFirst
grep -rnE 'db\.query\.[A-Za-z0-9_]+\.(findMany|findFirst)\([^)]*\binclude\s*:' --include='*.ts' src/
# Prisma `select:` inside same
grep -rnE 'db\.query\.[A-Za-z0-9_]+\.(findMany|findFirst)\([^)]*\bselect\s*:' --include='*.ts' src/
# Prisma nested-where (heuristic: where: { word: { ... } })
grep -rnE 'where\s*:\s*\{\s*[a-z][A-Za-z0-9_]+\s*:\s*\{' --include='*.ts' src/

The first two will not type-check. The third is a heuristic - manual triage required.

ERROR: Deprecated drizzle-kit subcommand
bash
grep -rn 'drizzle-kit\s\+\(generate\|push\|drop\|migrate\):\(pg\|mysql\|sqlite\)' \
package.json scripts/ Makefile 2>/dev/null

Replace generate:pg etc with generate (dialect from config) or generate --dialect=postgresql (explicit).

ERROR: Old pgArray import path (when on v1.x)
bash
# Only fire if package.json pins drizzle-orm@1.x
if grep -q '"drizzle-orm":\s*"[~^]\?1\.' package.json; then
grep -rnE 'from\s+["'"'"']drizzle-orm/pg-core/utils["'"'"']' --include='*.ts' src/
fi

Path moved to /array in 1.0-rc.1.

ERROR: Casing API on drizzle() (when on v1.x)
bash
if grep -q '"drizzle-orm":\s*"[~^]\?1\.' package.json; then
grep -rnE 'drizzle\([^)]*casing\s*:' --include='*.ts' src/
fi

Removed in 1.0-rc.1. Use per-table builders.

ERROR: Wrong dialect import for schema
bash
# pgTable imported from a driver namespace
grep -rnE 'import\s*\{[^}]*\bpgTable\b[^}]*\}\s*from\s+["'"'"']drizzle-orm/(postgres-js|node-postgres|neon-http|neon-serverless|vercel-postgres)["'"'"']' --include='*.ts' src/
# Same for mysql
grep -rnE 'import\s*\{[^}]*\bmysqlTable\b[^}]*\}\s*from\s+["'"'"']drizzle-orm/(mysql2|planetscale-serverless|tidb-serverless)["'"'"']' --include='*.ts' src/
# Same for sqlite
grep -rnE 'import\s*\{[^}]*\bsqliteTable\b[^}]*\}\s*from\s+["'"'"']drizzle-orm/(better-sqlite3|d1|libsql)["'"'"']' --include='*.ts' src/

Schema imports come from pg-core / mysql-core / sqlite-core. The driver namespaces export drizzle only.

ERROR: .returning() on MySQL or SQLite-D1
bash
# Files importing from mysql-core or d1 driver
for f in $(grep -rl -E 'drizzle-orm/(mysql-core|d1)' --include='*.ts' src/); do
grep -nH '\.returning(' "$f"
done

RETURNING is Postgres-only at the SQL level (also better-sqlite3 supports it; D1 does not yet).

ERROR: Missing await on builder chains

GNU grep with PCRE (Linux, or brew install grep on macOS):

bash
grep -rnP '(?<!\bawait\s)\bdb\.(select|insert|update|delete|execute)\(' --include='*.ts' src/

Portable fallback (works on stock macOS BSD grep - no PCRE):

bash
grep -rnE '\bdb\.(select|insert|update|delete|execute)\(' --include='*.ts' src/ \
| grep -vE '\bawait\b'
Stock macOS /usr/bin/grep does NOT support -P. Without gnu-grep installed, the PCRE form silently exits with grep: invalid option -- P. Use the fallback or install brew install grep and call it as ggrep.

False positives on assignment to a const followed by .then(...) are real but rare. Manual triage.

ERROR: v0 returned-object index shape
bash
# Heuristic - find files that have pgTable AND a callback returning an object literal
# (pgTable definitions span many lines, so this is a two-step grep)
for f in $(grep -rl 'pgTable(' --include='*.ts' src/); do
grep -nE '=>\s*\(\s*\{' "$f" | grep -v ':\s*//' && echo " ^ $f - check for v0 returned-object index shape"
done

From 0.31 onward the third arg returns an array. Manually triage the matches - => ({ can also be a normal arrow returning an object that has nothing to do with pgTable.

WARN: relations() in the same file as the schema (circular import risk)
bash
# Files that contain BOTH pgTable( and relations(
for f in $(grep -rl 'pgTable(' --include='*.ts' src/db/schema/ 2>/dev/null); do
grep -q 'relations(' "$f" && echo "$f: relations() in schema file"
done

Move relations() to a sibling relations.ts that imports from the schema index.

WARN: Transaction callback uses outer db
bash
# Two-step heuristic: find files containing db.transaction, then list any db.X
# inside those files. Manual triage needed - a `db.` reference outside the
# transaction block is a false positive.
for f in $(grep -rl 'db\.transaction' --include='*.ts' src/); do
echo "=== $f ==="
grep -nE '\bdb\.(select|insert|update|delete|execute|query)\(' "$f"
done

Drizzle transactions use the tx argument from the callback. Any db.* call inside the callback body escapes the transaction silently.

WARN: pgEnum used as a TypeScript type
bash
grep -rnE 'type\s+\w+\s*=\s*[a-z]\w*Enum\s*[;,]' --include='*.ts' src/

Declare the union manually, brand the column with $type<T>().

WARN: serial() instead of identity column
bash
grep -rn '\.primaryKey\(\)' --include='*.ts' src/db/schema/ | grep 'serial('

Identity columns (integer().primaryKey().generatedAlwaysAsIdentity()) are SQL-standard and don't burn the sequence on insert conflicts.

WARN: timestamp without timezone
bash
grep -rnE 'timestamp\(\s*\)' --include='*.ts' src/db/schema/
grep -rnE 'timestamp\(\s*\{[^}]*\}\s*\)' --include='*.ts' src/db/schema/ | grep -v 'withTimezone'

Prefer timestamp({ withTimezone: true }). Date-only fields can stay non-timestamptz.

WARN: HTTP driver in code that calls db.transaction
bash
# Find the driver import and check if any file in the same project calls db.transaction
if grep -rqE 'drizzle-orm/(neon-http|vercel-postgres|planetscale-serverless)' --include='*.ts' src/; then
grep -rn 'db\.transaction\(' --include='*.ts' src/
fi

HTTP drivers do not support transactions across requests; each query is its own request.

Output Format

=== Critical ===
src/api/users.ts:34 - SQL injection via db.execute string concat; use sql template tag
package.json:12 - drizzle-orm 0.42.0 (CVE in sql.identifier); bump to ^0.45.2
.github/workflows/deploy.yml:18 - drizzle-kit push in deploy script; switch to migrate
=== Errors ===
src/db/queries.ts:55 - Prisma `include:` in db.query.users.findMany; use `with:`
package.json:14 - drizzle-kit generate:pg deprecated; use `generate`
src/db/index.ts:8 - pgTable imported from drizzle-orm/postgres-js (driver); use pg-core
=== Warnings ===
src/db/schema/users.ts:42 - relations() in same file as pgTable; move to relations.ts
src/db/schema/orders.ts:12 - serial() primary key; prefer generatedAlwaysAsIdentity()
=== Suggestions ===
src/db/schema/orders.ts:18 - timestamp() without withTimezone; prefer timestamptz

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/roninforge/roninforge-drizzle/drizzle-validate/badge)](https://verified-skill.com/skills/roninforge/roninforge-drizzle/drizzle-validate)

Something wrong with this skill or its page? Tell us.