Cloudflare Durable Objects for Openclaw

A high-performance AI coding assistant skill designed to build, optimize, and test stateful, coordinated applications using Cloudflare Durable Objects.

creativerezz
v1.0.0
Jun 11, 2026
0
450
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install durable-objects

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install durable-objects using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Cloudflare Durable Objects?

The Cloudflare Durable Objects skill is a highly specialized asset within the ecosystem of Openclaw Skills, enabling AI agents to design, build, and optimize stateful, coordinated serverless applications at the edge. Durable Objects provide a powerful framework for applications requiring strong consistency, real-time messaging, and per-entity storage, solving the challenges of stateless computing in modern cloud environments. By integrating this skill, AI developers can seamlessly orchestrate real-time collaborative spaces, game servers, multi-tenant architectures, and transactional booking systems.

This capability empowers agents to draft optimized TypeScript code using the latest Durable Objects APIs, configure Wrangler deployment settings, implement embedded SQLite databases, and write comprehensive Vitest tests. By utilizing Openclaw Skills to handle stateful edge logic, developers ensure their AI code-generation workflows produce production-ready, highly parallelizable edge services that strictly adhere to Cloudflare's performance and consistency standards.

Cloudflare Durable Objects Use Cases

  • Building real-time collaborative applications, multiplayer games, and chat rooms using WebSockets.
  • Designing systems that require strong consistency, such as inventory control, booking pipelines, and financial ledger items.
  • Implementing persistent per-entity storage for multi-tenant SaaS platforms or individual user profiles.
  • Creating scheduled background tasks and automated workflows per object using built-in alarms.
  • Refactoring older Cloudflare Workers codebases to leverage RPC-based communication.
  • Writing unit and integration tests for edge states with Vitest-based worker simulation pools.

How Cloudflare Durable Objects Works

  1. Agent Setup and Query Parsing: The developer requests stateful functionality from an AI agent utilizing Openclaw Skills.
  2. Context and Documentation Retrieval: The skill directs the agent to query the latest Cloudflare developer documentation, prioritizing current API references over pre-trained data.
  3. Wrangler Schema and Migration Definition: The agent generates or updates the wrangler.jsonc configuration file, registering the class bindings and executing SQLite database migrations.
  4. Durable Object Class Definition: The agent constructs a TypeScript class inheriting from DurableObject, applying blockConcurrencyWhile() in the constructor to safely initialize schema tables.
  5. RPC and Storage Implementation: Custom methods are implemented using RPC interfaces for seamless client-to-object calls, directly storing data in transactional SQLite or KV states.
  6. Testing and Verification: The agent writes unit and integration tests using @cloudflare/vitest-pool-workers to ensure correct object behaviors and alarm operations.

Cloudflare Durable Objects Setup

To implement Durable Objects in your development workspace using Openclaw Skills, follow these steps to configure your environment:

First, ensure your project contains a configured wrangler.jsonc or wrangler.toml file to bind the Durable Object and register migrations:

// wrangler.jsonc
{
  "durable_objects": {
    "bindings": [{ "name": "MY_DO", "class_name": "MyDurableObject" }]
  },
  "migrations": [{ "tag": "v1", "new_sqlite_classes": ["MyDurableObject"] }]
}

Install the required testing suite to validate state and transitions:

npm install --save-dev @cloudflare/vitest-pool-workers vitest

Configure your AI coding assistant to leverage the Openclaw Skills ruleset by pointing the agent to look up specific documentation endpoints at runtime.

Cloudflare Durable Objects Data Schema & Taxonomy

This skill operates with a highly structured layout for data modeling, migrations, and test environments:

Component Description Default Storage Engine
Durable Object Class Stateful code instance with lifecycles and constructors. In-Memory & SQLite
Migrations Engine Tracks schema progression for the embedded SQLite databases. SQLite (new_sqlite_classes)
Wrangler Bindings Associates Worker environments with specific namespace objects. Cloudflare Config Schema
Vitest Pool Workers Test environment configurations for verifying mock interactions. Memory Isolation Pool

Ensure that all critical state persists directly to storage (this.ctx.storage.sql or this.ctx.storage.put) before updating in-memory values to prevent data loss upon worker evictions or system crashes.

Cloudflare Durable Objects Advanced Features

  • Deterministic Routing: Automatically routes identical user inputs or rooms to the exact same Durable Object instance utilizing env.MY_DO.getByName(name).
  • In-Memory SQLite Engine: Executes highly concurrent, synchronous SQL transactions using this.ctx.storage.sql.exec() without asynchronous waiting bottlenecks.
  • High-Performance Alarms: Schedules background workers with setAlarm(timestamp) to process asynchronous task queues, automatic evictions, or polling cycles.
  • Strict Concurrency Blockers: Protects initialization cycles using blockConcurrencyWhile() to ensure schemas and configurations deploy before requests are handled.
  • Native RPC Protocol Support: Avoids performance overhead by bypassing standard HTTP fetch() endpoints, replacing them with typed RPC methods for compatibility dates after 2024-04-03.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*