[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CFZGPCRND51B59Y343C42Q":3,"skill-same:01M7CFZGPCRND51B59Y343C42Q":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":29,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M7CFZGPCRND51B59Y343C42Q","cloudflare-storage",null,"Use Cloudflare KV, R2 and D1 from a Worker. Binding config, Worker code, cf commands, local vs remote data, D1 migrations. Use when adding or changing storage bindings or schemas.","codewhale-hq\u002Fcodewhale-plugin-marketplace","codewhale-hq","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F326694313?v=4","01M6CDD9D70AD3631SMRJ7REW4","Codewhale","01M7CFYTPJMP417FBR6K9VE5VN",5,"MIT","https:\u002F\u002Fgithub.com\u002Fcodewhale-hq\u002Fcodewhale-plugin-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fcloudflare\u002Fskills\u002Fcloudflare-storage\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: cloudflare-storage\ndescription: Use Cloudflare KV, R2 and D1 from a Worker. Binding config, Worker code, cf commands, local vs remote data, D1 migrations. Use when adding or changing storage bindings or schemas.\n---\n\n# Cloudflare KV, R2 and D1 basics\n\nLocal first: `cf dev` simulates the project's bindings through its adapter.\nResource commands are remote unless a supported `--local` mode is explicitly\nselected. Consult `cf cli search` with an anonymous action\u002Fresource query and\ninspect the discovered command's help\u002Fschema; beta command names and flags\nare not interchangeable with Wrangler's. Remote writes require approval\n(`cloudflare-deploy`). Vite development data and cf local API data are separate\nstores; check the actual persistence directory before comparing results.\n\nPick the store by access pattern:\n\n| Store | Good for | Not for |\n| --- | --- | --- |\n| KV | read-heavy config, cache, small values, eventually consistent | counters, anything needing read-your-write across regions |\n| R2 | files, blobs, uploads, S3-compatible access | relational queries |\n| D1 | relational data in SQLite, migrations, transactions via `batch` | very high write rates to one database, large blobs |\n| Durable Objects | per-entity coordination and strongly consistent state | bulk storage (see cloudflare-durable-objects) |\n\n## KV\n\nDeclare `CACHE` in `worker.env` with the current `bindings.kv` helper from\n`cf\u002Fconfig`, preserving the existing namespace ID. Validate typed options\nagainst the cf configuration reference and inspect dry-run bindings.\n\n```ts\nawait env.CACHE.put(\"user:1\", JSON.stringify(user), { expirationTtl: 3600 });\nconst user = await env.CACHE.get(\"user:1\", \"json\"); \u002F\u002F null when missing\nconst page = await env.CACHE.list({ prefix: \"user:\", limit: 100 });\n```\n\n- Writes can take a while (60 seconds or more) to be visible in other\n  locations; do not use KV where staleness is a bug.\n- `expirationTtl` has a documented minimum of 60 seconds.\n- Use `cf cli search \"create a key value namespace\"` or an equivalent\n  anonymous query, then inspect the returned help\u002Fschema. Namespace creation\n  is remote and needs approval; local KV writes require explicit `--local`.\n\n## R2\n\nDeclare `FILES` with the current `bindings.r2` helper in `worker.env`;\nretain the existing bucket identity and check generated bindings.\n\n```ts\nawait env.FILES.put(key, request.body, { httpMetadata: { contentType: \"image\u002Fpng\" } });\nconst obj = await env.FILES.get(key); \u002F\u002F null when missing\nif (!obj) return new Response(\"Not found\", { status: 404 });\nreturn new Response(obj.body, { headers: { etag: obj.httpEtag } });\n\u002F\u002F elsewhere: await env.FILES.delete(key);\n```\n\n- Stream `request.body` into `put`; do not buffer large uploads in memory.\n- Validate keys from user input (no path tricks, enforce a prefix per user).\n- Discover cf R2 bucket\u002Fobject commands through anonymous command search;\n  creating a bucket or writing\u002Fdeleting an object remotely requires approval.\n\n## D1\n\nDeclare `DB` using the current `bindings.d1` helper in `worker.env`, keeping\nthe existing database ID and generated environment types. Verify the helper's\nschema before adding migration options; do not copy legacy snake_case keys.\n\n```ts\nconst { results } = await env.DB.prepare(\"SELECT id, email FROM users WHERE org = ?1 LIMIT ?2\")\n  .bind(orgId, 50)\n  .all();\nconst row = await env.DB.prepare(\"SELECT * FROM users WHERE id = ?1\").bind(id).first();\nawait env.DB.batch([\n  env.DB.prepare(\"INSERT INTO audit(event) VALUES (?1)\").bind(\"signup\"),\n  env.DB.prepare(\"UPDATE users SET active = 1 WHERE id = ?1\").bind(id),\n]);\n```\n\n- Always `bind()` user input; never concatenate it into SQL.\n- Schema changes stay in reviewed, numbered SQL migration files. Keep the\n  framework's migration tool if it already owns ordering and receipts; inspect\n  its generated SQL, apply it only to the local test store and run the tests.\n- Discover cf D1 query\u002Fmigration commands and exact input shape with anonymous\n  command search and help\u002Fschema. Never assume a Wrangler migration command\n  exists in cf under the same name.\n- Production application is a data change: show SQL, database and account,\n  get approval, and keep a restore plan. Prefer additive migrations. A DROP,\n  table rebuild or unrestricted DELETE requires explicit data-loss approval.\n  Check current D1 recovery\u002FTime Travel availability rather than promising a\n  retention window from memory. Always bind user values, even in CLI queries.\n\n## Checklist\n\n- [ ] binding names are valid JS identifiers and match `Env`\n- [ ] generated binding types and project type check current\n- [ ] code handles `null` \u002F missing results\n- [ ] local test ran against simulated storage\n- [ ] no remote write happened without a yes\n\nReferences: [cf local resources](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fcf\u002Fprojects\u002F), [typed bindings](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fcf\u002Fprojects\u002Fcloudflare-config\u002F).\n","# Cloudflare KV, R2 and D1 basics\n\nLocal first: `cf dev` simulates the project's bindings through its adapter.\nResource commands are remote unless a supported `--local` mode is explicitly\nselected. Consult `cf cli search` with an anonymous action\u002Fresource query and\ninspect the discovered command's help\u002Fschema; beta command names and flags\nare not interchangeable with Wrangler's. Remote writes require approval\n(`cloudflare-deploy`). Vite development data and cf local API data are separate\nstores; check the actual persistence directory before comparing results.\n\nPick the store by access pattern:\n\n| Store | Good for | Not for |\n| --- | --- | --- |\n| KV | read-heavy config, cache, small values, eventually consistent | counters, anything needing read-your-write across regions |\n| R2 | files, blobs, uploads, S3-compatible access | relational queries |\n| D1 | relational data in SQLite, migrations, transactions via `batch` | very high write rates to one database, large blobs |\n| Durable Objects | per-entity coordination and strongly consistent state | bulk storage (see cloudflare-durable-objects) |\n\n## KV\n\nDeclare `CACHE` in `worker.env` with the current `bindings.kv` helper from\n`cf\u002Fconfig`, preserving the existing namespace ID. Validate typed options\nagainst the cf configuration reference and inspect dry-run bindings.\n\n```ts\nawait env.CACHE.put(\"user:1\", JSON.stringify(user), { expirationTtl: 3600 });\nconst user = await env.CACHE.get(\"user:1\", \"json\"); \u002F\u002F null when missing\nconst page = await env.CACHE.list({ prefix: \"user:\", limit: 100 });\n```\n\n- Writes can take a while (60 seconds or more) to be visible in other\n  locations; do not use KV where staleness is a bug.\n- `expirationTtl` has a documented minimum of 60 seconds.\n- Use `cf cli search \"create a key value namespace\"` or an equivalent\n  anonymous query, then inspect the returned help\u002Fschema. Namespace creation\n  is remote and needs approval; local KV writes require explicit `--local`.\n\n## R2\n\nDeclare `FILES` with the current `bindings.r2` helper in `worker.env`;\nretain the existing bucket identity and check generated bindings.\n\n```ts\nawait env.FILES.put(key, request.body, { httpMetadata: { contentType: \"image\u002Fpng\" } });\nconst obj = await env.FILES.get(key); \u002F\u002F null when missing\nif (!obj) return new Response(\"Not found\", { status: 404 });\nreturn new Response(obj.body, { headers: { etag: obj.httpEtag } });\n\u002F\u002F elsewhere: await env.FILES.delete(key);\n```\n\n- Stream `request.body` into `put`; do not buffer large uploads in memory.\n- Validate keys from user input (no path tricks, enforce a prefix per user).\n- Discover cf R2 bucket\u002Fobject commands through anonymous command search;\n  creating a bucket or writing\u002Fdeleting an object remotely requires approval.\n\n## D1\n\nDeclare `DB` using the current `bindings.d1` helper in `worker.env`, keeping\nthe existing database ID and generated environment types. Verify the helper's\nschema before adding migration options; do not copy legacy snake_case keys.\n\n```ts\nconst { results } = await env.DB.prepare(\"SELECT id, email FROM users WHERE org = ?1 LIMIT ?2\")\n  .bind(orgId, 50)\n  .all();\nconst row = await env.DB.prepare(\"SELECT * FROM users WHERE id = ?1\").bind(id).first();\nawait env.DB.batch([\n  env.DB.prepare(\"INSERT INTO audit(event) VALUES (?1)\").bind(\"signup\"),\n  env.DB.prepare(\"UPDATE users SET active = 1 WHERE id = ?1\").bind(id),\n]);\n```\n\n- Always `bind()` user input; never concatenate it into SQL.\n- Schema changes stay in reviewed, numbered SQL migration files. Keep the\n  framework's migration tool if it already owns ordering and receipts; inspect\n  its generated SQL, apply it only to the local test store and run the tests.\n- Discover cf D1 query\u002Fmigration commands and exact input shape with anonymous\n  command search and help\u002Fschema. Never assume a Wrangler migration command\n  exists in cf under the same name.\n- Production application is a data change: show SQL, database and account,\n  get approval, and keep a restore plan. Prefer additive migrations. A DROP,\n  table rebuild or unrestricted DELETE requires explicit data-loss approval.\n  Check current D1 recovery\u002FTime Travel availability rather than promising a\n  retention window from memory. Always bind user values, even in CLI queries.\n\n## Checklist\n\n- [ ] binding names are valid JS identifiers and match `Env`\n- [ ] generated binding types and project type check current\n- [ ] code handles `null` \u002F missing results\n- [ ] local test ran against simulated storage\n- [ ] no remote write happened without a yes\n\nReferences: [cf local resources](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fcf\u002Fprojects\u002F), [typed bindings](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fcf\u002Fprojects\u002Fcloudflare-config\u002F).\n",{"name":5,"description":7},"main","e83cac15fc63134280e964895df4d584e5702c13","plugins\u002Fcloudflare\u002Fskills\u002Fcloudflare-storage",2,"https:\u002F\u002Fgithub.com\u002Fcodewhale-hq\u002Fcodewhale-plugin-marketplace","https:\u002F\u002Fcodewhale.net","https:\u002F\u002Fgithub.com\u002Fcodewhale-hq","Open-source coding agent for your terminal. Works with the model provider you choose.","2026-11-13 11:48:42",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add codewhale-hq\u002Fcodewhale-plugin-marketplace --skill cloudflare-storage",{"tool":39,"command":40},"bunx","bunx skills add codewhale-hq\u002Fcodewhale-plugin-marketplace --skill cloudflare-storage",{"tool":42,"command":43},"pnpm","pnpm dlx skills add codewhale-hq\u002Fcodewhale-plugin-marketplace --skill cloudflare-storage","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fcodewhale-hq\u002Fcodewhale-plugin-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fcloudflare\u002Fskills\u002Fcloudflare-storage\u002FSKILL.md",true,[],[48,55,62,69,75,82],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M7CG92AM4VSATJQ927PE34G4","xlsx","Create\u002Fedit\u002Fanalyze\u002Fverify spreadsheet workbooks including XLSX\u002FCSV\u002FTSV.","https:\u002F\u002Fgithub.com\u002Fcodewhale-hq\u002Fcodewhale-plugin-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fxlsx\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M7CG8ZBZXPCJACH06SFV39NM","webapp-testing","Start\u002Freuse a local app, wait for readiness, inspect rendered state\u002Fconsole\u002Fnetwork, act from observed selectors, and verify with evidence.","https:\u002F\u002Fgithub.com\u002Fcodewhale-hq\u002Fcodewhale-plugin-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M7CG8XF83CD62S7TCPMECV4N","verify","Exercise the real app\u002FAPI\u002FCLI and collect observable evidence; tests alone do not count as end-to-end verification.","https:\u002F\u002Fgithub.com\u002Fcodewhale-hq\u002Fcodewhale-plugin-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fverify\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M7CG8VF7HN4EHQM3PP877PB6","tts","https:\u002F\u002Fgithub.com\u002Fcodewhale-hq\u002Fcodewhale-plugin-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Ftts\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M7CG8RSMADT0QKP2ZSF6EN6T","test","Detect the project’s test stack, run the narrowest useful tests, create tests when authorized, and report coverage\u002Fgaps honestly.","https:\u002F\u002Fgithub.com\u002Fcodewhale-hq\u002Fcodewhale-plugin-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Ftest\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M7CG8MQTZ8VT7E4V3VY78F8X","spreadsheets","Compatibility alias for the xlsx skill. Prefer loading xlsx.","https:\u002F\u002Fgithub.com\u002Fcodewhale-hq\u002Fcodewhale-plugin-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fspreadsheets\u002FSKILL.md",[],[]]