durable-objects — durable-objects AI agent skill durable-objects, official, durable-objects AI agent skill, ide skills, durable-objects for Claude Code

Verified
v1.0.0

About this Skill

Perfect for Edge Computing Agents needing stateful coordination and storage using Cloudflare Durable Objects. Create and review Cloudflare Durable Objects. Use when building stateful coordination (chat rooms, multiplayer games, booking systems), implementing RPC methods, SQLite storage, alarms, WebSockets, or reviewing DO code for best practices. Covers Workers integration, wrangler config, and testing with Vitest. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.

# Core Topics

cloudflare cloudflare
[711]
[80]
Updated: 3/26/2026

Killer-Skills Review

Decision support comes first. Repository text comes second.

Reviewed Landing Page Review Score: 10/11

Killer-Skills keeps this page indexable because it adds recommendation, limitations, and review signals beyond the upstream repository text.

Original recommendation layer Concrete use-case guidance Explicit limitations and caution Quality floor passed for review Locale and body language aligned
Review Score
10/11
Quality Score
89
Canonical Locale
en
Detected Body Locale
en

Perfect for Edge Computing Agents needing stateful coordination and storage using Cloudflare Durable Objects. Create and review Cloudflare Durable Objects. Use when building stateful coordination (chat rooms, multiplayer games, booking systems), implementing RPC methods, SQLite storage, alarms, WebSockets, or reviewing DO code for best practices. Covers Workers integration, wrangler config, and testing with Vitest. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.

Core Value

Empowers agents to build stateful, coordinated applications on Cloudflare's edge using Durable Objects, implementing RPC methods, SQLite storage, alarms, WebSockets, and testing with Vitest, while following best practices from Cloudflare docs.

Ideal Agent Persona

Perfect for Edge Computing Agents needing stateful coordination and storage using Cloudflare Durable Objects.

Capabilities Granted for durable-objects

Creating new Durable Object classes for stateful coordination in chat rooms or multiplayer games
Implementing RPC methods, alarms, or WebSocket handlers for real-time notifications
Reviewing existing DO code for best practices and optimizing storage with SQLite
Configuring wrangler.jsonc/toml for DO bindings and migrations
Designing sharding strategies and parent-child relationships for scalable applications

! Prerequisites & Limits

  • Requires Cloudflare account and Workers integration
  • Prefer retrieval over pre-training for any Durable Objects task due to potential outdated knowledge
  • Not suitable for stateless request handling or maximum global distribution needs

Source Boundary

The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.

Curated Collection Review

Reviewed In Curated Collections

This section shows how Killer-Skills has already collected, reviewed, and maintained this skill inside first-party curated paths. For operators and crawlers alike, this is a stronger signal than treating the upstream README as the primary story.

After The Review

Decide The Next Action Before You Keep Reading Repository Material

Killer-Skills should not stop at opening repository instructions. It should help you decide whether to install this skill, when to cross-check against trusted collections, and when to move into workflow rollout.

Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is durable-objects?

Perfect for Edge Computing Agents needing stateful coordination and storage using Cloudflare Durable Objects. Create and review Cloudflare Durable Objects. Use when building stateful coordination (chat rooms, multiplayer games, booking systems), implementing RPC methods, SQLite storage, alarms, WebSockets, or reviewing DO code for best practices. Covers Workers integration, wrangler config, and testing with Vitest. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.

How do I install durable-objects?

Run the command: npx killer-skills add cloudflare/skills/durable-objects. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for durable-objects?

Key use cases include: Creating new Durable Object classes for stateful coordination in chat rooms or multiplayer games, Implementing RPC methods, alarms, or WebSocket handlers for real-time notifications, Reviewing existing DO code for best practices and optimizing storage with SQLite, Configuring wrangler.jsonc/toml for DO bindings and migrations, Designing sharding strategies and parent-child relationships for scalable applications.

Which IDEs are compatible with durable-objects?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for durable-objects?

Requires Cloudflare account and Workers integration. Prefer retrieval over pre-training for any Durable Objects task due to potential outdated knowledge. Not suitable for stateless request handling or maximum global distribution needs.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add cloudflare/skills/durable-objects. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use durable-objects immediately in the current project.

Upstream Repository Material

The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.

Upstream Source

durable-objects

Install durable-objects, an AI agent skill for AI agent workflows and automation. Review the use cases, limitations, and setup path before rollout.

SKILL.md
Readonly
Upstream Repository Material
The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.
Supporting Evidence

Durable Objects

Build stateful, coordinated applications on Cloudflare's edge using Durable Objects.

Retrieval Sources

Your knowledge of Durable Objects APIs and configuration may be outdated. Prefer retrieval over pre-training for any Durable Objects task.

ResourceURL
Docshttps://developers.cloudflare.com/durable-objects/
API Referencehttps://developers.cloudflare.com/durable-objects/api/
Best Practiceshttps://developers.cloudflare.com/durable-objects/best-practices/
Exampleshttps://developers.cloudflare.com/durable-objects/examples/

Fetch the relevant doc page when implementing features.

When to Use

  • Creating new Durable Object classes for stateful coordination
  • Implementing RPC methods, alarms, or WebSocket handlers
  • Reviewing existing DO code for best practices
  • Configuring wrangler.jsonc/toml for DO bindings and migrations
  • Writing tests with @cloudflare/vitest-pool-workers
  • Designing sharding strategies and parent-child relationships

Reference Documentation

  • ./references/rules.md - Core rules, storage, concurrency, RPC, alarms
  • ./references/testing.md - Vitest setup, unit/integration tests, alarm testing
  • ./references/workers.md - Workers handlers, types, wrangler config, observability

Search: blockConcurrencyWhile, idFromName, getByName, setAlarm, sql.exec

Core Principles

Use Durable Objects For

NeedExample
CoordinationChat rooms, multiplayer games, collaborative docs
Strong consistencyInventory, booking systems, turn-based games
Per-entity storageMulti-tenant SaaS, per-user data
Persistent connectionsWebSockets, real-time notifications
Scheduled work per entitySubscription renewals, game timeouts

Do NOT Use For

  • Stateless request handling (use plain Workers)
  • Maximum global distribution needs
  • High fan-out independent requests

Quick Reference

Wrangler Configuration

jsonc
1// wrangler.jsonc 2{ 3 "durable_objects": { 4 "bindings": [{ "name": "MY_DO", "class_name": "MyDurableObject" }] 5 }, 6 "migrations": [{ "tag": "v1", "new_sqlite_classes": ["MyDurableObject"] }] 7}

Basic Durable Object Pattern

typescript
1import { DurableObject } from "cloudflare:workers"; 2 3export interface Env { 4 MY_DO: DurableObjectNamespace<MyDurableObject>; 5} 6 7export class MyDurableObject extends DurableObject<Env> { 8 constructor(ctx: DurableObjectState, env: Env) { 9 super(ctx, env); 10 ctx.blockConcurrencyWhile(async () => { 11 this.ctx.storage.sql.exec(` 12 CREATE TABLE IF NOT EXISTS items ( 13 id INTEGER PRIMARY KEY AUTOINCREMENT, 14 data TEXT NOT NULL 15 ) 16 `); 17 }); 18 } 19 20 async addItem(data: string): Promise<number> { 21 const result = this.ctx.storage.sql.exec<{ id: number }>( 22 "INSERT INTO items (data) VALUES (?) RETURNING id", 23 data 24 ); 25 return result.one().id; 26 } 27} 28 29export default { 30 async fetch(request: Request, env: Env): Promise<Response> { 31 const stub = env.MY_DO.getByName("my-instance"); 32 const id = await stub.addItem("hello"); 33 return Response.json({ id }); 34 }, 35};

Critical Rules

  1. Model around coordination atoms - One DO per chat room/game/user, not one global DO
  2. Use getByName() for deterministic routing - Same input = same DO instance
  3. Use SQLite storage - Configure new_sqlite_classes in migrations
  4. Initialize in constructor - Use blockConcurrencyWhile() for schema setup only
  5. Use RPC methods - Not fetch() handler (compatibility date >= 2024-04-03)
  6. Persist first, cache second - Always write to storage before updating in-memory state
  7. One alarm per DO - setAlarm() replaces any existing alarm

Anti-Patterns (NEVER)

  • Single global DO handling all requests (bottleneck)
  • Using blockConcurrencyWhile() on every request (kills throughput)
  • Storing critical state only in memory (lost on eviction/crash)
  • Using await between related storage writes (breaks atomicity)
  • Holding blockConcurrencyWhile() across fetch() or external I/O

Stub Creation

typescript
1// Deterministic - preferred for most cases 2const stub = env.MY_DO.getByName("room-123"); 3 4// From existing ID string 5const id = env.MY_DO.idFromString(storedIdString); 6const stub = env.MY_DO.get(id); 7 8// New unique ID - store mapping externally 9const id = env.MY_DO.newUniqueId(); 10const stub = env.MY_DO.get(id);

Storage Operations

typescript
1// SQL (synchronous, recommended) 2this.ctx.storage.sql.exec("INSERT INTO t (c) VALUES (?)", value); 3const rows = this.ctx.storage.sql.exec<Row>("SELECT * FROM t").toArray(); 4 5// KV (async) 6await this.ctx.storage.put("key", value); 7const val = await this.ctx.storage.get<Type>("key");

Alarms

typescript
1// Schedule (replaces existing) 2await this.ctx.storage.setAlarm(Date.now() + 60_000); 3 4// Handler 5async alarm(): Promise<void> { 6 // Process scheduled work 7 // Optionally reschedule: await this.ctx.storage.setAlarm(...) 8} 9 10// Cancel 11await this.ctx.storage.deleteAlarm();

Testing Quick Start

typescript
1import { env } from "cloudflare:test"; 2import { describe, it, expect } from "vitest"; 3 4describe("MyDO", () => { 5 it("should work", async () => { 6 const stub = env.MY_DO.getByName("test"); 7 const result = await stub.addItem("test"); 8 expect(result).toBe(1); 9 }); 10});

Related Skills

Looking for an alternative to durable-objects or another official skill for your workflow? Explore these related open-source skills.

View All

flags

Logo of facebook
facebook

Use when you need to check feature flag states, compare channels, or debug why a feature behaves differently across release channels.

244.2k
0
Developer

extract-errors

Logo of facebook
facebook

extract-errors is a React error handling skill that automates the process of extracting and assigning error codes, ensuring accurate and up-to-date error messages in React applications.

244.2k
0
Developer

fix

Logo of facebook
facebook

fix is a code optimization skill that automates formatting and linting using yarn prettier and linc.

244.2k
0
Developer

flow

Logo of facebook
facebook

Use when you need to run Flow type checking, or when seeing Flow type errors in React code.

244.2k
0
Developer