cloudflare-d1

Create and query Cloudflare D1 databases with prepared statements and migrations.

52|6|Updated Nov 24, 2025
One-click install
npx skills add https://github.com/ovachiever/droid-tings --skill cloudflare-d1-ovachiever
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cloudflare-d1
Source: https://github.com/ovachiever/droid-tings/tree/main/skills/cloudflare-d1
Command: npx skills add https://github.com/ovachiever/droid-tings --skill cloudflare-d1-ovachiever

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides comprehensive guidance for creating and managing Cloudflare D1 serverless SQLite databases, including migrations, bindings, and edge-safe queries from Workers.

Core Features & Use Cases

  • D1 Database Lifecycle: Create databases, configure wrangler bindings, and manage migrations.
  • Bindings & Migrations: Set up wrangler.jsonc bindings and versioned migrations.
  • Query Patterns: Use prepared statements with bound parameters for safe, efficient queries.
  • Use Case: Deploy an edge-friendly relational store with migrations and prepared statements for a Worker-based API.

Quick Start

Create a D1 database, configure bindings, and start with an initial migration.

Frequently Asked Questions about cloudflare-d1

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I deploy a SQLite database at the edge with Cloudflare Workers?

Cloudflare D1 lets you deploy SQLite databases directly to edge locations and query them from Workers. Create a D1 database, configure wrangler bindings in wrangler.jsonc, and use prepared statements with .bind() to safely execute queries at the edge without roundtrips to a central server.

What's the best way to handle database migrations with D1 and wrangler?

D1 uses versioned SQL migrations managed through wrangler. Create migration files in your project, configure them in wrangler.jsonc bindings, and apply them to both local development and remote environments. This ensures schema changes are tracked and reproducible across deployments.

Can I use prepared statements with D1 to prevent SQL injection?

Yes. D1 supports prepared statements with the .bind() method, which safely binds parameters to queries and prevents SQL injection. Use this pattern for all dynamic queries, and handle null values explicitly in your type-safe implementation.

Does D1 support batch querying for better performance?

D1 includes batch query support via the .batch() method, allowing you to execute multiple queries in a single request. This reduces latency and improves throughput for operations that don't require sequential dependencies.

How do I set up indexes and optimize D1 queries in production?

Create indexes during migrations to speed up frequent queries on large datasets. D1 supports standard SQLite index syntax. Monitor query performance in both local and remote environments, and use prepared statements with input validation to maintain efficiency at edge scale.