$npx skillfedfor your agent

cloudflare-d1

This skill streamlines Cloudflare D1 database setup by automating wrangler configuration, binding management, and migration workflows. It's built for developers using Claude Code CLI who need rapid database provisioning with minimal manual configuration overhead.

Cloudflare D1 streamlines setup through wrangler configuration. Start by creating a D1 database using `wrangler d1 create <database-name>`, then add the binding to your `wrangler.toml` file under the `[[d1_databases]]` section with your database ID. For migrations, create SQL files in a `migrations/` directory and apply them with `wrangler d1 migrations apply <database-name>`. The skill automates this configuration workflow, reducing manual setup overhead and enabling rapid database provisioning for developers using Claude Code CLI.

AI-generated summary based on this skill's SKILL.md

196 29 MITupdated by secondsky

Decision gist · record as of 2026-07-25

Cloudflare D1 streamlines setup through wrangler configuration. Start by creating a D1 database using `wrangler d1 create <database-name>`, then add the binding to your `wrangler.toml` file under the `[[d1_databases]]` section with your database ID. For migrations, create SQL files in a `migrations/` directory and apply them with `wrangler d1 migrations apply <database-name>`. The skill automates this configuration workflow, reducing manual setup overhead and enabling rapid database provisioning for developers using Claude Code CLI.

manual: git clone https://github.com/secondsky/claude-skills → cp -r claude-skills/plugins/cloudflare-d1/skills/cloudflare-d1 ~/.claude/skills/cloudflare-d1
plugins/cloudflare-d1/skills/cloudflare-d1/SKILL.md · version 25a881f6

Use it when

  • Cloudflare D1 provides three core API methods for query execution: `prepare()` for parameterized statements that prevent SQL injection.
  • Cloudflare D1 enforces a statement size limit.

Verify before relying

Read SKILL.md below before installing (11 files). Open directory: indexed for reading, not audited.

Same gist for agents: .md · .json

Install

secondsky/claude-skills/cloudflare-d1 · repository language: TypeScript

Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I set up a Cloudflare D1 database with wrangler bindings and migrations?

Cloudflare D1 streamlines setup through wrangler configuration. Start by creating a D1 database using `wrangler d1 create <database-name>`, then add the binding to your `wrangler.toml` file under the `[[d1_databases]]` section with your database ID. For migrations, create SQL files in a `migrations/` directory and apply them with `wrangler d1 migrations apply <database-name>`. The skill automates this configuration workflow, reducing manual setup overhead and enabling rapid database provisioning for developers using Claude Code CLI.

What are the main D1 API methods for writing and optimizing SQL queries?

Cloudflare D1 provides three core API methods for query execution: `prepare()` for parameterized statements that prevent SQL injection and improve performance, `batch()` for executing multiple queries in a single request to reduce latency, and `exec()` for running raw SQL directly. The `prepare()` method is optimal for repeated queries with different parameters, while `batch()` minimizes round trips when executing several independent statements. Using these methods correctly ensures both security and performance optimization in your D1 applications.

What does the 'statement too long' D1 error mean and how do I fix it?

Cloudflare D1 enforces a statement size limit, and the 'statement too long' error occurs when your SQL query or batch exceeds this threshold. To resolve it, break large queries into smaller, focused statements and use the `batch()` API to execute them together, or split complex operations across multiple API calls. Additionally, review your query logic—overly nested subqueries or massive IN clauses can be refactored using joins or temporary tables. The skill helps identify and troubleshoot such D1 errors including 429 rate-limit issues and query failures.

How can I deploy read replicas and global replication for low-latency reads with D1?

Cloudflare D1 supports read replicas to distribute query load and reduce latency across regions. Enable replication in your D1 configuration, then route read-only queries to replica locations closest to your users. This is particularly valuable for edge-deployed applications where latency matters. Cloudflare D1 handles replication synchronization automatically, allowing you to design globally distributed applications without manual replica management. The skill guides you through replica setup and optimization strategies for low-latency read performance.

What are D1 schema design best practices for indexes, type affinity, and migrations?

Cloudflare D1 schema design should prioritize type affinity—use INTEGER, TEXT, REAL, and BLOB types correctly to ensure efficient storage and query performance. Create indexes on frequently queried columns (especially foreign keys and WHERE clause filters) to accelerate lookups, but avoid over-indexing as it slows writes. Structure migrations incrementally in separate SQL files, applying them in order via wrangler to maintain consistency across environments. The skill emphasizes these best practices to help you build performant, maintainable schemas that scale efficiently on D1.

How do I test Cloudflare D1 locally with wrangler before deploying?

Cloudflare D1 supports local testing through wrangler's local mode. Run `wrangler d1 execute <database-name> --local` to test queries against a local SQLite instance, or use `wrangler dev --local` to simulate your entire worker environment. This allows you to validate migrations, test query logic, and debug schema issues before production deployment. Local testing reduces deployment risk and iteration time, making it essential for development workflows. The skill integrates local testing patterns to streamline your development cycle.

SKILL.md

Rendered from the published skill. Quoted content, verbatim.

Cloudflare D1

(truncated - see the full file via the links below)

File tree — 11 files
plugins/cloudflare-d1/skills/cloudflare-d1/SKILL.md
plugins/cloudflare-d1/skills/cloudflare-d1/references/2025-features.md
plugins/cloudflare-d1/skills/cloudflare-d1/references/best-practices.md
plugins/cloudflare-d1/skills/cloudflare-d1/references/limits.md
plugins/cloudflare-d1/skills/cloudflare-d1/references/metrics-analytics.md
plugins/cloudflare-d1/skills/cloudflare-d1/references/query-patterns.md
plugins/cloudflare-d1/skills/cloudflare-d1/references/read-replication.md
plugins/cloudflare-d1/skills/cloudflare-d1/references/setup-guide.md
plugins/cloudflare-d1/skills/cloudflare-d1/templates/d1-setup-migration.sh
plugins/cloudflare-d1/skills/cloudflare-d1/templates/d1-worker-queries.ts
plugins/cloudflare-d1/skills/cloudflare-d1/templates/schema-example.sql

Let your AI agent find skills like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.

wish › “Set up and configure Cloudflare D1 database with wrangler bindings and migrations”

Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →

Related skills

bun-cloudflare-workers
by secondsky · secondsky/claude-skills

This skill enables developers to deploy and execute Bun applications directly on Cloudflare Workers, combining the speed of Bun's runtime with Cloudflare's global edge network. It provides production-grade tooling for serverless workloads, including support for modern frameworks and AI service integrations. Ideal for teams building high-performance, distributed applications that need minimal latency and automatic scaling.

MITupdated Jul 2026
★ 196repo stars
Cloudflare Worker
by majesticlabs-dev · majesticlabs-dev/majestic-marketplace

Master TypeScript development on Cloudflare Workers, from stateless edge functions to real-time coordination with Durable Objects. Learn storage patterns for KV, D1, R2, and Queues, plus Hono framework integration and deployment via wrangler CLI.

no license declared → metadata onlyupdated May 2026
★ 44repo stars
hono-cloudflare
by bobmatnyc · bobmatnyc/claude-mpm-skills

This skill streamlines deploying Hono web applications to Cloudflare Workers, handling wrangler configuration, environment bindings, and worker setup automatically. It bridges the gap between local Hono development and Cloudflare's serverless platform, enabling rapid iteration and production-ready deployments without manual configuration overhead.

MITupdated Jul 2026
★ 62repo stars
Cloudflare
by hoodini · hoodini/ai-agents-skills

Connect to Cloudflare's edge infrastructure to build and deploy serverless applications using Workers, managed databases, object storage, and AI services. Configure KV namespaces, D1 SQLite databases, R2 buckets, and Durable Objects through a unified platform.

no license declared → metadata onlyupdated Jul 2026
★ 257repo stars
drizzle-orm-d1
by secondsky · secondsky/claude-skills

drizzle-orm-d1 equips you with a complete type-safe ORM layer for Cloudflare D1 databases, handling schema definition, migration generation via Drizzle Kit, and D1-specific patterns like batch operations instead of traditional transactions. It includes templates for common queries, relations, and prepared statements, plus an error catalog addressing D1-specific issues like binding errors and foreign key constraints.

MITupdated Jul 2026
★ 196repo stars
Wrangler
by pedronauck · pedronauck/skills

Wrangler is a tool designed to help you manage and work with web development tasks more effectively. This skill introduces you to Wrangler's fundamental features and explains how it fits into modern development workflows. Gain clarity on what makes Wrangler useful and when to apply it in your projects.

no license declared → metadata onlyupdated Jul 2026
★ 541repo stars

More skills cloudflare-hyperdrive (MIT) · better-auth (MIT)

Tags
edge-databaseserverless-sqlquery-bindingschema-migrationread-replicabatch-operationstype-affinityperformance-tuningerror-handlingdata-locality