denizbarish/claudeflare/cf-storage
Claude Code and agent skill by denizbarish/claudeflare
- community
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-storageSKILL.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
| What | GET 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:
Per resource, one call each:
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 id | condition | severity | recommended | plan tier | |
|---|---|---|---|---|---|
d1.time_travel.unused_before_migration | Remote 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). | high | Apply remote migrations only through a claudeflare plan (the snapshot records the bookmark); give the user the bookmark | free | |
d1.migrations.pending | wrangler 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). | medium | No pending migrations; apply them in a plan before or with the deploy that needs them | free | |
r2.bucket.public_dev_url | domains/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 domain | free | |
kv.namespace.unused | A 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). | low | Delete it after the user confirms, or document its owner | free | |
queues.dlq.missing | A consumer has no dead_letter_queue. Messages that still fail after max_retries (default 3) are deleted permanently. | medium | dead_letter_queue set on every consumer, with a consumer or alert on the DLQ | free |
Notes for findings:
d1.time_travel.unused_before_migration: Time Travel is always on forversion: productiondatabases; 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 applyalso captures its own backup, but only a bookmark taken right before gives a known restore point. Forversion: alphadatabases, say the database uses the legacy snapshot backups and setfix: [].d1.migrations.pending: include the pending file names and their SQL inreason. The fix is a plan with ad1 migrations applyop (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 ther2.devURL. 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 withconfirm_nameand 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):
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):
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):
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:
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):
- 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; suggestwrangler d1 exportby 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
- SKILL.md in the repositoryCheckingskills/cf-storage/SKILL.md
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
[](https://verified-skill.com/skills/denizbarish/claudeflare/cf-storage)