durable-objects

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

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

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, migrations, alarms, and concurrency rules, and outdated patterns lead to bottlenecks, lost state, and broken tests. ## Core Features & Use Cases - Implementation Guidance: Provides current patterns for Durable Object classes, RPC methods, SQLite storage, alarms, and WebSocket handlers with wrangler configuration. - Code Review & Anti-Patterns: Flags critical mistakes such as single global DOs, misused blockConcurrencyWhile, and in-memory-only state. - Testing Support: Routes to Cloudflare's Vitest integration for testing RPC, storage persistence, and alarm behavior. - Use Case: When building a chat room with per-room state, use this Skill to scaffold the Durable Object class, configure wrangler.jsonc bindings and SQLite migrations, and write Vitest tests verifying state isolation between rooms. ## 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 Cloudflare Durable Object with SQLite storage?

Extend the DurableObject class from cloudflare:workers, initialize tables inside the constructor using ctx.blockConcurrencyWhile with ctx.storage.sql.exec, and register the class in wrangler migrations using new_sqlite_classes.

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 newUniqueId() when you need a fresh instance.

Should I use SQLite or KV storage for Durable Objects?

SQLite storage is recommended for new classes and is configured via new_sqlite_classes in wrangler migrations. KV storage remains for legacy classes, so inspect the backend of existing classes before choosing APIs.

How do I test Durable Objects with Vitest?

Use Cloudflare's Vitest integration to run Durable Objects in the Workers runtime. Write RPC tests for object behavior, verify state persists across calls, and use the documented test helpers to trigger alarms without 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 strong consistency.

Why does blockConcurrencyWhile hurt Durable Object performance?

blockConcurrencyWhile blocks all other requests until it completes, so using it on every request kills throughput. It should only wrap schema initialization in the constructor and must never span fetch() calls or external I/O.