What problem does it solve? Setting up Drizzle ORM with Cloudflare D1 involves subtle pitfalls—transaction errors, foreign key migration failures, binding mismatches, and TypeScript inference issues—that cause production bugs and wasted debugging time. ## Core Features & Use Cases - Schema & Migration Workflow: Define SQLite-compatible schemas with relations, generate SQL migrations via drizzle-kit, and apply them through Wrangler with a local-first testing process. - Type-Safe Query Patterns: Provides CRUD, joins, batch operations, and prepared statement templates with full TypeScript inference for D1 Workers. - Known Issue Prevention: Documents 12 documented D1/Drizzle errors (e.g., BEGIN TRANSACTION failures, foreign key constraint errors) with concrete fixes. - Use Case: When building a Cloudflare Worker backed by a D1 database, use this Skill to scaffold the schema, generate migrations, and write queries without hitting D1-specific transaction or binding errors. ## Quick Start Ask the agent to set up Drizzle ORM with a Cloudflare D1 database, define a users and posts schema, and generate the initial migration.