본문으로 건너뛰기
cccskills
무료GitHub에 공개

cloudflare-storage

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.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구Cloudflare
설치 방법 보기

포함된 파일(1)

  • SKILL.md4.8 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Cloudflare KV, R2 and D1 basics

Local first: cf dev simulates the project's bindings through its adapter. Resource commands are remote unless a supported --local mode is explicitly selected. Consult cf cli search with an anonymous action/resource query and inspect the discovered command's help/schema; beta command names and flags are not interchangeable with Wrangler's. Remote writes require approval (cloudflare-deploy). Vite development data and cf local API data are separate stores; check the actual persistence directory before comparing results.

Pick the store by access pattern:

StoreGood forNot for
KVread-heavy config, cache, small values, eventually consistentcounters, anything needing read-your-write across regions
R2files, blobs, uploads, S3-compatible accessrelational queries
D1relational data in SQLite, migrations, transactions via batchvery high write rates to one database, large blobs
Durable Objectsper-entity coordination and strongly consistent statebulk storage (see cloudflare-durable-objects)

KV

Declare CACHE in worker.env with the current bindings.kv helper from cf/config, preserving the existing namespace ID. Validate typed options against the cf configuration reference and inspect dry-run bindings.

await env.CACHE.put("user:1", JSON.stringify(user), { expirationTtl: 3600 });
const user = await env.CACHE.get("user:1", "json"); // null when missing
const page = await env.CACHE.list({ prefix: "user:", limit: 100 });
  • Writes can take a while (60 seconds or more) to be visible in other locations; do not use KV where staleness is a bug.
  • expirationTtl has a documented minimum of 60 seconds.
  • Use cf cli search "create a key value namespace" or an equivalent anonymous query, then inspect the returned help/schema. Namespace creation is remote and needs approval; local KV writes require explicit --local.

R2

Declare FILES with the current bindings.r2 helper in worker.env; retain the existing bucket identity and check generated bindings.

await env.FILES.put(key, request.body, { httpMetadata: { contentType: "image/png" } });
const obj = await env.FILES.get(key); // null when missing
if (!obj) return new Response("Not found", { status: 404 });
return new Response(obj.body, { headers: { etag: obj.httpEtag } });
// elsewhere: await env.FILES.delete(key);
  • Stream request.body into put; do not buffer large uploads in memory.
  • Validate keys from user input (no path tricks, enforce a prefix per user).
  • Discover cf R2 bucket/object commands through anonymous command search; creating a bucket or writing/deleting an object remotely requires approval.

D1

Declare DB using the current bindings.d1 helper in worker.env, keeping the existing database ID and generated environment types. Verify the helper's schema before adding migration options; do not copy legacy snake_case keys.

const { results } = await env.DB.prepare("SELECT id, email FROM users WHERE org = ?1 LIMIT ?2")
  .bind(orgId, 50)
  .all();
const row = await env.DB.prepare("SELECT * FROM users WHERE id = ?1").bind(id).first();
await env.DB.batch([
  env.DB.prepare("INSERT INTO audit(event) VALUES (?1)").bind("signup"),
  env.DB.prepare("UPDATE users SET active = 1 WHERE id = ?1").bind(id),
]);
  • Always bind() user input; never concatenate it into SQL.
  • Schema changes stay in reviewed, numbered SQL migration files. Keep the framework's migration tool if it already owns ordering and receipts; inspect its generated SQL, apply it only to the local test store and run the tests.
  • Discover cf D1 query/migration commands and exact input shape with anonymous command search and help/schema. Never assume a Wrangler migration command exists in cf under the same name.
  • Production application is a data change: show SQL, database and account, get approval, and keep a restore plan. Prefer additive migrations. A DROP, table rebuild or unrestricted DELETE requires explicit data-loss approval. Check current D1 recovery/Time Travel availability rather than promising a retention window from memory. Always bind user values, even in CLI queries.

Checklist

  • binding names are valid JS identifiers and match Env
  • generated binding types and project type check current
  • code handles null / missing results
  • local test ran against simulated storage
  • no remote write happened without a yes

References: cf local resources, typed bindings.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Audit a page or UI against WCAG 2.2 AA. Runs a static HTML scanner and a contrast calculator, then walks the manual keyboard, zoom, screen-reader-name and form checks the tools cannot do, and reports findings with the criterion, evidence, fix and how to verify. Use for accessibility reviews, WCAG checks, contrast questions or "is this accessible".

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

codewhale-hq/codewhale-plugin-marketplace52026년 10월 12일 업데이트

batch

무료

Break a large, parallelizable goal into bounded work units, coordinate existing agent/worktree machinery, integrate, and verify. Explicit-only.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

codewhale-hq/codewhale-plugin-marketplace52026년 10월 12일 업데이트

best-of-n

무료

Generate a small set of independent candidate solutions in worktrees, judge them against one explicit rubric, and apply the winner only after PASS verification.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

codewhale-hq/codewhale-plugin-marketplace52026년 10월 12일 업데이트

Read and act on selected Chrome tabs and frames — their real browser, their logged-in sessions. Use for questions about the current page, filling a form the user is on, following a link they mentioned, or checking what a site actually renders. Not for throwaway automation in a clean profile.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

codewhale-hq/codewhale-plugin-marketplace52026년 10월 12일 업데이트

Deploy or change a Cloudflare Worker with cf. Review config, preflight, build and dry-run; show the target and change, obtain explicit approval, deploy and verify. Covers versions, secrets, rollback and named modes.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

codewhale-hq/codewhale-plugin-marketplace52026년 10월 12일 업데이트

Look up current Cloudflare documentation (Workers, Pages, KV, R2, D1, Queues, DNS, WAF, platform APIs) through Cloudflare's official remote MCP server. Use when answering Cloudflare questions or writing Cloudflare config.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

codewhale-hq/codewhale-plugin-marketplace52026년 10월 12일 업데이트

codewhale-hq의 스킬 모두 보기

이 스킬의 문제 신고