Writing a Cloudflare cost-guard skill for coding agents
An AIIDE List guide on turning Cloudflare billing safety into an agent skill with BUILD, AUDIT, PREDEPLOY and INCIDENT modes, plus risk rules for D1 queries, Durable Object alarms, polling, Queues and R2.
- Products
- WorkersD1Durable ObjectsQueuesR2KVWorkers AI
- Source
- Community resourceAIIDE List blog (aiidelist.com)
Key points
- The article frames bill shock as cost amplification: a small per-operation cost multiplied by frequency, scan size, fan-out, repeated delivery or long-lived execution, including traffic-free triggers such as alarms, Cron, Queues and R2 notifications.
- The skill has four modes: BUILD (choose bounded designs), AUDIT (read-only), PREDEPLOY (return PASS, REVIEW REQUIRED, BLOCKED or UNKNOWN) and INCIDENT (containment only with explicit authorization). Findings should include file and line, trigger, billable operation, multiplier, confidence, impact, fix and verification.
- It provides a SKILL.md template and install paths (.agents/skills for Codex, .claude/skills for Claude Code), and suggests an always-on rule in AGENTS.md or CLAUDE.md because an optional skill may not activate on every edit.
- Risk rules: verify hot D1 queries with EXPLAIN QUERY PLAN and meta.rows_read/rows_written; give Durable Object alarms a persisted stop condition, idempotent side effects, a minimum rearm interval, an independent stop switch and bounded batches; and limit polling, Queue and R2 feedback loops. Its $893 and $1,950 D1 figures are labelled as illustrations, not forecasts.
- The article states that a skill cannot enforce a billing cap, and that budget alerts are informational, not a spending limit. It cites Billflare's case archive and billing-audit skill as references.
Original sources
Published
Writing a Cloudflare cost-guard skill for coding agents
Open original sourceAn AIIDE List guide on turning Cloudflare billing safety into an agent skill with BUILD, AUDIT, PREDEPLOY and INCIDENT modes, plus risk rules for D1 queries, Durable Object alarms, polling, Queues and R2.
More to read
Observability pricing (from December 1, 2026)
Cloudflare’s unified pricing for logs and traces: Workers Logs, Workers Traces, Containers logs, R2 data access logs and AI Gateway logs move to per-GB ingestion and GB-month storage on December 1, 2026.
saastrash: hit with two consecutive months of $250+ Cloudflare bills without knowing.
In a reply to a Cloudflare engineer’s post previewing hard spending caps, saastrash says “yes please” and that they just got smacked with two consecutive months of $250+ bills and had no idea. The author adds that billing is buried, so they do not feel it is the user’s fault.
NatashaTheRobot: a bot that sends a daily Cloudflare billing summary
After a $10 surprise alert, NatashaTheRobot built a scheduled bot that monitors her Cloudflare account and sends a daily billing usage summary, and shared it as a template.