Skip to content

Type-safe Drizzle ORM setup for Cloudflare D1 covering schemas, migrations, queries, and batch transactions.

CCM score
52 of 100
skills.sh installs
443
GitHub stars
257
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers D1 schema definition, relations, prepared statements, Drizzle Kit migrations, and the D1 batch API
  • Includes drizzle.config.ts setup, Wrangler migration commands, and templates for CRUD, joins, and transactions
  • Enforces db.batch() for transactions because D1 rejects SQL BEGIN TRANSACTION statements
  • Designed for Workers projects that need typed SQL queries and a migration flow against remote D1 databases

Install

$ npx -y skills add secondsky/claude-skills --skill drizzle-orm-d1 -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Drizzle ORM for Cloudflare D1

Status: Production Ready ✅ Last Updated: 2025-12-14 Latest Version: drizzle-orm@0.45.2, drizzle-kit@0.31.10 Dependencies: cloudflare-d1, cloudflare-worker-base


Quick Start (10 Minutes)

1. Install Drizzle

bun add drizzle-orm drizzle-kit

2. Configure Drizzle Kit

Create drizzle.config.ts:

import { defineConfig } from 'drizzle-kit';

export default defineConfig({
  schema: './src/db/schema.ts',
  out: './migrations',
  dialect: 'sqlite',          // MANDATORY since drizzle-kit 0.21 (D1 = sqlite)
  driver: 'd1-http',          // D1 HTTP driver for remote migrations/Studio
  dbCredentials: {            // MANDATORY: drizzle-kit 0.30+ tightened zod validation
    accountId: process.env.CLOUDFLARE_ACCOUNT_ID!,
    databaseId: process.env.CLOUDFLARE_DATABASE_ID!,
    token: process.env.CLOUDFLARE_D1_TOKEN!,
  },
});

Details

Repository
github.com/secondsky/claude-skills
Categories
Databases, Backend & APIs
First seen
Jun 3, 2026

Questions

What is the drizzle-orm-d1 skill for?

The drizzle-orm-d1 skill gives Claude Code a type-safe ORM workflow for Cloudflare D1 databases using Drizzle. It covers building D1 schemas, writing type-safe queries, managing migrations with Drizzle Kit, defining table relations, and using the D1 batch API. It also helps with D1_ERROR, transaction errors and foreign key constraint failures.

How do I install the drizzle-orm-d1 skill?

Run npx -y skills add secondsky/claude-skills --skill drizzle-orm-d1 -y in your project to install it. Once installed, the agent can write D1 schemas, generate migrations and run type-safe queries against your Cloudflare D1 database.

How does drizzle-orm-d1 handle transactions on Cloudflare D1?

The skill tells the agent to use the D1 batch API, db.batch([...]), instead of SQL BEGIN TRANSACTION, because D1 rejects it. It also explains how to define cascading foreign keys so constraint failures are avoided. The skill sits in the Databases category on Claude Marketplaces.

More from secondsky/claude-skills

All 116

Similar to Drizzle Orm D1

More Databases