jezweb avatar

D1 Drizzle Schema

Generates Drizzle ORM schemas that actually work with Cloudflare D1's quirks. D1 is SQLite-based but foreign keys are always enforced, there's a 100 bound parameter limit that breaks naive bulk inserts, and you need specific column modes for booleans and timestamps or you'll store garbage. This handles all of that automatically and produces schema files, migration commands, type exports, and a DATABASE_SCHEMA.md for documentation. Use it when scaffolding a new D1 database or adding tables to an existing one. Saves you from the annoying trial-and-error of learning D1's differences from standard SQLite the hard way.

skills.sh installs
1.7K
GitHub stars
1.1K
last updated
Aug 21, 2026

Install

$ npx -y skills add jezweb/claude-skills --skill d1-drizzle-schema --agent claude-code

Installs into .claude/skills of the current project.

Files

D1 Drizzle Schema

Generate correct Drizzle ORM schemas for Cloudflare D1. D1 is SQLite-based but has important differences that cause subtle bugs if you use standard SQLite patterns. This skill produces schemas that work correctly with D1's constraints.

Critical D1 Differences

FeatureStandard SQLiteD1
Foreign keysOFF by defaultAlways ON (cannot disable)
Boolean typeNoNo — use integer({ mode: 'boolean' })
Datetime typeNoNo — use integer({ mode: 'timestamp' })
Max bound params~999100 (affects bulk inserts)
JSON supportExtensionAlways available (json_extract, ->, ->>)
ConcurrencyMulti-writerSingle-threaded (one query at a time)

Workflow

Step 1: Describe the Data Model

Gather requirements: what tables, what relationships, what needs indexing. If working from an existing description, infer the schema directly.

Step 2: Generate Drizzle Schema

Create schema files using D1-correct column patterns:

import { sqliteTable, text, integer, real, index, uniqueIndex } from 'drizzle-orm/sqlite-core'

Sponsors

Details

Repository
github.com/jezweb/claude-skills
Categories
Backend & APIs, Documentation, Cloud & Infrastructure, Databases
First seen
Apr 16, 2026

More from jezweb/claude-skills

All 166
1loops-so avatarloops-apiloops-so/skillsUse this skill whenever the user wants to integrate Loops from application code, backend services, webhook handlers, or server-side automation. This includes th1.6Kskills.sh installs
2jezweb avatarhono-api-scaffolderjezweb/claude-skillsScaffold Hono API routes for Cloudflare Workers. Produces route files, middleware, typed bindings, Zod validation, error handling, and API_ENDPOINTS.md document1.6Kskills.sh installs
3ccheney avatarpostgres-drizzleccheney/robust-skillsProactively apply when creating APIs, backends, or data models. Triggers on PostgreSQL, Postgres, Drizzle, drizzle-orm, drizzle-kit, database, schema, pgTable, 1.5Kskills.sh installs
4aj-geddes avatarflask-api-developmentaj-geddes/useful-ai-promptsDevelop lightweight Flask APIs with routing, blueprints, database integration, authentication, and request/response handling. Use when building RESTful APIs, mi1.4Kskills.sh installs
5langfuse avatarbackend-dev-guidelineslangfuse/langfuseBuild or review Langfuse backend code. Use for tRPC routers, public REST APIs, BullMQ processors, services, middleware, Prisma or ClickHouse access, OpenTelemet1.4Kskills.sh installs
6bobmatnyc avatardrizzle-migrationsbobmatnyc/claude-mpm-skillsMigration-first database development workflow using Drizzle ORM for TypeScript/J...1.3Kskills.sh installs