cloudflare-durable-objects▌
jezweb/claude-skills · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Stateful Durable Objects for real-time apps, coordination, and persistent state management.
- ›SQLite-backed storage with 10GB capacity, SQL queries, and atomic transactions; KV backend available for simpler key-value use cases
- ›WebSocket hibernation API supports thousands of concurrent connections with automatic wake-up; message size limit increased to 32 MiB (Oct 2025)
- ›Alarms API for scheduling future tasks, batching, and cleanup without relying on setTimeout / setInterval
- ›RPC metho
Cloudflare Durable Objects
Status: Production Ready ✅ Last Updated: 2026-01-21 Dependencies: cloudflare-worker-base (recommended) Latest Versions: [email protected], @cloudflare/[email protected] Official Docs: https://developers.cloudflare.com/durable-objects/
Recent Updates (2025):
- Oct 2025: WebSocket message size 1 MiB → 32 MiB, Data Studio UI for SQLite DOs (view/edit storage in dashboard)
- Aug 2025:
getByName()API shortcut for named DOs - June 2025: @cloudflare/actors library (beta) - recommended SDK with migrations, alarms, Actor class pattern. Note: Beta stability - see active issues before production use (RPC serialization, vitest integration, memory management)
- May 2025: Python Workers support for Durable Objects
- April 2025: SQLite GA with 10GB storage (beta → GA, 1GB → 10GB), Free tier access
- Feb 2025: PRAGMA optimize support, improved error diagnostics with reference IDs
Quick Start
Scaffold new DO project:
npm create cloudflare@latest my-durable-app -- --template=cloudflare/durable-objects-template --ts
Or add to existing Worker:
// src/counter.ts - Durable Object class
import { DurableObject } from 'cloudflare:workers';
export class Counter extends DurableObject {
async increment(): Promise<number> {
let value = (await this.ctx.storage.get<number>('value')) || 0;
await this.ctx.storage.put('value', ++value);
return value;
}
}
export default Counter; // CRITICAL: Export required
// wrangler.jsonc - Configuration
{
"durable_objects": {
"bindings": [{ "name": "COUNTER", "class_name": "Counter" }]
},
"migrations": [
{ "tag": "v1", "new_sqlite_classes": ["Counter"] } // SQLite backend (10GB limit)
]
}
// src/index.ts - Worker
import { Counter } from './counter';
export { Counter };
export default {
async fetch(request: Request, env: { COUNTER: DurableObjectNamespace<Counter> }) {
const stub = env.COUNTER.getByName('global-counter'); // Aug 2025: getByName() shortcut
return new Response(`Count: ${await stub.increment()}`);
}
};
DO Class Essentials
import { DurableObject } from 'cloudflare:workers';
export class MyDO extends DurableObject {
constructor(ctx: DurableObjectState, env: Env) {
super(ctx, env); // REQUIRED first line
// Load state before requests (optional)
ctx.blockConcurrencyWhile(async () => {
this.value = await ctx.storage.get('key') || defaultValue;
});
}
// RPC methods (recommended)
async myMethod(): Promise<string> { return 'Hello'; }
// HTTP fetch handler (optional)
async fetch(request: Request): Promise<Response> { return new Response('OK'); }
}
export default MyDO; // CRITICAL: Export required
// Worker must export DO class too
import { MyDO } from './my-do';
export { MyDO };
Constructor Rules:
- ✅ Call
super(ctx, env)first - ✅ Keep minimal - heavy work blocks hibernation wake
- ✅ Use
ctx.blockConcurrencyWhile()for storage initialization - ❌ Never
setTimeout/setInterval(use alarms) - ❌ Don't rely on in-memory state with WebSockets (persist to storage)
Storage API
Two backends available:
- SQLite (recommended): 10GB storage, SQL queries, atomic operations, PITR
- KV: 128MB storage, key-value only
Enable SQLite in migrations:
{ "migrations": [{ "tag": "v1", "new_sqlite_classes": ["MyDO"] }] }
SQL API (SQLite backend)
export class MyDO extends DurableObject {
sql: SqlStorage;
constructor(ctx: DurableObjectState, env: Env) {
super(ctx, env);
this.sql = ctx.storage.sql;
this.sql.exec(`
CREATE TABLE IF NOT EXISTS messages (id INTEGER PRIMARY KEY, text TEXT, created_at INTEGER);
CREATE INDEX IF NOT EXISTS idx_created ON messages(created_at);
PRAGMA optimize; // Feb 2025: Query performance optimization
`);
}
async addMessage(text: string): Promise<number> {
const cursor = this.sql.exec('INSERT INTO messages (text, created_at) VALUES (?, ?) RETURNING id', text, Date.now());
return cursor.one<{ id: number }>().id;
}
async getMessages(limit = 50): Promise<any[]> {
return this.sql.exec('SELECT * FROM messages ORDER BY created_at DESC LIMIT ?', limit).toArray();
}
}
SQL Methods:
sql.exec(query, ...params)→ cursorcursor.one<T>()→ single row (throws if none)cursor.one<T>({ allowNone: true })→ row or nullcursor.toArray<T>()→ all rowsctx.storage.transactionSync(() => { ... })→ atomic multi-statement
Best Practices:
- ✅ Use
?placeholders for parameterized queries - ✅ Create indexes on frequently queried columns
- ✅ Use
PRAGMA optimizeafter schema changes - ✅ Add
STRICTkeyword to table definitions to enforce type affinity and catch type mismatches early - ✅ Convert booleans to integers (0/1) - booleans bind as strings "true"/"false" in SQLite backend
Key-Value API (both backends)
// Single operations
await this.ctx.storage.put('key', value);
const value = await this.ctx.storage.get<T>('key');
await this.ctx.storage.delete('key');
How to use cloudflare-durable-objects on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add cloudflare-durable-objects
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches cloudflare-durable-objects from GitHub repository jezweb/claude-skills and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate cloudflare-durable-objects. Access the skill through slash commands (e.g., /cloudflare-durable-objects) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
Task Automation & Efficiency
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Knowledge Enhancement
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Quality Improvement
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Installation Steps
- 1.Install skill using provided installation command
- 2.Test with simple use case relevant to your work
- 3.Evaluate output quality and relevance
- 4.Iterate on prompts to improve results
- 5.Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices▌
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This▌
✓ Use When
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid When
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path▌
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.8★★★★★56 reviews- ★★★★★Luis Gupta· Dec 28, 2024
We added cloudflare-durable-objects from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Soo Ramirez· Dec 12, 2024
cloudflare-durable-objects fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Lucas Martinez· Dec 12, 2024
cloudflare-durable-objects fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Pratham Ware· Dec 4, 2024
cloudflare-durable-objects has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Arjun Huang· Nov 19, 2024
cloudflare-durable-objects fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Soo Abbas· Nov 3, 2024
We added cloudflare-durable-objects from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Lucas Singh· Nov 3, 2024
We added cloudflare-durable-objects from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Omar Mensah· Oct 22, 2024
Solid pick for teams standardizing on skills: cloudflare-durable-objects is focused, and the summary matches what you get after install.
- ★★★★★Ren Jain· Oct 22, 2024
Solid pick for teams standardizing on skills: cloudflare-durable-objects is focused, and the summary matches what you get after install.
- ★★★★★Arjun Reddy· Oct 10, 2024
Registry listing for cloudflare-durable-objects matched our evaluation — installs cleanly and behaves as described in the markdown.
showing 1-10 of 56