Code & Engineering

Durable Object Billing Review: Cloudflare Cost

Reviews Cloudflare Durable Object code, wrangler config and a Durable Objects bill for what costs money. Finds an object kept awake and billed for wall-clock time it does not need (a pending timer, AbortSignal.timeout that is never cleared, even inside a helper, setInterval instead of an alarm, WebSockets that cannot hibernate, work held by waitUntil), objects and SQL storage that pile up because nobody deletes them (an object per visitor or per MCP session, McpAgent probes), and bills that cross the included amount by a few percent and are charged a whole started unit. Explains how the bill is computed: GB-seconds at 128 MB, one allowance for the whole account, rounding up. Gives the fix in code for each finding and ends a review with VERDICT: OK or VERDICT: CHANGE. Use when asked to review Durable Object code or config for cost, or why a Durable Objects bill is higher than the work done.

Durable Object Billing Review: Cloudflare Cost is a SKILL.md that reviews Cloudflare Durable Object code, wrangler config and a Durable Objects bill for what costs money; an agent buys it once for $0.05 over x402.

Tested 2026-11-22No code, no hidden instructionsv1.0.2 · 11.2 KB · perpetual license

Not for

Correctness, security or design of a Durable Object: it looks at cost only. It does not cover other Cloudflare products (D1, R2, KV, Workers CPU), and it cannot read a live account, so figures such as GB-seconds and object counts must come from the person or from the usage query it names. Prices change; it works from the units and the rounding rule, and says so when a figure is not given.

Tested, honestly

Tested 2026-11-22 with a strong and a weak model.

With and without the skill

Results with and without the skill, for Sonnet and Haiku
SonnetHaiku
withwithoutwithwithout
Setups answered right (16 setups)16/1612/1614/1610/16

Same request and checks on both sides. Sonnet without the skill knew hibernating sockets, setInterval, McpAgent objects and deleted_classes (with a full wrangler deploy), the shared allowance and cart expiry, and answered OK on all five sound twins. It missed two measured facts about money: a limit from AbortSignal.timeout keeps the object billed until it ends (it called the alarm's 10-second limit fine, kept the helper's and added one, and for the bill at 100 % awake blamed an endpoint and advised a shorter limit), and an overage is charged per started million (it said $0.14, the invoice $12.50). It passed wrangler tail on a hedge, then expected tail to show the alarm's log lines. Haiku without the skill missed the same two facts and called two sound twins a storage risk from random keys; with the skill it still did on one of them.

Same cases and the same checks with and without the skill. The cases are ours, written around what the skill is for; with a handful of cases, a difference of one or two is within noise.

SonnetStrong model, claude-sonnet-5-5
Right on all 16 setups on the 1.0.2 bytes, read by hand. It named the AbortSignal.timeout timer that keeps an alarm object billed in the alarm itself, in a shared helper the object calls, and as the cause of a bill at 100 % awake, said that a shorter limit would not help, and gave a controller with clearTimeout in finally. It priced 11,000 GB-seconds over the allowance as a whole started million, $12.50, said that wrangler tail does not show alarm invocations, that deleted_classes is not applied by versions upload, that McpAgent makes one object per initialize, and that the allowance is shared by the account. It moved setInterval to an alarm and gave abandoned carts an expiry alarm with deleteAll. It answered VERDICT: OK on all five sound setups: a cleared timer, hibernating sockets, MCP without objects, direct writes and carts that expire.
HaikuWeak model, claude-haiku-5-5
Right on 14 of 16 on the 1.0.2 bytes, read by hand. It named the uncleared AbortSignal.timeout timer in all three setups, including the helper and the bill at 100 % awake, charged the small overage as a whole $12.50, and was right on wrangler tail, deleted_classes, McpAgent and the shared allowance. It moved the setInterval counter to an alarm and answered OK on three sound setups, but it missed the OK verdict on two: on the counter that writes every view directly it again raised a storage pile-up from random paths a bot could send (Haiku without the skill raised the same there), and on the carts that expire through an alarm it asked for input checks and a cap on cart lines, which are not cost faults.

Full test summary

Example

Our own test text, before and after the skill ran. Excerpts only.

English · claude-sonnet-5-5

Before

// src/clock.ts — one object ("main") wakes every minute and calls our job endpoints import { DurableObject } from "cloudflare:workers"; type Job = { name: string; url: string }; export class Clock extends DurableObject<Env> { async alarm() { await this.ctx.storage.setAlarm(Date.now() + 60_000); const jobs = (await this.ctx.storage.get<Job[]>("jobs")) ?? [];…

After

**[TIMER-AWAKE]** `src/clock.ts`, `Clock.fire()`, the `AbortSignal.timeout(10_000)` call `AbortSignal.timeout` keeps its timer pending until the 10 seconds pass, even when the endpoint answers in 1 to 2 seconds. Every minute, the object stays awake and billed for about 10 seconds after the work is done.…

What is in the file

  • How the bill is computed
  • What keeps an object awake
  • The fix for a limit on a call
  • What piles up
  • Measure, do not guess
  • Answer format
  • Not a finding
  • What not to do

Languages

Any language. Tried in: English.

License

Perpetual, non-exclusive; use and modify for yourself incl. paid work; no resale or republishing. Holder: Georgi Kalchev, aiskills402.com. Full terms.

Versions

Current version 1.0.2, updated 2026-11-22. Whoever bought an earlier version gets new ones free through the same re-download token.

  1. v1.0.2 · 2026-11-22

    Two sentences reworded with the same meaning, so that no published post on our blog shares a run of five words with the file (the blog build checks this). The side with the skill was run again in full on the new bytes. One check widened for both sides: describing sound code as "not AbortSignal.timeout" is not advice to use it. Result, one run per model and setup: Sonnet 16 of 16, Haiku 14 of 16 (was 15). Without the skill, re-scored: 12 and 10 of 16, unchanged.

  2. v1.0.1 · 2026-11-22

    The price rose from $0.03 to $0.05 by the owner's decision, which follows the checklist table for a gain of four setups for Sonnet. The file itself is identical to 1.0.0.

  3. v1.0.0 · 2026-11-22

    - First version. - Tests: 16 setups of our own in test/make-cases.mjs (4 code reviews with a cost fault, 5 sound twins of them, 7 questions about a bill or a symptom); test/control.mjs shows that a right answer passes every check and a plausible wrong one fails. - Measured on 22 November 2026, one run per model and setup: Claude Sonnet 16 of 16 with the skill, 12 of 16 without; Claude Haiku 14 of 16 with, 10 of 16 without. Sonnet's gain is two distinct facts, both about money: a timer from AbortSignal.timeout that keeps the object billed until the limit ends (three setups: an alarm, a helper the object calls, a bill at 100 % awake) and an overage charged as a whole started million, $12.50 instead of $0.14 (one setup). - Price $0.03 (30000 micro): two distinct facts missed by Sonnet without the skill, both cost money. - Inputs fixed before the skill was written, run again without the skill: the sound twin of the alarm timer and its faulty pair (the twin wrote rows nobody read and its limit equalled the interval), and the wrangler tail question (the first input had no table and led the answer away). - Checks widened after reading the answers, for both sides: "VERDICT: OK (nothing must change)" and a plain "Nothing must change" count as the OK verdict; $12.50 named as the rate per million is not counted as a wrong charge. - Check widened after reading the answers, for both sides: on the setInterval counter, writing each view directly in fetch (one upsert, no timer) counts as a fix beside an alarm, since that is the code of our own sound twin. Haiku with the skill gave this fix. - After the run, for the catalog's safety gate: the code example of the controller limit is an indented block instead of a fenced one, and its return type annotation is left to inference (the gate reads an angle-bracket type as an HTML tag). The words and the code are otherwise unchanged. - Measured again on 22 November 2026 on those final bytes, the side with the skill in full, one run per model and setup: Claude Sonnet 16 of 16 with the skill (unchanged), Claude Haiku 15 of 16 with (was 14); without the skill 12 and 10 of 16 as before. Haiku now answers OK on the carts that expire; on the counter that writes each view it still raised random paths. Price stays $0.03.

FAQ

Durable Object review: what comes back?

Each change that lowers the bill, as its own block: a code, the file or call, why it costs, and the fix. Nine codes name a timer that holds the object awake, setInterval, sockets that cannot hibernate, held work, objects nobody deletes, one object made for every MCP probe, a bill over the allowance, a changed queue time-out and a class removal. Things that look risky and are fine go in a separate list, so a cleared timer or a hibernating socket is never a finding. A review closes with VERDICT: OK or VERDICT: CHANGE.

Why can a two-second job bill for a minute?

A Durable Object is charged for the time it stays in memory. A time-out made with AbortSignal.timeout keeps its timer until the limit passes, even when the answer came at once, so an object that worked for two seconds waited for the rest of the limit. We measured about 61 seconds per wake on an alarm that fired every minute. The fix is a controller, a timer, and clearTimeout in finally, with the same abort reason.

Why did a tiny overage cost $12.50?

The allowance of 400,000 GB-seconds covers the whole account, and anything above it is charged for each million that is started. A small excess is billed like a full million. Requests and stored SQL data are rounded up the same way. So the skill works out the margin to the threshold and aims to stay under it, since using a little less above it saves nothing.

Does it help Claude Sonnet?

Two facts that cost money made the difference. Our sixteen setups: alarm objects, a chat room, two MCP servers, page-view counters, carts and seven questions about a bill. Sonnet alone got 12 right, with the skill 16. It knew hibernating sockets, the shared allowance, McpAgent and deleted_classes. It did not know that a limit from AbortSignal.timeout keeps the object billed until it ends: it approved one twice and once advised a shorter one. It priced 11,000 GB-s over at $0.14, where our invoice charged a whole million, $12.50. Haiku rose from 10 to 14.

Read more

Share

Read this page as Markdown: /skills/durable-object-billing-review.md.

  • Cloudflare Workers Review: D1, OpenNext, Fetch

    Code & Engineering

    SKILL.md · v1.2.0 · 9.8 KB

    Reviews pasted Cloudflare Workers code and configuration (a Worker, a Next.js app on OpenNext, D1 queries, wrangler config) for platform pitfalls that pass every local test and then fail in production or quietly cost money. It flags the edge runtime under OpenNext, a fetch to your own Worker's workers.dev address (error 1042), D1 queries that bind more than 100 parameters as data grows, LIKE patterns over D1's 50-byte limit, reading rowsAffected where D1 returns meta.changes, interactive transactions D1 does not have, secrets kept in plain vars, outbound fetch code that treats only a thrown error as failure, a browser User-Agent that bot protection challenges, client hop-by-hop headers forwarded to fetch, cron triggers whose day of the week is written as numbers, and unbounded queries on the request path. Each finding has a fixed code, the place, the reason and a fix, then one verdict. Use to review a Cloudflare Worker before deploy, check D1 or wrangler code, or audit a Next.js app running on Cloudflare.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026

  • SQL Query Optimizer for D1, SQLite and Turso

    Code & Engineering

    SKILL.md · v1.0.2 · 9.8 KB

    Reviews SQL queries, schemas and migrations for SQLite, Cloudflare D1 and Turso, where the bill and the speed follow the rows a query READS, not the rows it returns. Finds full scans hidden behind LIMIT, aggregates over growing tables, index column gaps, NOT IN, OR, functions and LIKE patterns that switch an index off, OFFSET pagination, N+1 loops, the D1 limit of 100 bound parameters, tables that never shrink and new flag columns that turn the whole history into pending work; ranks them by cost and gives the index or rewrite that fixes each. Use when asked to optimize a SQL query, review a database schema or a migration, find a slow query, or cut rows read on D1, SQLite or Turso.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 3 Oct 2026

  • Recommended

    Agent Done Check: Stop False Success Reports

    Agents & Protocols

    SKILL.md · v1.0.3 · 9.9 KB

    Stops an AI agent from reporting false success, or hallucinated completion: work it calls done that did not happen. Every action in its status report gets one of five states (done and verified, done but not confirmed, partly done, failed, not done), backed by what the tool results of the session show. Failures and unknowns come first, counts come from the results, and no id, receipt or hash is invented. When a result does show success, the agent says so plainly. Use whenever an agent reports on actions it took with tools, such as messages, batches, tests, builds, deploys, file edits, data updates, payments or API calls.

    $0.10once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 3 Oct 2026

More in Code & Engineering

  • WCAG Color Contrast Check: AA and AAA Ratios

    Code & Engineering

    SKILL.md · v1.0.1 · 10.3 KB

    Computes the real contrast ratio of every text and background pair in pasted CSS, design tokens or a palette, says whether each pair passes WCAG AA and AAA, and gives every failing pair a replacement color that passes on its real background. It carries a table of 256 channel values so the ratio is added and divided instead of guessed, and it reads the cases a glance gets wrong: a rgba color or opacity is blended with its background first, a placeholder is text, 18px bold is not large text, a border or an icon is a 3:1 component, a disabled control and a logo are exempt, short hex and color names are expanded, and 4.48 is never rounded up to 4.5. One line per pair, then a Verdict line. Use when asked for a WCAG color contrast check of a stylesheet, theme or palette, whether colors pass AA or AAA, or to fix text colors that are too pale.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 12 Nov 2026

  • Recommended

    Safe Refactoring: Refactor Without Changing Behavior

    Code & Engineering

    SKILL.md · v1.0.1 · 9.7 KB

    Refactors, cleans up and modernizes Python, JavaScript, TypeScript and React code without changing what it does. It guards the change that cleanups make most often without saying so - how the code treats missing and empty values - and ends each answer with a short Behavior section that names what was checked and anything that changed. Use when asked to refactor, clean up, tidy, simplify or modernize a function, class, component or file.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 13 Nov 2026

  • API Key Leaks in Code: Secret Handling Review

    Code & Engineering

    SKILL.md · v1.0.0 · 7.8 KB

    Reviews pasted application code, scripts and config for the four ways a secret leaks from the code that uses it, and lists only those, one line each with a fixed code, the place, who can then read the secret and the fix - or exactly No findings. It catches a secret value written to a log or printed (the key itself, an object or environment dump that contains it), a secret placed in a URL query string, a secret typed into source or a committed file, and a server secret sent to the browser through a public environment prefix or a prop of a client component. It leaves out the safe look-alikes: printing only that a key is present, its length or its last four characters, a publishable key that is public by design, and a secret read from the environment on the server. Use to review code that calls an API with a key, to check a Next.js or Vite project before release, or to gate a pull request that touches credentials.

    $0.01once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 29 Oct 2026

  • Convert a Cron Expression: Linux, Quartz, GitHub Actions

    Code & Engineering

    SKILL.md · v1.0.0 · 11.4 KB

    Converts an existing schedule between cron dialects so that the target runs at exactly the times the source runs - classic crontab, GitHub Actions schedule, a Quartz-style six-field expression, a small numbers-only HTTP scheduler (Cron Hub) and Cloudflare Workers Cron Triggers - answered as JSON with the crons and a note. Knows what changes between them - day-of-week 1 is Monday in crontab and GitHub but Sunday in Cloudflare, 0 is refused by Cloudflare, 7 means Sunday in crontab and Saturday in Cloudflare, names are refused by the small scheduler; a day of the month plus a day of the week means either in crontab but both in the small scheduler; the at-sign macros, reboot, seconds other than zero and sub-5-minute GitHub intervals have no equivalent; a time zone becomes a timezone key, a CRON_TZ line or two UTC hours. Refuses what cannot be run at the same times. Use when asked to move a job from one scheduler to another, to port a crontab or a workflow schedule to wrangler, or to check that an expression in one dialect means the same in another. For a schedule given in words, use cron-schedule instead.

    $0.02once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 9 Oct 2026