durable-objects

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

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

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, and wrangler configuration, and outdated knowledge leads to subtle bugs like broken atomicity or throughput-killing patterns. ## Core Features & Use Cases - Durable Object Implementation: Guides creation of DO classes with RPC methods, SQLite storage, schema migrations, alarms, and WebSocket hibernation. - Code Review & Anti-Pattern Detection: Flags critical mistakes such as single global DOs, misused blockConcurrencyWhile, and in-memory-only state. - Testing with Vitest: Covers unit tests, integration tests via SELF, alarm triggering, and direct storage inspection using @cloudflare/vitest-pool-workers. - Use Case: When building a multiplayer game backend, use this Skill to design one DO per game session, configure wrangler migrations with new_sqlite_classes, and write isolated Vitest tests for alarm-based turn timeouts. ## Quick Start Ask the agent 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 wrangler migrations with new_sqlite_classes. Initialize tables in the constructor using ctx.blockConcurrencyWhile and run synchronous queries via this.ctx.storage.sql.exec.

How to 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.

Should I use RPC methods or fetch handlers in Durable Objects?▼

Use RPC methods with compatibility date 2024-04-03 or later. Public class methods become typed RPC endpoints callable directly on the stub, avoiding manual request parsing and response serialization in fetch handlers.

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 stateless tasks better since DOs add coordination overhead and single-location placement.

Why does blockConcurrencyWhile hurt Durable Object performance?▼

blockConcurrencyWhile blocks all concurrency in the instance, so using it per request caps throughput around 200 requests per second. Reserve it for one-time constructor initialization and never hold it across fetch or external I/O.

How do Durable Object alarms work?▼

Each DO supports one alarm; calling setAlarm replaces any existing alarm. The alarm handler runs at the scheduled time with automatic retries on failure, so handlers must be idempotent and can reschedule by calling setAlarm again.