Agent skill

Durable Objects

by hodgef in hodgef/apiker

Create and review Cloudflare Durable Objects. An agent skill from hodgef/apiker.

MITAuto-check passedBackend & APIs

Install Durable Objects

skills CLI
$ npx skills add hodgef/apiker --skill durable-objects -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install hodgef/apiker durable-objects --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/hodgef/apiker.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/durable-objects .claude/skills/durable-objects && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
durable-objects
GitHub stars
127
Used in
4 other repos
Token cost
~1.5k tokens
SKILL.md length
318 words
Files
4 (incl. references)
Skills in repo
11
Repo updated
First seen
Licence
MIT

At a glance

Create and review Cloudflare Durable Objects. An agent skill from hodgef/apiker.

  • Works in 7 steps: Model around coordination atoms - One DO… → Use getByName() for deterministic… → Use SQLite storage - Configure… → …
  • Building stateful coordination (chat rooms
  • SKILL.md covers Retrieval Sources, When to Use, Reference Documentation and Core Principles, plus 7 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Durable Objects is an agent skill from hodgef/apiker. 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.

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/rules.md`, `references/testing.md` and `references/workers.md`).

It sits in Backend & APIs, covering Realtime and WebSockets and Unit testing. It works with Cloudflare Durable Objects, Cloudflare Workers, Cloudflare and SQLite. The repository describes itself as: 🔼 Create Serverless APIs with Cloudflare Workers, Durable Objects & Wrangler. The licence is MIT.

When your agent uses it

  • Building stateful coordination (chat rooms
  • Multiplayer games
  • Booking systems)
  • Implementing RPC methods

Example prompts

  • “/durable-objects”

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  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

What it can do on your machine

Read from SKILL.md and the folder at commit 444ace2. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript and jsonc).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • developers.cloudflare.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Durable Objects loads about 1.5k tokens when it runs, and up to ~7.1k if it reads all its reference files. Until then it costs about 100 tokens; SKILL.md has 318 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~100
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~7.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from hodgef/apiker at commit 444ace2, republished under its MIT licence (© hodgef). 318 words, ~1,467 tokens.

Download SKILL.mdSave it as .claude/skills/durable-objects/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
durable-objects
description
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.

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.

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
// wrangler.jsonc
{
  "durable_objects": {
    "bindings": [{ "name": "MY_DO", "class_name": "MyDurableObject" }]
  },
  "migrations": [{ "tag": "v1", "new_sqlite_classes": ["MyDurableObject"] }]
}
Basic Durable Object Pattern
typescript
import { DurableObject } from "cloudflare:workers";

export interface Env {
  MY_DO: DurableObjectNamespace<MyDurableObject>;
}

export class MyDurableObject extends DurableObject<Env> {
  constructor(ctx: DurableObjectState, env: Env) {
    super(ctx, env);
    ctx.blockConcurrencyWhile(async () => {
      this.ctx.storage.sql.exec(`
        CREATE TABLE IF NOT EXISTS items (
          id INTEGER PRIMARY KEY AUTOINCREMENT,
          data TEXT NOT NULL
        )
      `);
    });
  }

  async addItem(data: string): Promise<number> {
    const result = this.ctx.storage.sql.exec<{ id: number }>(
      "INSERT INTO items (data) VALUES (?) RETURNING id",
      data
    );
    return result.one().id;
  }
}

export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    const stub = env.MY_DO.getByName("my-instance");
    const id = await stub.addItem("hello");
    return Response.json({ id });
  },
};

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
// Deterministic - preferred for most cases
const stub = env.MY_DO.getByName("room-123");

// From existing ID string
const id = env.MY_DO.idFromString(storedIdString);
const stub = env.MY_DO.get(id);

// New unique ID - store mapping externally
const id = env.MY_DO.newUniqueId();
const stub = env.MY_DO.get(id);

Storage Operations

typescript
// SQL (synchronous, recommended)
this.ctx.storage.sql.exec("INSERT INTO t (c) VALUES (?)", value);
const rows = this.ctx.storage.sql.exec<Row>("SELECT * FROM t").toArray();

// KV (async)
await this.ctx.storage.put("key", value);
const val = await this.ctx.storage.get<Type>("key");

Alarms

typescript
// Schedule (replaces existing)
await this.ctx.storage.setAlarm(Date.now() + 60_000);

// Handler
async alarm(): Promise<void> {
  // Process scheduled work
  // Optionally reschedule: await this.ctx.storage.setAlarm(...)
}

// Cancel
await this.ctx.storage.deleteAlarm();

Testing Quick Start

typescript
import { env } from "cloudflare:test";
import { describe, it, expect } from "vitest";

describe("MyDO", () => {
  it("should work", async () => {
    const stub = env.MY_DO.getByName("test");
    const result = await stub.addItem("test");
    expect(result).toBe(1);
  });
});

© hodgef, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in .agents/skills/durable-objects of hodgef/apiker.

  • SKILL.md
  • references/rules.md
  • references/testing.md
  • references/workers.md

Open the folder on GitHubat commit 444ace2

Used in 4 other repositories

We found 4 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 4 other GitHub owners. This page covers the copy in hodgef/apiker, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Durable Objects next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Durable Objects compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Durable Objects this skillhodgef/apiker1274 repos~1.5kAutomated safety check: PassMIT
Cloudflare WorkersEpicenterHQ/epicenter4.8k—~576Automated safety check: PassCustom licence
Writing Unit TestsAsvarox/allkaraoke261—~358Automated safety check: PassNone
Cloudflare Workers Testingsecondsky/claude-skills227—~5.3kAutomated safety check: PassMIT
Debug DashboardBlackBeltTechnology/pi-agent-dashboard316—~1.6kAutomated safety check: PassMIT
Durable Objectscloudflare/skills3k2 repos~1.5kAutomated safety check: PassApache-2.0

Similar skills

  • Cloudflare Workers

    EpicenterHQ/epicenter

    Cloudflare Workers patterns for Worker runtime APIs, Durable Objects, KV, R2, D1, Queues, WebSockets, streaming responses, bindings, wrangler configuration, and deployment limits.

    4.8k GitHub stars~576 tokensUpdated today
    Backend & APIsAuto-check passed
  • Writing Unit Tests

    Asvarox/allkaraoke

    A skill your agent uses when Codex updates, fixes, or adds unit tests in this project.

    261 GitHub stars~358 tokensUpdated today
    Testing & QAAuto-check passed
  • Cloudflare Workers Testing

    secondsky/claude-skills

    Comprehensive testing guide for Cloudflare Workers using Vitest and @cloudflare/vitest-pool-workers.

    227 GitHub stars~5.3k tokensUpdated 9 days ago
    Testing & QAAuto-check passed
  • Debug Dashboard

    BlackBeltTechnology/pi-agent-dashboard

    Diagnose problems in the running pi-agent-dashboard system: server.log, /api/health, bridge WebSocket connectivity, vitest triage, known-issue FAQ entries.

    316 GitHub stars~1.6k tokensUpdated today
    Backend & APIsAuto-check passed
  • Durable Objects

    cloudflare/skills

    Official

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

    3k GitHub starsUsed in 2 repos~1.5k tokens
    Backend & APIsAuto-check passed
  • Sharehtml Collaboration

    jonesphillip/sharehtml

    A skill your agent uses when a user wants to deploy, update, diff, pull, or review feedback on documents managed with the sharehtml CLI.

    132 GitHub stars~902 tokensUpdated 6 mo ago
    Backend & APIsAuto-check passed

More from hodgef/apiker

All 11 skills in this repo
  • Cloudflare

    hodgef/apiker

    Comprehensive Cloudflare platform skill covering Workers, Pages, storage (KV, D1, R2), AI (Workers AI, Vectorize, Agents SDK), feature flags (Flagship), networking (Tunnel, Spectrum), security (WAF…

    127 GitHub starsUsed in 7 repos~2.2k tokens
    Auto-check passed
  • Send and receive transactional emails with Cloudflare Email Service (Email Sending + Email Routing).

    127 GitHub starsUsed in 3 repos~2k tokens
    Auto-check passed
  • Web Perf

    hodgef/apiker

    Analyzes web performance using Chrome DevTools MCP. An agent skill from hodgef/apiker.

    127 GitHub starsUsed in 5 repos~2k tokens
    Auto-check passed
  • Reviews and authors Cloudflare Workers code against production best practices.

    127 GitHub starsUsed in 6 repos~1.8k tokens
    Auto-check passed
  • Apiker

    hodgef/apiker

    Develop, review, and extend the Apiker library — a framework for building serverless REST APIs on Cloudflare Workers + Durable Objects.

    127 GitHub stars~1.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Agents SDK

    hodgef/apiker

    Build AI agents on Cloudflare Workers using the Agents SDK. An agent skill from hodgef/apiker.

    127 GitHub starsUsed in 3 repos~3k tokens
    Auto-check passed

Questions about Durable Objects

What does Durable Objects do?

Create and review Cloudflare Durable Objects. An agent skill from hodgef/apiker. Durable Objects is an agent skill from hodgef/apiker. Create and review Cloudflare Durable Objects.

When should I use Durable Objects?

Durable Objects fits situations like: building stateful coordination (chat rooms; multiplayer games; booking systems); implementing RPC methods.

How do I install Durable Objects in Claude Code?

Run `npx skills add hodgef/apiker --skill durable-objects -a claude-code`. Or copy the skill folder (.agents/skills/durable-objects in hodgef/apiker) into .claude/skills/durable-objects in your project. Claude Code loads it when a task matches its description.

How do I install Durable Objects in Codex?

Run `npx skills add hodgef/apiker --skill durable-objects -a codex`. Or copy the skill folder (.agents/skills/durable-objects in hodgef/apiker) into .agents/skills/durable-objects in your project. Codex loads it when a task matches its description.

Can I use Durable Objects in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add hodgef/apiker --skill durable-objects -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/durable-objects, .gemini/skills/durable-objects, .github/skills/durable-objects and .opencode/skills/durable-objects in your project.

What does Durable Objects need to run?

SKILL.md names no scripts, command-line tools or credentials: Durable Objects is instructions for the agent only.

Does Durable Objects access the network?

SKILL.md names 1 domain. As links in the text: developers.cloudflare.com. This is read from the text; nothing was executed.

Is Durable Objects safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Durable Objects use?

Durable Objects is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Durable Objects use?

About 1.5k tokens (SKILL.md is roughly 5.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 5.6k tokens, read only when the agent opens those files.

What are the alternatives to Durable Objects?

Skills that share tags, products or a category with Durable Objects: Cloudflare Workers (EpicenterHQ/epicenter, 4.8k stars), Writing Unit Tests (Asvarox/allkaraoke, 261 stars), Cloudflare Workers Testing (secondsky/claude-skills, 227 stars) and Debug Dashboard (BlackBeltTechnology/pi-agent-dashboard, 316 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Durable Objects?

hodgef (a GitHub user) maintains it in hodgef/apiker, which has 127 GitHub stars. The repository holds 11 skills in this directory. The repository was last updated on August 20, 2026.

Source: hodgef/apiker on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.