.fyi
SkillsMCPPluginsSubagents

Browse by category

DevOps & CI/CD SkillsProductivity & Workflow SkillsOther SkillsProduct & Project Management SkillsDocumentation & Knowledge SkillsCode Review & Refactor SkillsBackend & APIs SkillsAgent Meta & Communication SkillsResearch SkillsSecurity SkillsUX UI & Design SkillsTesting & QA SkillsSee all →

Every Claude Code skill, MCP server, plugin and subagent in one directory. Searchable, comparable, and one command from installed. Live stats from GitHub, npm and PyPI.

We're on Product HuntYour agent's app storeCheck it out →
Agent SkillsMCP ServersPluginsSubagentsCoding Agents
CollectionsOfficial publishersGlossaryFAQBlogSearchSavedFeedback
PrivacyTermsllms.txtSitemap

made with ♥ · © 2026 aaaa.fyi

Independent project · real data from public registries

…/skills/durable-objects
home/skills/cloudflare/skills/durable-objects
cloudflare avatar

durable-objects

bycloudflare· 64 skills

Installs

30k

Stars

2.5k

Forks

232

Category

Cloud & Infrastructure

View on GitHub

TL;DR

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 to install durable-objects?

cloudflare/skills/durable-objects
$npx -y skills add cloudflare/skills --skill durable-objects

Installs into the current project.

›Prefer a prompt? Paste this to your agent

Use this skill

Run `npx skills use "https://github.com/cloudflare/skills" --skill "cloudflare/skills/durable-objects"` and follow the generated skill instructions now. Read its complete output, redirecting it to a temporary file first if necessary. Resolve relative paths from the supporting-files directory it provides.

Use the whole pack

Use the skills in "https://github.com/cloudflare/skills" that are relevant to the current task. Run `npx skills add "https://github.com/cloudflare/skills"` and select the relevant skills, then follow their instructions.

Files · 1

View on GitHub
SKILL.md
1# Durable Objects
2 
3Build stateful, coordinated applications on Cloudflare's edge using Durable Objects.
4 
5## Retrieval Sources
6 
7Your knowledge of Durable Objects APIs and configuration may be outdated. **Prefer retrieval over pre-training** for any Durable Objects task.
8 
9| Resource | URL |
10|----------|-----|
11| Docs | https://developers.cloudflare.com/durable-objects/ |
12| API Reference | https://developers.cloudflare.com/durable-objects/api/ |
13| Best Practices | https://developers.cloudflare.com/durable-objects/best-practices/ |
14| Examples | https://developers.cloudflare.com/durable-objects/examples/ |
15 
16Fetch the relevant doc page when implementing features.
17 
18## When to Use
19 
20- Creating new Durable Object classes for stateful coordination
21- Implementing RPC methods, alarms, or WebSocket handlers
22- Reviewing existing DO code for best practices
23- Configuring wrangler.jsonc/toml for DO bindings and migrations
24- Writing tests with `@cloudflare/vitest-pool-workers`
25- Designing sharding strategies and parent-child relationships
26 
27## Reference Documentation
28 
29- `./references/rules.md` - Core rules, storage, concurrency, RPC, alarms
30- `./references/testing.md` - Vitest setup, unit/integration tests, alarm testing
31- `./references/workers.md` - Workers handlers, types, wrangler config, observability
32 
33Search: `blockConcurrencyWhile`, `idFromName`, `getByName`, `setAlarm`, `sql.exec`
34 
35## Core Principles
36 
37### Use Durable Objects For
38 
39| Need | Example |
40|------|---------|
41| Coordination | Chat rooms, multiplayer games, collaborative docs |
42| Strong consistency | Inventory, booking systems, turn-based games |
43| Per-entity storage | Multi-tenant SaaS, per-user data |
44| Persistent connections | WebSockets, real-time notifications |
45| Scheduled work per entity | Subscription renewals, game timeouts |
46 
47### Do NOT Use For
48 
49- Stateless request handling (use plain Workers)
50- Maximum global distribution needs
51- High fan-out independent requests
52 
53## Quick Reference
54 
55### Wrangler Configuration
56 
57```jsonc
58// wrangler.jsonc
59{
60 "durable_objects": {
61 "bindings": [{ "name": "MY_DO", "class_name": "MyDurableObject" }]
62 },
63 "migrations": [{ "tag": "v1", "new_sqlite_classes": ["MyDurableObject"] }]
64}
65```
66 
67### Basic Durable Object Pattern
68 
69```typescript
70import { DurableObject } from "cloudflare:workers";
71 
72export interface Env {
73 MY_DO: DurableObjectNamespace<MyDurableObject>;
74}
75 
76export class MyDurableObject extends DurableObject<Env> {
77 constructor(ctx: DurableObjectState, env: Env) {
78 super(ctx, env);
79 ctx.blockConcurrencyWhile(async () => {
80 this.ctx.storage.sql.exec(`
81 CREATE TABLE IF NOT EXISTS items (
82 id INTEGER PRIMARY KEY AUTOINCREMENT,
83 data TEXT NOT NULL
84 )
85 `);
86 });
87 }
88 
89 async addItem(data: string): Promise<number> {
90 const result = this.ctx.storage.sql.exec<{ id: number }>(
91 "INSERT INTO items (data) VALUES (?) RETURNING id",
92 data
93 );
94 return result.one().id;
95 }
96}
97 
98export default {
99 async fetch(request: Request, env: Env): Promise<Response> {
100 const stub = env.MY_DO.getByName("my-instance");
101 const id = await stub.addItem("hello");
102 return Response.json({ id });
103 },
104};
105```
106 
107## Critical Rules
108 
1091. **Model around coordination atoms** - One DO per chat room/game/user, not one global DO
1102. **Use `getByName()` for deterministic routing** - Same input = same DO instance
1113. **Use SQLite storage** - Configure `new_sqlite_classes` in migrations
1124. **Initialize in constructor** - Use `blockConcurrencyWhile()` for schema setup only
1135. **Use RPC methods** - Not fetch() handler (compatibility date >= 2024-04-03)
1146. **Persist first, cache second** - Always write to storage before updating in-memory state
1157. **One alarm per DO** - `setAlarm()` replaces any existing alarm
116 
117## Anti-Patterns (NEVER)
118 
119- Single global DO handling all requests (bottleneck)
120- Using `blockConcurrencyWhile()` on every request (kills throughput)
121- Storing critical state only in memory (lost on eviction/crash)
122- Using `await` between related storage writes (breaks atomicity)
123- Holding `blockConcurrencyWhile()` across `fetch()` or external I/O
124 
125## Stub Creation
126 
127```typescript
128// Deterministic - preferred for most cases
129const stub = env.MY_DO.getByName("room-123");
130 
131// From existing ID string
132const id = env.MY_DO.idFromString(storedIdString);
133const stub = env.MY_DO.get(id);
134 
135// New unique ID - store mapping externally
136const id = env.MY_DO.newUniqueId();
137const stub = env.MY_DO.get(id);
138```
139 
140## Storage Operations
141 
142```typescript
143// SQL (synchronous, recommended)
144this.ctx.storage.sql.exec("INSERT INTO t (c) VALUES (?)", value);
145const rows = this.ctx.storage.sql.exec<Row>("SELECT * FROM t").toArray();
146 
147// KV (async)
148await this.ctx.storage.put("key", value);
149const val = await this.ctx.storage.get<Type>("key");
150```
151 
152## Alarms
153 
154```typescript
155// Schedule (replaces existing)
156await this.ctx.storage.setAlarm(Date.now() + 60_000);
157 
158// Handler
159async alarm(): Promise<void> {
160 // Process scheduled work
161 // Optionally reschedule: await this.ctx.storage.setAlarm(...)
162}
163 
164// Cancel
165await this.ctx.storage.deleteAlarm();
166```
167 
168## Testing Quick Start
169 
170```typescript
171import { env } from "cloudflare:test";
172import { describe, it, expect } from "vitest";
173 
174describe("MyDO", () => {
175 it("should work", async () => {
176 const stub = env.MY_DO.getByName("test");
177 const result = await stub.addItem("test");
178 expect(result).toBe(1);
179 });
180});
181```

Security

Passed

  • Gen Agent Trust Hubpass
  • Socketpass
  • Snykpass
  • Runlayerpass
  • ZeroLeakspass

Preview

cloudflare/skillscloudflare/skills

$ npx -y skills add cloudflare/skills --skill durable-objects

▸ installing to .claude/skills…

✓ durable-objects ready

Repocloudflare/skills
TypeSkills
CategoryCloud & Infrastructure
ForDeveloperArchitect
UpdatedJul 2026
License—
First seenJul 26, 2026

Tags

Skill

Related

6 picks
Type
  1. microsoft avatarazure-storageAzure Storage Services including Blob Storage, File Shares, Queue Storage, Table Storage, and Data Lake.SkillsJul 2026484k1.3k
  2. microsoft avatarazure-resource-lookupList, find, and show Azure resources across subscriptions or resource groups.SkillsJul 2026484k1.3k
  3. microsoft avatarazure-resource-visualizerAnalyze Azure resource groups and generate detailed Mermaid architecture diagrams showing the relationships between individual resources.SkillsJul 2026483k1.3k
  4. microsoft avatarazure-computeAzure VM/VMSS router. WHEN: create / provision / deploy / spin-up VM, recommend VM size, compare VM pricing, VMSS, scale set, autoscale, burstable, lightweight…SkillsJul 2026428k1.3k
  5. microsoft avatarazure-quotasCheck/manage Azure quotas and usage across providers. For deployment planning, capacity validation, region selection.SkillsJul 2026354k1.3k
  6. microsoft avatarazure-upgradeAssess and upgrade Azure workloads between plans, tiers, or SKUs, or modernize Azure SDK dependencies in source code.SkillsJul 2026346k1.3k