durable-objects

Create and review Cloudflare Durable Objects for stateful coordination on Workers.

5|Updated Feb 2, 2026
One-click install
npx skills add https://github.com/sergiodxa/monorepo --skill durable-objects-sergiodxa
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: durable-objects
Source: https://github.com/sergiodxa/monorepo/tree/main/.agents/skills/durable-objects
Command: npx skills add https://github.com/sergiodxa/monorepo --skill durable-objects-sergiodxa

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Building stateful, strongly consistent applications on Cloudflare's edge requires correct Durable Object patterns for storage, concurrency, alarms, and WebSockets, and mistakes like global singletons or broken write atomicity cause bottlenecks and data loss. ## Core Features & Use Cases - Durable Object Implementation: Create DO classes with RPC methods, fetch handlers, SQLite storage, alarms, and WebSocket hibernation following Cloudflare best practices. - Code Review: Audit existing DO code for anti-patterns such as single global DOs, misused blockConcurrencyWhile, and unpersisted in-memory state. - Configuration & Testing: Set up wrangler bindings and migrations, plus unit and integration tests with @cloudflare/vitest-pool-workers. - Use Case: Build a multiplayer chat application where each room is a Durable Object with SQLite message storage, WebSocket broadcasting, and an alarm that archives inactive rooms. ## Quick Start Use the durable-objects skill to create a chat room Durable Object with SQLite storage, WebSocket support, 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 with 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.

When should I use RPC methods versus fetch handlers on a Durable Object?▼

Use RPC methods for typed domain operations when your compatibility date is 2024-04-03 or later. Keep fetch handlers when the Durable Object acts as an HTTP endpoint, proxy, WebSocket endpoint, or request forwarding boundary.

Why is my Durable Object a bottleneck under load?▼

A single global Durable Object serializes all requests and limits throughput. Model one DO per coordination atom such as a chat room or user, and avoid calling blockConcurrencyWhile on every request since it blocks all concurrency.

Can Durable Objects schedule recurring tasks with alarms?▼

Yes, call ctx.storage.setAlarm with a timestamp and implement the alarm handler method. Each DO supports only one alarm at a time, so reschedule inside the handler for recurring work and keep handlers idempotent since alarms auto-retry on failure.