durable-objects

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

Updated May 5, 2026
One-click install
npx skills add https://github.com/Rocktown-Labs/reluxury --skill durable-objects-rocktown-labs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: durable-objects
Source: https://github.com/Rocktown-Labs/reluxury/tree/main/.agents/skills/durable-objects
Command: npx skills add https://github.com/Rocktown-Labs/reluxury --skill durable-objects-rocktown-labs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @cloudflare/vitest-pool-workers, vitest, 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, storage semantics, and wrangler configuration, and outdated knowledge leads to anti-patterns like global bottlenecks or lost in-memory state. ## Core Features & Use Cases - Durable Object Implementation: Create DO classes with RPC methods, SQLite storage, schema migrations, alarms, and WebSocket hibernation following current best practices. - Code Review & Anti-Pattern Detection: Review existing DO code for issues like single global DOs, misused blockConcurrencyWhile, broken write coalescing, and unpersisted critical state. - Testing & Workers Integration: Configure wrangler bindings and migrations, write Vitest tests with @cloudflare/vitest-pool-workers, and structure Worker handlers with typed Env interfaces. - Use Case: When building a multiplayer game or chat room, use this Skill to design one DO per room with deterministic getByName routing, SQLite-backed state, and alarm-based timeouts. ## Quick Start Ask the AI 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.

When should I use Durable Objects instead of plain Workers?

Use Durable Objects for coordination, strong consistency, per-entity storage, persistent WebSocket connections, or scheduled per-entity work. Use plain Workers for stateless request handling, maximum global distribution, or high fan-out independent requests.

Does Durable Objects SQLite support PRAGMA user_version for migrations?

No, PRAGMA user_version is not supported in Durable Objects SQLite storage. Track schema versions in a dedicated _sql_schema_migrations table and apply incremental migrations inside the constructor.

Why does my Durable Object lose state between requests?

Class properties are lost when the instance is evicted or crashes. Always persist critical state to SQLite storage first, then update in-memory caches, since only storage survives eviction.

How many alarms can a Durable Object have?

Each Durable Object supports exactly one alarm; calling setAlarm replaces any existing alarm. Reschedule inside the alarm handler for recurring work, and keep handlers idempotent because failed alarms auto-retry.