durable-objects

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

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

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, alarms, and wrangler configuration, and outdated assumptions lead to bottlenecks, lost state, and broken migrations. ## Core Features & Use Cases - Implementation Guidance: Provides patterns for Durable Object classes, RPC methods, SQLite storage, alarms, and stub creation with deterministic routing via getByName. - Best-Practice Enforcement: Lists critical rules and anti-patterns, such as avoiding a single global DO and persisting state before caching it in memory. - Testing & Configuration References: Routes to current Vitest integration docs and wrangler.jsonc configuration for bindings, migrations, and observability. - Use Case: When building a chat room with per-room state, use this Skill to scaffold the Durable Object class, configure SQLite migrations, and write tests that verify state persistence across calls. ## Quick Start Ask the assistant to create a Durable Object class with SQLite storage and wrangler bindings for a chat room application.

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 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. Configure the binding in wrangler.jsonc and add a migration with new_sqlite_classes listing your class name.

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 entities use newUniqueId() while storing the mapping externally.

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. They are designed for coordination, strong consistency, and per-entity storage.

How do I test Durable Objects with Vitest?

Use Cloudflare's Vitest integration to run Durable Objects in the Workers runtime, testing RPC methods for object behavior and HTTP routes for Worker contracts. Verify state persists across calls, different identities stay independent, and use the documented alarm helpers instead of waiting for wall-clock time.

Why does blockConcurrencyWhile hurt Durable Object performance?

Calling blockConcurrencyWhile on every request serializes all concurrency and kills throughput. It should only wrap one-time initialization like schema setup in the constructor, and must never span fetch() calls or external I/O.