cloudflare-d1

Installation
Summary

Serverless SQLite database on Cloudflare's edge with migrations, batch queries, and built-in error prevention.

  • Create and manage D1 databases with wrangler CLI, apply SQL migrations sequentially with automatic tracking, and query from Workers using prepared statements with .bind() for SQL injection prevention
  • Supports three query methods: .all() for multiple rows, .first() for single row, .batch() for sequential multi-statement execution in one network round trip
  • Prevents 14 documented errors including statement length limits (batch into 100-250 rows), transient network failures (implement exponential backoff retry), foreign key conflicts (use PRAGMA defer_foreign_keys), and scaling limits (sharding for 10 GB cap, hybrid D1+R2 for 2 MB row size)
  • Automatic read-only query retries (up to 2 attempts), remote bindings for local dev connecting to production D1, and jurisdiction support for data localization compliance
SKILL.md

Cloudflare D1 Database

Status: Production Ready ✅ Last Updated: 2026-01-20 Dependencies: cloudflare-worker-base (for Worker setup) Latest Versions: wrangler@4.59.2, @cloudflare/workers-types@4.20260109.0

Recent Updates (2025):

  • Nov 2025: Jurisdiction support (data localization compliance), remote bindings GA (wrangler@4.37.0+), automatic resource provisioning
  • Sept 2025: Automatic read-only query retries (up to 2 attempts), remote bindings public beta
  • July 2025: Storage limits increased (250GB → 1TB), alpha backup access removed, REST API 50-500ms faster
  • May 2025: HTTP API permissions security fix (D1:Edit required for writes)
  • April 2025: Read replication public beta (read-only replicas across regions)
  • Feb 2025: PRAGMA optimize support, read-only access permission bug fix
  • Jan 2025: Free tier limits enforcement (Feb 10 start), Worker API 40-60% faster queries

Quick Start (5 Minutes)

Related skills
Installs
414
GitHub Stars
776
First Seen
Jan 20, 2026