2nth-ai/skills/durable-objects
Claude Code and agent skill by 2nth-ai/skills
- community
Checking that the SKILL.md file is still in the repository.
Cloudflare Durable Objects — stateful edge compute. Use this skill when: (1) building real-time collaborative features requiring WebSocket connections, (2) implementing atomic counters, locks, or compare-and-swap operations, (3) managing per-user or per-session state that persists across requests, (4) coordinating multi-agent pipelines without polling (event-driven), (5) building chat rooms, live dashboards, or streaming AI sessions, (6) replacing sequential Worker calls with event-driven state machines. Requires Workers Paid plan ($5/mo).
Install
npx vskill@latest install 2nth-ai/skills/durable-objectsSKILL.md
The same SKILL.md was published earlier as 2nth-ai/skills/durable-objects.
Cloudflare Durable Objects
Durable Objects (DOs) are single-instance, globally-unique JavaScript objects with persistent storage and a co-located execution environment. Unlike Workers (which are stateless isolates), each DO instance:
- Has a unique ID — all requests to the same ID go to the same instance
- Has private storage — a transactional key-value store via
this.ctx.storage - Can hold WebSocket connections open
- Runs in a single location (no global distribution — single-threaded execution prevents races)
Requires Workers Paid plan.
wrangler.toml
Durable Object class
Getting a DO stub from a Worker
Persistent storage (transactional KV)
Streaming AI output via DO + WebSocket
Alarms (scheduled tasks within a DO)
Common Gotchas
- Paid plan required: DOs are not available on the free tier.
- Single location: A DO instance runs in one Cloudflare region. Requests are routed there — no global distribution. Don't use DOs for purely read-heavy workloads.
- Migration required: Adding a new DO class requires a
[[migrations]]entry in wrangler.toml. Missing this causes a deploy error. - `ctx.acceptWebSocket()` vs `new WebSocketPair()`: Use
ctx.acceptWebSocket()for hibernating WebSockets (cheaper) — the DO can sleep and wake on message receipt. - Storage is eventually consistent outside transactions: Use
storage.transaction()for atomic multi-key operations. - No shared state between DO classes: Each DO class is independent. Use service bindings or KV to pass data between them.
When to use DOs vs alternatives
| Need | Use | |
|---|---|---|
| Real-time collaboration (WebSockets) | Durable Objects | |
| Atomic counter / rate limiter | Durable Objects | |
| Async background jobs | Queues | |
| Shared config/flags | KV | |
| Per-user session data | KV (with TTL) | |
| Structured data + SQL queries | D1 |
See Also
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingtech/cloudflare/durable-objects/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/2nth-ai/skills/durable-objects)