durable-objects

A guide for building and reviewing Cloudflare Durable Objects backed by SQLite. Durable Objects are Cloudflare edge components that keep state and coordinate requests, such as in chat rooms, multiplayer games, or booking systems.

In plain words
What is it for?
Use it to create or review Durable Objects, add RPC methods, alarms, WebSocket handling, SQLite storage, service bindings, migrations, sharding, and tests.
Why use it?
It brings storage, concurrency, networking, recovery, configuration, and testing guidance together for stateful Cloudflare applications.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/null-shot/cloudflare-skills/durable-objects
Any agent
npx skills add null-shot/cloudflare-skills --skill durable-objects
Clone the repo
git clone --depth 1 https://github.com/null-shot/cloudflare-skills

Made for: Claude Code, Codex.

Per session 76 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,629 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin fork From a forked repository.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00076 $0.04629
Opus 5 $0.00038 $0.02315
Sonnet 5 $0.00015 $0.00926
Haiku 4.5 $0.00008 $0.00463

Measured 2d ago against content hash 311066fc6233, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

durable-objects scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

async fetch(request: Request, env: Env): Promise<Response> {
durable-objects/SKILL.md · 624 lines

How it starts

The opening of the file, as written. The whole thing — 624 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Durable Objects

Build stateful, coordinated applications on Cloudflare's edge using Durable Objects.

Important: This guide focuses on SQLite-backed Durable Objects (recommended for all new projects). Configure with new_sqlite_classes in migrations. Legacy KV-backed Durable Objects exist for backwards compatibility but are not covered in detail here to avoid confusion.

When to Use

  • Creating new Durable Object classes for stateful coordination
  • Implementing RPC methods, alarms, or WebSocket handlers
  • Reviewing existing DO code for best practices
  • Configuring wrangler.jsonc/toml for DO bindings and migrations
  • Writing tests with @cloudflare/vitest-pool-workers
  • Designing sharding strategies and parent-child relationships

Reference Documentation

Durable Objects Core

  • ./references/sqlite-storage.md - Complete SQLite API, PITR, KV methods, transactions, limits
  • ./references/service-bindings.md - Namespace API, stub creation, RPC methods, service bindings
  • ./references/rules.md - Core rules, storage patterns, concurrency, WebSockets
  • ./references/testing.md - Vitest setup, unit/integration tests, alarm testing
  • ./references/workers.md - Workers handlers, types, wrangler config, observability

SQLite SQL Features

  • ./references/json-functions.md - Complete JSON API: extract, modify, arrays, objects, generated columns
  • ./references/foreign-keys.md - Foreign key constraints, CASCADE, RESTRICT, SET NULL, deferring constraints
  • ./references/sql-statements.md - SQLite extensions (FTS5, Math), PRAGMA statements, schema introspection

Search: sql.exec, getByName, transactionSync, ctx.storage.sql, blockConcurrencyWhile

Core Principles

Use Durable Objects For

Need Example
Coordination Chat rooms, multiplayer games, collaborative docs
Strong consistency Inventory, booking systems, turn-based games
Per-entity storage Multi-tenant SaaS, per-user data
Persistent connections WebSockets, real-time notifications
Scheduled work per entity Subscription renewals, game timeouts

Read the full file on GitHub · 624 lines

Files

What ships with it

8 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 624 lines · 76 tokens per session scan A 311066fc6233

Subscribe to this mod's changes

durable-objects is a skill published in the GitHub repository null-shot/cloudflare-skills (0 stars, last pushed 7mo ago), licensed Apache-2.0. It adds 76 tokens to every session and 4,629 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). It comes from a forked repository.

Related

Other skills, from other repositories

kagent-dev

Development guide for kagent's v1alpha3 Harness and AgentTemplate CRDs, AgentInstance gRPC control plane, upstream A2A integration, Substrate runtime provisioning, tests, generation, and PR workflow. Use for any implementation, debugging, review, or CI task in the kagent repository.

kagent-dev/kagent · 65 tokens

timoni

Use when deploying applications to Kubernetes with Timoni. Covers installing and upgrading module instances from OCI registries, composing multi-app deployments with bundles, injecting values from clusters or CI with runtimes, targeting multiple clusters, and authoring, testing, signing and publishing modules with CUE.

stefanprodan/timoni · 59 tokens

azmon-mirroredcatalogs-operations-cli

Brings Azure Monitor, Application Insights, and Log Analytics telemetry into Fabric as Eventhouse external delta tables and correlates it with business data. Use to onboard observability data, judge whether latency or availability affected revenue, or build a Real-Time dashboard and Operations Agent over it.

microsoft/skills-for-fabric · 66 tokens

durable-objects

Create and review Cloudflare Durable Objects. Use when building stateful coordination (chat rooms, multiplayer games, booking systems), implementing RPC methods, SQLite storage, alarms, WebSockets, or reviewing DO code for best practices. Covers Workers integration, wrangler config, and testing with Vitest. Biases…

cloudflare/skills · 76 tokens

ship-web-games

Package, deploy, and verify a playable Three.js or web game. Use for release builds, asset delivery, private/public deployment, production smoke tests, browser proof, release notes, rollback readiness, and cleanup of temporary QA resources.

MengTo/Skills · 50 tokens

hyperpod-version-checker

Check and compare software component versions on SageMaker HyperPod cluster nodes - NVIDIA drivers, CUDA toolkit, cuDNN, NCCL, EFA, AWS OFI NCCL, GDRCopy, MPI, Neuron SDK (Trainium/Inferentia), Python, and PyTorch. Use when checking component versions, verifying CUDA/driver compatibility, detecting version mismatches…

awslabs/agent-plugins · 120 tokens