Cloudflare core
Shared reference for the Cloudflare cluster: the edge-compute + binding model every Worker turns on, wrangler.jsonc conventions, compatibility_date, the storage-primitive decision matrix (KV vs R2 vs D1 vs Durable Objects), secrets, and the auth-token gotcha. USE WHEN adding a binding, choosing a storage primitive, writing wrangler config, or debugging a Cloudflare deploy — the interlocking rules every Cloudflare spoke shares.From its SKILL.md
npx -y skills add Sheshiyer/skill-clusters --skill cloudflare-coreAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
6.0 KB, ~1.4k tokens by cl100k_base, as published. Nobody here has run it
Cloudflare Core
Shared model for the cloudflare cluster. The compute, storage, and deploy spokes all depend on
these interlocking concepts — keep them consistent here so no spoke contradicts another.
1. The compute + binding model (Cloudflare's defining shape)
Everything you ship is compute at the edge that reaches the rest of the platform only through bindings. There is no ambient global state and no import of a database client — a resource exists to your code only if it is declared as a binding:
Request ──> Worker / Pages Function ──binding──> KV · R2 · D1 · Durable Object · Queue · AI · send_email · Service
(declared in wrangler.jsonc, injected on env)
- Worker — the unit of compute; a
fetch/scheduled/email/queuehandler running on every edge node. New code & reviews →workers-best-practices; deploys →cloudflare. - Pages / Pages Functions — static assets + file-routed Workers. Deploy →
cloudflare. - Binding — a named capability on the
envobject, declared inwrangler.jsonc. This is the only way compute touches a primitive; adding one is a config change, not just code. CLI/config →wrangler. - Durable Object — also reached via a binding, but it is compute + storage: a single-threaded, strongly-consistent actor per id. →
durable-objects.
Rule: declare every dependency as a binding; never hardcode secrets, account IDs, or endpoints that a binding or secret should carry.
2. wrangler.jsonc & compatibility_date (the config contract)
- Prefer
wrangler.jsoncoverwrangler.toml— newer features are JSON-only. →wrangler compatibility_datepins the runtime's behavior; set a recent date (within ~30 days) and addcompatibility_flagsonly as needed. Changing it can change runtime semantics — treat it as a real decision.- After any config/binding change, regenerate types:
wrangler types(keepsenvtyped). wrangler devfor local,wrangler deployto ship,wrangler tailfor live logs.
3. Secrets & auth (where deploys actually break)
- Runtime secrets →
wrangler secret put NAME(never commit.env; never inline a token in code). - The auth-token gotcha: API tokens in the environment frequently lack Pages permissions and silently override OAuth. For Pages — and often Workers — unset
CF_API_TOKEN/CLOUDFLARE_API_TOKENso wrangler's OAuth login is used. This single trap causes most "works locally, 403 on deploy" failures. →cloudflare - Account-scoped management with an explicit API token (KV/R2/Pages/DNS via scripts) →
cloudflare-manager.
4. Storage-primitive decision matrix (pick one per use)
| Primitive | Consistency | Best for | Avoid for | Spoke |
|---|---|---|---|---|
| KV | Eventual (~60s global) | Read-heavy cache, config, feature flags | Frequent writes, read-after-write | wrangler (bind), cloudflare-manager |
| R2 | Strong per-object | Large/binary objects, media, no egress fees | Querying, relational data | wrangler, r2-notebooklm-artifact-portal (public serving) |
| D1 | Strong (SQLite) | Relational data, joins, transactions | Massive write throughput, huge blobs | wrangler |
| Durable Object | Strong, single-writer | Per-entity state, coordination, locks, WebSockets, alarms | Bulk analytics, sharable read cache | durable-objects |
| Queues | At-least-once | Async/decoupled work, retries, batching | Synchronous request/response | agents-sdk, wrangler |
Rule of thumb: KV = read-heavy cache, R2 = objects, D1 = relational, Durable Object = strongly-consistent per-entity state. Reach for a DO only when you need a single coordinator; it is the most expensive default.
5. Higher-level SDKs (built on the same bindings)
- Agents SDK — stateful AI agents, durable workflows, scheduled tasks, MCP servers, chat/voice, React hooks. Sits on Durable Objects + Workers under the hood. →
agents-sdk - Sandbox SDK — container-backed isolated execution for untrusted/arbitrary code, code interpreters, CI/CD, preview URLs (requires Docker locally; a
containersbinding). →sandbox-sdk - Email — send via the Workers
send_emailbinding or REST API; receive/route via Email Routing andonEmail(). →cloudflare-email-service
6. Retrieval over pre-training (a cluster-wide convention)
These APIs, flags, and config fields change fast. The spokes deliberately bias toward fetching
the current Cloudflare docs rather than trusting baked-in knowledge — do the same before relying
on a signature, binding shape, or wrangler flag. Authoritative sources: the spoke's linked
developers.cloudflare.com page, @cloudflare/workers-types, and
node_modules/wrangler/config-schema.json.
7. Shared guardrails
- Bindings, not hardcoding: every external dependency is a declared binding; secrets via
wrangler secret put. - Pin
compatibility_date(recent) and runwrangler typesafter config changes. - Right primitive for the access pattern (matrix above); a Durable Object is not a default cache.
- State every binding/config change — a new binding, scope, or secret is an infra change worth naming.
- Unset env API tokens for Pages/OAuth deploys — the token trap is the #1 deploy failure.
- Retrieve current docs before trusting an API signature; prefer
wranglerover hand-rolled API calls. - Workers vs other edges: this cluster is Cloudflare-specific; the binding model and
compatibility_dateare Cloudflare conventions, not portable to generic Node/serverless.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.