cloudflare-d1

cloudflare-d1 is a skill for Claude Code from secondsky/claude-skills. It costs 39 tokens per session (4,076 once invoked), scanned A, original, MIT.

A reference and setup guide for Cloudflare D1, a serverless SQLite database for Cloudflare applications. It covers database access, configuration bindings, migrations, common errors, and usage patterns.

In plain words
What is it for?
Use it when adding D1 to an application, writing queries, managing migrations, configuring bindings, or troubleshooting D1 errors and limits.
Why use it?
It gives you the D1-specific information needed to use the database correctly and avoid common configuration, query, limit, and migration mistakes.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the cloudflare-d1 plugin — 1 skill, 2 commands, 2 agents shipped together

not rated 215repo +2 today A scan Socket: passSnyk: passSkillSpector: pass 39 tokens original MIT

Good fit Use it when adding D1 to an application, writing queries, managing migrations, configuring bindings, or troubleshooting D1 errors and limits.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/secondsky/claude-skills/cloudflare-d1
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add secondsky/claude-skills --skill cloudflare-d1
Clone the repo
git clone --depth 1 https://github.com/secondsky/claude-skills

Made for: Claude Code.

Or install cloudflare-d1, the plugin that ships this one along with the rest of its 1 skill, 2 commands, 2 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cloudflare-d1

README.md
[![agentmods](https://agentmods.dev/badge/skills/secondsky/claude-skills/cloudflare-d1.svg)](https://agentmods.dev/skills/secondsky/claude-skills/cloudflare-d1)
Your own site
<a href="https://agentmods.dev/skills/secondsky/claude-skills/cloudflare-d1"><img src="https://agentmods.dev/badge/skills/secondsky/claude-skills/cloudflare-d1.svg" alt="Measured on agentmods" height="20"></a>
Per session 39 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,076 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 16 May 2026
  • Snyk pass 16 May 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00039 $0.04076
Opus 5 $0.00019 $0.02038
Sonnet 5 $0.00008 $0.00815
Haiku 4.5 $0.00004 $0.00408

Measured 4d ago against content hash 5adfa227eabe, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

cloudflare-d1 scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (templates/d1-setup-migration.sh, templates/d1-worker-queries.ts), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/cloudflare-d1/skills/cloudflare-d1/SKILL.md · 642 lines

How it starts

The opening of the file, as written. The whole thing — 642 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Cloudflare D1 Database

Status: Production Ready ✅ | Last Verified: 2025-01-15

Table of Contents

  1. What Is D1?
  2. Quick Start
  3. Critical Rules
  4. D1 API Methods
  5. Top 5 Use Cases
  6. Migrations Best Practices
  7. Common Patterns
  8. SQLite Type Affinity
  9. Top 5 Errors Prevented

What Is D1?

Cloudflare D1 is serverless SQLite on the edge:

  • SQL database without servers
  • Global distribution
  • Zero cold starts
  • Standard SQLite syntax
  • Read replication for global performance

🆕 New in 2025

D1 received major updates throughout 2025:

Performance (January 2025)

  • 40-60% latency reduction globally (P50 query times)
  • Optimized SQLite engine for edge execution
  • Reduced cold start impact for databases <100 MB

Reliability (September 2025)

  • Automatic query retries: Read queries retry up to 2x on transient failures
  • Transparent to application code (logged in wrangler tail)

Scalability (April 2025)

  • Read Replication (Public Beta): Deploy read replicas globally
  • Up to 2x read throughput for read-heavy workloads
  • Sessions API for read-write separation

Compliance (November 2025)

  • Data Localization: Specify EU/US jurisdiction for GDPR/data sovereignty
  • Configure via --jurisdiction flag or wrangler.jsonc

⚠️ Breaking Change (February 10, 2025)

  • Free tier hard limits enforced: 10 DBs, 500 MB each, 50 queries/invocation
  • Exceeding limits = 429 errors (previously warnings only)
  • Action: Review usage with wrangler d1 list and upgrade if needed

Full details: Load references/2025-features.md


Quick Start (5 Minutes)

1. Create Database

bunx wrangler d1 create my-database

Save the database_id from output!

2. Configure Binding

Add to wrangler.jsonc:

Read the full file on GitHub · 642 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 642 lines · 39 tokens per session scan A 5adfa227eabe

Subscribe to this mod's changes

cloudflare-d1 is a skill published in the GitHub repository secondsky/claude-skills (215 stars, last pushed today), licensed MIT. It adds 39 tokens to every session and 4,076 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.