durable-objects

Build, debug, and review Cloudflare Durable Objects code for persistent state and coordination.

Updated Sep 21, 2026
One-click install
npx skills add https://github.com/maxentr/la-cuisine-de-mm --skill durable-objects-maxentr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: durable-objects
Source: https://github.com/maxentr/la-cuisine-de-mm/tree/main/.agents/skills/durable-objects
Command: npx skills add https://github.com/maxentr/la-cuisine-de-mm --skill durable-objects-maxentr

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing correct Cloudflare Durable Objects code requires up-to-date knowledge of storage APIs, concurrency rules, wrangler configuration, and testing patterns that change frequently. This Skill guides implementation and review of Durable Objects while routing to current official documentation instead of relying on outdated training data. ## Core Features & Use Cases - Durable Object Implementation: Create DO classes with SQLite storage, RPC methods, alarms, and WebSocket handlers following Cloudflare best practices. - Configuration & Migrations: Set up wrangler.jsonc/toml bindings, SQLite class migrations, and TypeScript environment types. - Testing Guidance: Configure Cloudflare's Vitest integration to test RPC behavior, storage persistence, and alarm scheduling. - Use Case: You are building a real-time chat application and need per-room coordination. Use this Skill to scaffold a ChatRoom Durable Object with deterministic getByName routing, SQLite message storage, and hibernation-safe WebSocket handling. ## Quick Start Use the durable-objects skill to create a Durable Object class with SQLite storage and wire it up in my 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 initialize tables inside the constructor using ctx.blockConcurrencyWhile with ctx.storage.sql.exec. Register the class in wrangler migrations using new_sqlite_classes and bind it under durable_objects.bindings.

How do I route requests to a specific Durable Object instance?

Use env.MY_DO.getByName('room-123') for deterministic routing so the same name always maps to the same instance. For existing IDs use idFromString with get(), and for new unique instances use newUniqueId() while storing the mapping externally.

Should I use SQLite or KV storage for Durable Objects?

SQLite storage is recommended for new Durable Object classes and is configured via new_sqlite_classes in migrations. Legacy KV storage remains for existing classes, so inspect the backend of an existing class before choosing APIs.

How do I test Durable Objects with Vitest?

Use Cloudflare's Vitest integration to run Durable Objects in the Workers runtime, testing RPC methods, storage persistence, and alarms. Verify state survives across calls, different identities stay independent, and use the documented alarm helper instead of waiting for wall-clock time.

When should I not use Durable Objects?

Avoid Durable Objects for stateless request handling, workloads needing maximum global distribution, or high fan-out independent requests. Plain Workers fit those cases better since Durable Objects are designed for coordination and strongly consistent per-entity state.

Why does blockConcurrencyWhile hurt Durable Object performance?

blockConcurrencyWhile blocks all other requests to the instance until it completes, so using it on every request kills throughput. Reserve it for one-time schema initialization in the constructor and never hold it across fetch calls or external I/O.