anantbhandarkar/make-it-right/mir-cloud-cloudflare
Claude Code and agent skill by anantbhandarkar/make-it-right
- community
- ext:[{"type":"config","description":"Configuration overrides"}]
Checking that the SKILL.md file is still in the repository.
Make It Right (Cloudflare module). The reliability and cost review layer for a Cloudflare deployment, loaded after the provider is chosen - not a how-to for Workers. Covers: the isolate contract and where CPU-time billing stops applying; compatibility_date as the real version pin; the limits block as the only spend bound there is - budget alerts do not cap; KV vs D1 vs Durable Objects as three different consistency contracts; Durable Object single-thread throughput, sharding, alarms and gates; R2 Class A ops on small-object ingest, r2.dev as a non-origin, jurisdiction vs location hint for residency; secrets vs plaintext vars; and the 18 November 2025 outage as the 'config data is a deploy' lesson. Chains: mir-cloud then this. TRIGGER once mir-cloud Gate 5 has settled on Cloudflare - a wrangler or Terraform Cloudflare change, a Durable Object class, R2 bucket layout and public access, KV/D1 consistency, bindings and secrets, Containers, or a residency review. SKIP for the other providers - mir-cloud-aws, mir-cloud-gcp and mir-cloud-azure each get their own module. SKIP while the provider is undecided: comparison, elimination and the cost model are mir-cloud, and loading this before Gate 5 biases the choice. SKIP for app code - handlers are mir-backend, UI is mir-frontend, schema is mir-database. SKIP for pipeline controls identical on every provider (action pinning, SBOM, secret scanning, plan-vs-apply review) - mir-devsecops.
Install
npx vskill@latest install anantbhandarkar/make-it-right/mir-cloud-cloudflareSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as anantbhandarkar/make-it-right/mir-cloud-cloudflare.
/mir-cloud-cloudflare · Make It Right (Cloudflare)
Bottom tier of a two-tier chain: mir-cloud decides where the workload belongs (provider-neutral, Gates 0–7) → this carries Cloudflare mechanics. Reach for it at Gate 5 (service mapping, residency and exit cost, after sign-off), Gate 6 (Wrangler/Terraform), and Gate 7 (security, reliability and cost review).
This is a review layer, not a tutorial. Cloudflare ships excellent first-party skills for how to write a Worker, a Durable Object or a wrangler command; load one of those to build. This module asks the other question — what will this deployment do under load, under failure, and on the bill — and it asks it inside the pillar's gates.
This module contributes nothing before Gate 5, and that is deliberate. The pillar's rule is that naming a provider before the workload is characterized turns the rest of the conversation into justification. Cloudflare is the provider most often named for aesthetic reasons, so loading its mechanics during Gates 0–4 is the worst case of that bias, not a mild one. If the provider is still open, close this and go back to mir-cloud.
Comparison facts stay in the pillar. The 5-minute CPU ceiling, the 128 MB isolate, the 10 GB Durable Object cap, the ~1,000 req/s single-object soft limit, R2's zero egress, Containers' billed egress, R2 Class A/B rates and the exit-cost table are load-bearing for mir-cloud Gate 3 eliminations and Gate 4 rankings. This module cites them; it does not restate them.
Surface state, verified 25 August 2026.
| Thing | State | Why it matters here | |
|---|---|---|---|
| Terraform Cloudflare provider | 5.24.0 (24 Aug 2026). v5.0.0 was a ground-up rewrite (29 Jan 2025); the v4 line still gets patches (4.52.8, 24 Jun 2026) | A v4 configuration is not a v5 configuration. §12 | |
| Migration tooling | tf-migrate supersedes the in-provider cmd/migrate, deprecated in 5.19.0 (24 Apr 2026); state upgraders run automatically from 5.19 | Following a 2025-era migration write-up now costs you a manual state rewrite you did not need | |
| Wrangler | 4.125.0 (20 Aug 2026); v4.0.0 landed 13 Mar 2025; v3 is the legacy dist-tag | Wrangler ships every few days. Pin it in devDependencies; npx wrangler unpinned is a moving deploy tool | |
| Durable Objects storage backend | New namespaces must be SQLite-backed (changelog 9 Jul 2026). SQLite GA 7 Apr 2025 | Any KV-backed-DO guidance you find is now legacy-only. §5 | |
| Config format | Cloudflare recommends wrangler.jsonc for new projects, and says some newer features are JSON-config only | A .toml example from a blog post may not express a newer binding |
The Cloudflare footguns AI walks into most
1. The isolate contract — and it is not "a small container"
Workers run as V8 isolates. The consequences AI treats as incidental are the contract:
- No host filesystem, no native binaries. Cloudflare's security model says it plainly: only JavaScript and WebAssembly are accepted, and the sandbox uses an empty mount namespace with
seccompblocking filesystem syscalls. The bare line "Workers have no filesystem" is now stale, though —node:fsexposes an in-memory virtual filesystem (/bundleread-only, a writable/tmp,/dev/null|random|full|zero), on by default withnodejs_compatand a compatibility date of 2025-09-01 or later./tmpis per-request and non-persistent. Say "no host filesystem and no native binaries," or you will be corrected by a Worker that importsnode:fsand works. - 128 MB is per *isolate*, not per invocation — and an isolate serves many concurrent requests. On exceeding it the runtime drains in-flight requests and starts a new isolate (error 1102, Logpush outcome
exceededMemory). A memory bug therefore shows up as intermittent 1102s under concurrency, not as a clean OOM on one request. - Global scope is shared state across requests in the same isolate. Anything you cache at module scope is visible to the next tenant request that lands on that isolate. Never cache per-user data there. This is the single most common security defect in AI-generated Worker code, and it is invisible in local development where you are the only user.
- Startup time is 1 second, enforced at upload, on the global scope only. Exceeding it fails the deploy with
Script startup exceeded CPU time limit(error 10021), and Wrangler emits a CPU profile plusstartup_time_ms. The widely repeated 400 ms figure is pre-October-2025 — it was raised on 10 Oct 2025. Move expensive init out of module scope into the handler or build time. - CPU time is not wall time, and neither is one number. Waiting on
fetch(), KV, D1 or a socket does not accrue CPU. HTTP-triggered Workers have no wall-clock cap while the client stays connected;ctx.waitUntil()buys up to 30 s past the response; runtime updates give in-flight requests a 30 s grace period. Cron triggers, queue consumers and Durable Object alarm handlers cap at 15 minutes of wall time — and note that Cloudflare's pricing page calls that same 15 minutes CPU time while the limits page calls it wall time. Trust the limits page and say the pricing page disagrees; do not quote either silently. - Six connections may be waiting for response headers at once. Once headers arrive a connection stops counting, so a Worker can hold many streams open — a seventh pending connection is queued, not rejected. Workers invoked through a service binding share the parent's budget. And
fetch()from a Worker to another Worker on the same zone without a service binding fails; it is not a counting question.
2. compatibility_date is the version pin, and an unset one is the worst case
Cloudflare's stability promise is real and it is narrow: "The Workers runtime will support old compatibility dates forever," and behaviour changes ship behind flags that a date enables. Two things follow that AI never states.
- If a date is not specified on upload via the API, it defaults to `2021-11-02` — the oldest date, before any flag took effect. A Worker deployed by a script that forgot the field is not on "current"; it is on five-year-old semantics, silently.
- A stale date is a silent downgrade, not a frozen-in-amber safety. The docs warn that the documentation itself only describes the current date, so an old Worker's actual behaviour has to be reconstructed from the compatibility-flags page. Two live examples:
nodejs_compat+nodejs_compat_v2are on by default from 2026-08-04; thenode:fsVFS from 2025-09-01. Same code, different runtime, decided by one string.
Treat the date as a dependency pin: it is reviewed, it is bumped deliberately in its own change, and the change is tested — never edited in the same commit as a feature. compatibility_flags is the escape hatch in both directions: enable one change ahead of its date, or disable one that already became default. Cloudflare reserves the right to break a live Worker and says it will contact affected developers first — a strong intent, not a guarantee. Flag table: references/workers-platform-mechanics.md.
3. limits is the only spend bound Cloudflare gives you
Budget alerts are explicit about what they are not: "Budget alerts are informational only. They do not pause or cap usage." They are also Pay-as-you-go only — Enterprise contract accounts are unsupported. There is no account-level hard cap.
The one enforceable lever is the limits block, and it has exactly two keys:
Three things to say out loud in the Gate 5 design:
- `cpu_ms` bounds the CPU dimension of the bill, not the request dimension. A request flood still bills per million requests with no ceiling. Cloudflare's own framing — "prevent accidental runaway bills or denial-of-wallet attacks" — over-promises relative to what the knob actually constrains. Put a WAF rate limit in front of the Worker if request volume is the exposure.
- Limits are enforced on Cloudflare's network only, never in local development, and are documented as supported for the Standard Usage Model. A
wrangler devrun that passes proves nothing about the limit. - Set `cpu_ms` to slightly above the measured p99, not to the maximum. The default 30 s is already ~13,000× the ~2.2 ms an average Worker uses. Raising it to 300,000 "to be safe" converts a bug into a five-figure invoice.
An older Worker may carry a limit nobody set: Cloudflare automatically applied a 50 ms CPU limit to Workers that were on the legacy Bundled usage model before the 1 March 2024 move to Standard pricing. If an inherited Worker terminates at a suspiciously round number, check the configured limit before profiling the code.
4. KV, D1 and Durable Objects are three different consistency contracts
AI routinely swaps one for another because all three are "Cloudflare storage." They are not interchangeable, and the difference is the correctness of your application.
| Consistency | Write model | Where it breaks | ||
|---|---|---|---|---|
| Workers KV | Eventually consistent. Changes are usually immediately visible at the writing location — the docs say do not rely on it — and "up to 60 seconds or more" elsewhere | 1 write/sec per key, both plans | Read-modify-write. Counters. Anything where a stale read is a bug rather than a slower page | |
| D1 | Single primary, single-threaded, one query at a time, backed by one Durable Object. Read replication adds sequential consistency with bookmarks — and only if you use the Sessions API | 30 s max query duration; 10 GB hard database cap that cannot be raised | Concurrency. At 100 ms/query you get ~10 queries/sec; the queue then returns overloaded | |
| Durable Objects | Serialized per object. Storage writes are coalesced into implicit atomic transactions; gates order them | One thread per object; ~200–1,000 req/s depending on work per request | A single global object used as a coordinator | |
| R2 | Object store; see §7 | Using it as a database |
Three traps worth naming:
- KV caches negative lookups too. A read that found nothing is cached like any other, so creating a key is as delayed as changing one. Code that writes then immediately re-reads to confirm is not confirming anything.
- `cacheTtl` trades freshness for cost linearly. Minimum 30 s, default 60 s; raising it raises the staleness window by the same amount. Cloudflare's own recommendation for write-heavy keys is to route writes through a Durable Object and read from KV elsewhere.
- D1 read replication is not automatic and is not confirmed GA. Queries go to the primary unless you call
withSession(); a replica "may be arbitrarily out of date"; the Sessions API is binding-only, not REST. The only status Cloudflare has formally published is public beta (10 Apr 2025) even though the current docs page reads as GA. Note also that Cloudflare never uses the words "strongly consistent" about D1 — do not put them in a design.
5. A Durable Object is one thread, and that is the design constraint
The pillar eliminates on the 10 GB cap and the single-object ceiling. What belongs here is what to do about it.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/mir-cloud-cloudflare/SKILL.md
Popularity
- Repository stars
- 15
- 7-day trend score
- 14
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
configConfiguration overrides
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/anantbhandarkar/make-it-right/mir-cloud-cloudflare)