durable-objects

Create and review Cloudflare Durable Objects for stateful coordination, RPC, SQLite storage, alarms, and WebSockets.

13|1|Updated Feb 9, 2026
One-click install
npx skills add https://github.com/vedang/dotagents --skill durable-objects-vedang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: durable-objects
Source: https://github.com/vedang/dotagents/tree/main/specific_skills/durable-objects
Command: npx skills add https://github.com/vedang/dotagents --skill durable-objects-vedang

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @cloudflare/vitest-pool-workers, vitest, wrangler, zod, and includes references (resource) components.

What problem does it solve? Building stateful, coordinated applications on Cloudflare's edge requires deep knowledge of Durable Objects APIs, concurrency rules, and wrangler configuration, and outdated knowledge leads to anti-patterns like global bottleneck DOs or broken atomicity. ## Core Features & Use Cases - Durable Object Creation: Implement DO classes with RPC methods, SQLite storage, schema migrations, alarms, and WebSocket hibernation following current best practices. - Code Review: Audit existing DO code for anti-patterns such as single global DOs, misused blockConcurrencyWhile, and non-atomic storage writes. - Testing & Configuration: Set up wrangler bindings and migrations plus Vitest tests using @cloudflare/vitest-pool-workers, including alarm triggering and direct storage inspection. - Use Case: When building a multiplayer game backend, use this Skill to design one DO per match with deterministic getByName routing, SQLite-backed state, and scheduled timeout alarms. ## Quick Start Ask the agent to create a Cloudflare Durable Object for a chat room with SQLite storage, RPC methods, and wrangler configuration.

Frequently Asked Questions about durable-objects

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Cloudflare Durable Object with SQLite storage?

Extend the DurableObject class from cloudflare:workers and configure new_sqlite_classes in your wrangler migrations. Initialize tables inside the constructor using ctx.blockConcurrencyWhile, then run synchronous queries via this.ctx.storage.sql.exec.

How do I test Durable Objects with Vitest?

Use @cloudflare/vitest-pool-workers with defineWorkersConfig pointing at your wrangler config. Access stubs via env from cloudflare:test, inspect internals with runInDurableObject, and trigger alarms instantly with runDurableObjectAlarm.

Should I use RPC methods or fetch handlers in Durable Objects?

Use RPC methods, which are typed public class methods callable directly on the stub, when your compatibility date is 2024-04-03 or later. Reserve fetch handlers for WebSocket upgrades and HTTP-specific needs.

When should I not use Durable Objects?

Avoid Durable Objects for stateless request handling, which plain Workers handle better, and for workloads needing maximum global distribution or high fan-out of independent requests. DOs are designed for coordination and strong consistency per entity.

Why does blockConcurrencyWhile hurt Durable Object performance?

blockConcurrencyWhile blocks all concurrency in the instance, so using it on every request caps throughput at roughly 200 requests per second. Reserve it for one-time constructor initialization and never hold it across external fetch or I/O calls.

How do Durable Object alarms work?

Each DO supports one alarm at a time, and calling setAlarm replaces any existing alarm. The alarm handler runs at the scheduled time with automatic retries on failure, so handlers should be idempotent and can reschedule themselves for recurring work.