denizbarish/claudeflare/cf-storage

Claude Code and agent skill by denizbarish/claudeflare

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Cloudflare storage checklist for one account. R2 buckets, KV namespaces, D1 databases, Queues and Durable Objects, and the Worker bindings that use them. D1 migrations and Time Travel, create and delete plans, public r2.dev access, missing dead letter queues and data-loss traps. Load it when auditing storage, creating or deleting a bucket, namespace, database or queue, applying D1 migrations, restoring a D1 database, or wiring a binding. Load cf-core first.

Install

npx vskill@latest install denizbarish/claudeflare/cf-storage

SKILL.md

The same SKILL.md was published earlier as denizbarish/claudeflare/cf-storage.

cf-storage: R2, KV, D1, Queues, Durable Objects

Load cf-core first. Findings use the cf-audit finding format and severity scale. Storage resources are account-scoped: every write is an account plan with wrangler ops (cf-core 5.2.2). In the MCP examples below, replace ACCOUNT_ID with the real account id (32 hex characters) and DATABASE_ID, BUCKET_NAME, SCRIPT_NAME with real values from the reads; the guard needs literal paths.

Read current state

WhatGET path or read-only command
D1 databases (uuid, name, version, created_at)/accounts/{account_id}/d1/database, or wrangler d1 list --json
One D1 database (version: production supports Time Travel, alpha does not)wrangler d1 info <db> --json
Current Time Travel bookmark/accounts/{account_id}/d1/database/{database_id}/time_travel/bookmark, or wrangler d1 time-travel info <db> --json
Unapplied D1 migrations (run in the project)wrangler d1 migrations list <db> --remote
R2 buckets/accounts/{account_id}/r2/buckets, or wrangler r2 bucket list
r2.dev public access of one bucket (bucketId, domain, enabled)/accounts/{account_id}/r2/buckets/{bucket_name}/domains/managed
Custom domains of one bucket/accounts/{account_id}/r2/buckets/{bucket_name}/domains/custom
KV namespaces (id, title)/accounts/{account_id}/storage/kv/namespaces, or wrangler kv namespace list
Queues with producers and consumers/accounts/{account_id}/queues, or wrangler queues list
Consumers of one queue (dead_letter_queue, settings.max_retries)/accounts/{account_id}/queues/{queue_id}/consumers
Durable Object namespaces (class, script, use_sqlite)/accounts/{account_id}/workers/durable_objects/namespaces
Worker scripts/accounts/{account_id}/workers/scripts
Bindings of one Worker (type: d1, kv_namespace with namespace_id, r2_bucket with bucket_name, queue with queue_name, durable_object_namespace with class_name)/accounts/{account_id}/workers/scripts/{script_name}/settings
Pages Functions bindings (deployment_configs.production and .preview: kv_namespaces, d1_databases, r2_buckets, queue_producers)/accounts/{account_id}/pages/projects/{project_name}

MCP execute:

js
async () => {
const d1 = await cloudflare.request({ method: "GET", path: "/accounts/ACCOUNT_ID/d1/database" });
const r2 = await cloudflare.request({ method: "GET", path: "/accounts/ACCOUNT_ID/r2/buckets" });
const kv = await cloudflare.request({ method: "GET", path: "/accounts/ACCOUNT_ID/storage/kv/namespaces", query: { per_page: 100 } });
const queues = await cloudflare.request({ method: "GET", path: "/accounts/ACCOUNT_ID/queues" });
return { d1: d1.result, r2: r2.result, kv: kv.result, queues: queues.result };
}

Per resource, one call each:

js
async () => {
const devUrl = await cloudflare.request({ method: "GET", path: "/accounts/ACCOUNT_ID/r2/buckets/BUCKET_NAME/domains/managed" });
const bookmark = await cloudflare.request({ method: "GET", path: "/accounts/ACCOUNT_ID/d1/database/DATABASE_ID/time_travel/bookmark" });
const settings = await cloudflare.request({ method: "GET", path: "/accounts/ACCOUNT_ID/workers/scripts/SCRIPT_NAME/settings" });
return { devUrl: devUrl.result, bookmark: bookmark.result, bindings: settings.result.bindings };
}

Fallback: claudeflare get /accounts/ACCOUNT_ID/d1/database and the same for the other paths. Read the wrangler config of the project (wrangler.jsonc, wrangler.json or wrangler.toml) for the declared bindings, migrations_dir (default migrations/) and migrations_table (default d1_migrations).

Checks

finding idconditionseverityrecommendedplan tier
d1.time_travel.unused_before_migrationRemote D1 migrations are about to run (or ran) without a recorded Time Travel bookmark from just before them: the user applies migrations outside claudeflare (CI step or a manual d1 migrations apply --remote) and no bookmark is noted, or the database reports version: alpha (no Time Travel at all).highApply remote migrations only through a claudeflare plan (the snapshot records the bookmark); give the user the bookmarkfree
d1.migrations.pendingwrangler d1 migrations list <db> --remote lists unapplied migrations while the deployed Worker code already expects them (or the user does not know why they are pending).mediumNo pending migrations; apply them in a plan before or with the deploy that needs themfree
r2.bucket.public_dev_urldomains/managed returns enabled: true. Every object is public at https://<domain>/<key>, rate-limited, and bypasses WAF, Access and cache rules on custom domains.medium (high when the bucket holds private data)enabled: false; serve public content through a custom domainfree
kv.namespace.unusedA KV namespace id appears in no Worker binding (kv_namespace namespace_id) and no Pages project kv_namespaces (production or preview), and the user confirms nothing else uses it (for example REST clients).lowDelete it after the user confirms, or document its ownerfree
queues.dlq.missingA consumer has no dead_letter_queue. Messages that still fail after max_retries (default 3) are deleted permanently.mediumdead_letter_queue set on every consumer, with a consumer or alert on the DLQfree

Notes for findings:

  • d1.time_travel.unused_before_migration: Time Travel is always on for version: production databases; the gap is the missing bookmark, not a setting. Retention is 30 days on Workers Paid and 7 days on Workers Free. wrangler d1 migrations apply also captures its own backup, but only a bookmark taken right before gives a known restore point. For version: alpha databases, say the database uses the legacy snapshot backups and set fix: [].
  • d1.migrations.pending: include the pending file names and their SQL in reason. The fix is a plan with a d1 migrations apply op (Applying changes); preflight lists the pending migrations again and claudeflare embeds them in the plan.
  • r2.bucket.public_dev_url: fix with an account plan op (reversible: the snapshot records the current state and rollback restores it). Connected custom domains keep working. Ask first whether something depends on the r2.dev URL. Jurisdiction buckets (-J) cannot be snapshotted, so that op is marked not reversible.

``json { "kind": "wrangler", "args": ["r2", "bucket", "dev-url", "disable", "BUCKET"] } ``

  • kv.namespace.unused: never delete on this finding alone. A preview namespace (--preview) or a namespace used only through the REST API looks unused. The fix is a delete op with confirm_name and a data-loss risk line.
  • queues.dlq.missing: the fix is a config edit in the consumer Worker's wrangler file (the user's file, with consent) plus a deploy plan for that Worker (cf-workers). If the named DLQ does not exist, Cloudflare creates it automatically.

Applying changes

Use the change protocol from cf-core (account scope): draft, claudeflare preflight --file draft.json, claudeflare plan new --file draft.json, user approval, claudeflare apply <id>. Ops below go into the ops array of an account draft.

Apply D1 migrations (reversible through the Time Travel bookmark the snapshot records; claudeflare adds source_hash and pending_migrations):

json
{ "kind": "wrangler", "args": ["d1", "migrations", "apply", "prod-db", "--remote"] }

Before planning: run wrangler d1 migrations list prod-db --remote and wrangler d1 time-travel info prod-db --json, show the user the pending SQL and the current bookmark. The risk says: rolling back restores the bookmark and discards every write made after it, including real user data written between apply and rollback. If a migration fails, D1 rolls back that migration and the earlier ones in the run stay applied; read migrations list again before anything else.

Restore a D1 database to a bookmark (reversible: the snapshot records the current bookmark):

json
{ "kind": "wrangler", "args": ["d1", "time-travel", "restore", "prod-db", "--bookmark", "00000085-0000024c-00004c6d-8e61117bf38d7adb71b934ebbf891683"] }

The restore overwrites the database in place, cancels in-flight queries and discards all writes after the bookmark. Bookmarks older than the retention window cannot be used. Put both facts in the risk.

Create resources (resource_create; the rollback deletes a created KV namespace or R2 bucket only while it is still empty, else rollback_not_empty; Queue and D1 creates are never auto-deleted):

json
{ "kind": "wrangler", "args": ["d1", "create", "prod-db", "--location", "weur"] }
{ "kind": "wrangler", "args": ["r2", "bucket", "create", "media"] }
{ "kind": "wrangler", "args": ["kv", "namespace", "create", "CACHE"] }
{ "kind": "wrangler", "args": ["queues", "create", "jobs"] }

Never add --update-config, --binding or --use-remote to a create op (not allowlisted; claudeflare does not edit the user's config). After apply, read the new id (resource_id in the KV op result, wrangler d1 info prod-db --json for the D1 uuid), then propose the binding diff in chat, for example for wrangler.jsonc:

jsonc
"kv_namespaces": [{ "binding": "CACHE", "id": "<resource_id>" }],
"d1_databases": [{ "binding": "DB", "database_name": "prod-db", "database_id": "<uuid>" }],
"r2_buckets": [{ "binding": "MEDIA", "bucket_name": "media" }],
"queues": { "producers": [{ "binding": "JOBS", "queue": "jobs" }], "consumers": [{ "queue": "jobs", "max_retries": 3, "dead_letter_queue": "jobs-dlq" }] }

Editing the user's wrangler file is a normal file edit with the user's consent, outside claudeflare apply. The binding takes effect with the next Worker deploy plan (cf-workers). If kv_id_unknown appears in risk_notes, read wrangler kv namespace list and match the title.

Delete resources (resource_delete, not reversible; each op needs confirm_name equal to the resource name, for KV the namespace id):

json
{ "kind": "wrangler", "args": ["r2", "bucket", "delete", "media"], "confirm_name": "media" }
{ "kind": "wrangler", "args": ["kv", "namespace", "delete", "--namespace-id", "0f2ac74b498b48028cb68387c421e279"], "confirm_name": "0f2ac74b498b48028cb68387c421e279" }
{ "kind": "wrangler", "args": ["queues", "delete", "jobs"], "confirm_name": "jobs" }
{ "kind": "wrangler", "args": ["d1", "delete", "prod-db"], "confirm_name": "prod-db" }
  • R2: plan creation refuses a bucket that still has objects (resource_not_empty). The user empties it first; claudeflare has no object delete op.
  • KV, Queue, D1: the delete removes all keys, pending messages or rows. claudeflare adds a Not reversible: line; add a risk line naming what is lost (key count, queue backlog, table names and row counts you read). For D1, Time Travel cannot bring back a deleted database; suggest wrangler d1 export by the user first.
  • Before any delete, list the Workers and Pages projects that bind the resource (Read current state) and remove those bindings with a deploy first, or the next deploy of the Worker fails and rollbacks to versions with that binding are refused.

Durable Objects: there is no create or delete op. A class is created, renamed, transferred or deleted by a Worker deploy, through exports (current) or the legacy migrations array in the wrangler config (one or the other, never both). Treat every deploy that changes them as data-relevant.

Traps

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/denizbarish/claudeflare/cf-storage/badge)](https://verified-skill.com/skills/denizbarish/claudeflare/cf-storage)

Something wrong with this skill or its page? Tell us.