durable-objects

Create and review Cloudflare Durable Objects for stateful coordination on Workers.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @cloudflare/vitest-pool-workers, vitest, wrangler, zod, and includes references (resource) components.

What problem does it solve? Building stateful, strongly consistent applications on Cloudflare's edge requires correct Durable Object design, and outdated knowledge of DO APIs, wrangler migrations, and concurrency rules leads to bottlenecks, race conditions, and lost state. ## Core Features & Use Cases - Durable Object Implementation: Create DO classes with RPC methods, SQLite storage, 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, and broken write coalescing. - Testing & Configuration: Configure wrangler bindings and migrations, and write unit and integration tests with @cloudflare/vitest-pool-workers. - Use Case: When building a multiplayer game backend, use this Skill to design one DO per game session, implement typed RPC methods, schedule timeout alarms, and verify behavior with isolated Vitest tests. ## Quick Start Use the durable-objects skill to create a chat room Durable Object with SQLite storage, WebSocket support, 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 in the constructor using ctx.blockConcurrencyWhile with ctx.storage.sql.exec for synchronous SQL operations.

How to test Durable Objects with Vitest?▼

Use @cloudflare/vitest-pool-workers to run tests inside the Workers runtime. Access stubs via env from cloudflare:test, inspect internals with runInDurableObject, and trigger alarms immediately with runDurableObjectAlarm.

When should I use Durable Objects vs plain Workers?▼

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

Why does blockConcurrencyWhile hurt Durable Object performance?▼

blockConcurrencyWhile blocks all concurrency, so using it on every request limits throughput to roughly 200 requests per second. Reserve it for one-time constructor initialization and never hold it across fetch or external I/O.

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 with a dedicated _sql_schema_migrations table, or use libraries like durable-utils that provide a SQLSchemaMigrations class.

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 should be idempotent and can reschedule by calling setAlarm again.