Skip to content

// Drizzle ORM — SQL-first TypeScript, schema, queries, migrations, edge-runtime compatible.

Drizzle ORM Builder

skill --stat
  • last update

    Jun 2, 2026

  • license

    MITv1.0.0

  • format

    SKILL.md

quickstart.sh
3 steps
  1. Install

    // Downloads SKILL.md into ~/.claude/skills/drizzle-orm-builder/

    $ curl -fsSL --create-dirs -o ~/.claude/skills/drizzle-orm-builder/SKILL.md https://claudeskil.com/skills/drizzle-orm-builder/SKILL.md
  2. Invoke

    // Inside Claude Code, type the skill name as a slash command

    > /drizzle-orm-builder scaffold a typed REST endpoint
  3. Or copy this from the README

    // extracted ts block

    $ // src/db/schema.ts
    import { pgTable, serial, text, timestamp } from "drizzle-orm/pg-core";
    
    export const users = pgTable("users", {
      id: serial("id").primaryKey(),
      email: text("email").notNull().unique(),
drizzle-orm-builder/
references
SKILL.md
readonly
name:
Drizzle ORM Builder
slug:
drizzle-orm-builder
version:
v1.0.0
license:
MIT
author:
@chiragthummar16
categories:
tags:
#drizzle#orm#typescript#sql#edge
description:

Drizzle ORM — SQL-first TypeScript, schema, queries, migrations, edge-runtime compatible.

README.md

drizzle-orm-builder/README.md
6 sections

Drizzle ORM Builder

Scaffolds and wires up a complete Drizzle ORM data layer for TypeScript projects: schema files, type-inferred queries, relations, and drizzle-kit migrations. It targets developers who want SQL they can read and a thin, fully-typed client — without the codegen step or runtime engine that heavier ORMs require. Works across Postgres, MySQL, SQLite/Turso, and edge runtimes.

When to use it

  • You're starting a new backend or API and want schema-as-code with end-to-end type inference.
  • You're deploying to Cloudflare Workers, Vercel Edge, or Bun, where a native binary engine won't run.
  • You're migrating off Prisma and want to map an existing schema introspected from a live database.
  • You need raw SQL escape hatches alongside a query builder, not one or the other.

What it does

The skill generates dialect-specific schema using pgTable, mysqlTable, or sqliteTable, with column helpers (serial, text, integer, timestamp, boolean) and constraints. It sets up relations() for the relational query builder so you can call db.query.users.findMany({ with: { posts: true } }). Types are inferred with $inferSelect / $inferInsert — no generated client.

It configures drizzle.config.ts and the drizzle-kit workflow: drizzle-kit generate to emit SQL migrations from schema diffs, drizzle-kit migrate to apply them, drizzle-kit push for prototyping, and drizzle-kit studio for the browser data viewer. For edge targets it picks the right driver — drizzle-orm/neon-http, drizzle-orm/d1, drizzle-orm/libsql, or postgres-js. It also includes a decision framework comparing Drizzle vs Prisma on bundle size, cold starts, and SQL control.

Usage

bash
curl -fsSL --create-dirs -o ~/.claude/skills/drizzle-orm-builder/SKILL.md https://claudeskil.com/skills/drizzle-orm-builder/SKILL.md
ts
// src/db/schema.ts
import { pgTable, serial, text, timestamp } from "drizzle-orm/pg-core";

export const users = pgTable("users", {
  id: serial("id").primaryKey(),
  email: text("email").notNull().unique(),
  createdAt: timestamp("created_at").defaultNow(),
});

export type User = typeof users.$inferSelect;
bash
npx drizzle-kit generate   # diff schema -> SQL migration
npx drizzle-kit migrate    # apply pending migrations

Tips & gotchas

  • push is great for local iteration but skips the migration history — never run it against production; use generate + migrate there.
  • The relational query API (db.query.*) and the SQL-like builder (db.select().from()) are separate; relations must be declared for the former to resolve with.
  • On Workers/D1, import from the dialect-specific edge driver, not the Node driver, or you'll hit runtime import errors.
  • defaultNow() sets the default in SQL; $defaultFn() runs in JS at insert time — pick based on where you want the value generated.

FAQ

Does Drizzle need a code-generation step? No. Types come from your schema objects via $inferSelect/$inferInsert at compile time, so there's no generated client to keep in sync.

Drizzle or Prisma? Choose Drizzle for minimal bundle size, edge/serverless cold starts, and direct SQL control; Prisma still leads on its GUI tooling and some DX conveniences. The skill walks you through the tradeoffs for your stack.

Can I write raw SQL? Yes — use the sql template tag for fragments or db.execute(sql\...`)` for full statements, with parameters still escaped safely.

$ cat reviews/

Reviews

// No reviews yet. Be the first.
Loading review form…

$ ls related/

explore all →