What problem does it solve? Working with Cloudflare D1 through Drizzle ORM involves platform-specific pitfalls: D1 rejects SQL transactions, caps bound parameters at 100, silently drops relational query results when relations are not re-exported, and can destroy data during table-rebuild migrations. This Skill encodes the correct patterns and a catalog of real errors so you avoid these failures from the start. ## Core Features & Use Cases - Schema Design Patterns: Conventions for naming, primary keys, timestamps, indexes, enums, foreign keys with cascade rules, and relations that keep the relational query API working. - Query Recipes: CRUD operations, manual joins, the relational query API, db.batch for atomic multi-statement work, chunked inserts for the 100-parameter limit, prepared statements, and JSON column querying. - Migration Workflow: A safe generate-apply-deploy pipeline using wrangler with production env selection, rename handling, and guidance for dangerous table-rebuild migrations. - Error Catalog: Seventeen documented D1 + Drizzle errors with actual fixes, from BEGIN TRANSACTION failures to silent cascade data loss. - Use Case: You are adding a posts table with an author foreign key to a Cloudflare Worker. The Skill guides you to declare onDelete cascade, re-export postsRelations from the schema barrel, generate the migration with drizzle-kit, and apply it locally before remote. ## Quick Start Ask the AI to set up a Drizzle schema with users and posts tables for a Cloudflare D1 database, including the client factory and migration commands.