This is a production-ready skill for using Drizzle ORM with Cloudflare's D1 SQLite database. It gives you type-safe schema definitions, migration workflows via drizzle-kit, and handles D1's quirks like the batch API requirement for transactions (D1 doesn't support standard SQL BEGIN/COMMIT). The skill includes templates for CRUD operations, relations, and prepared statements, plus an error catalog covering the top issues like foreign key constraint failures and binding problems. The migration workflow is opinionated: generate locally, test with wrangler's local flag, then apply to production. Good choice if you want TypeScript-first database tooling on Cloudflare Workers without writing raw SQL.

skills.sh installs
435
GitHub stars
248
last updated
Aug 21, 2026

Install

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

Installs into .claude/skills of the current project.

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!,
  },
});

Sponsors

Details

Repository
github.com/secondsky/claude-skills
Categories
Backend & APIs, Documentation, Debugging, Automation & Workflows, Cloud & Infrastructure, Databases
First seen
Jun 3, 2026

More from secondsky/claude-skills

All 146
1davila7 avatarnextjs-supabase-authdavila7/claude-code-templatesExpert integration of Supabase Auth with Next.js App Router Use when: supabase auth next, authentication next.js, login supabase, auth middleware, protected rou410skills.sh installs
2onewave-ai avatarapi-endpoint-scaffolderonewave-ai/claude-skillsGenerate REST API endpoints with proper structure, validation, error handling, and types. Use when creating new API routes, endpoints, or backend services.312skills.sh installs
3nice-wolf-studio avatarsupabase-databasenice-wolf-studio/claude-code-supabase-skillsPerform database operations (CRUD) on Supabase tables using the REST API. Use for querying, inserting, updating, and deleting data in your Supabase database.300skills.sh installs
4cinience avataralicloud-database-rds-supabase-testcinience/alicloud-skillsMinimal smoke test for RDS Supabase skill. Validate endpoint reachability and one list/detail API.298skills.sh installs
5wix avatarwix-cli-backend-apiwix/skillsCreates HTTP endpoints for Wix CLI apps. Use only when the user specifically asks for a backend endpoint. Use when building REST API endpoints, backend HTTP han287skills.sh installs
6patricio0312rev avatarrest-to-graphql-migratorpatricio0312rev/skillsMigrates REST APIs to GraphQL incrementally with schema stitching, REST datasources, and gradual endpoint migration. Use when users request "migrate to GraphQL"274skills.sh installs