codewhale-hq/codewhale-plugin-marketplace/cloudflare-durable-objects
- community
Checking that the SKILL.md file is still in the repository.
Design and write Cloudflare Durable Objects. SQLite storage, RPC methods, WebSocket hibernation, alarms, class lifecycle (exports or migrations), and testing. Use for stateful coordination, rooms, per-user state, counters, rate limiters.
Install
npx vskill@latest install codewhale-hq/codewhale-plugin-marketplace/cloudflare-durable-objectsSKILL.md
Cloudflare Durable Objects
A Durable Object is a class whose named instances each run in one place with their own storage. Use one object per coordination unit (a chat room, a document, a user, a game): that unit is the "atom". A single global object is a bottleneck and almost always the wrong design.
Check current syntax with the cloudflare-docs plugin or https://developers.cloudflare.com/durable-objects/ before relying on memory; class lifecycle configuration changed recently (see below).
Minimal SQLite-backed object with RPC
Binding and SQLite lifecycle are declared together in typed config:
Review cf migrate --dry-run for legacy configurations and preserve the existing class identity, storage and imperative migration history. Never mix an existing migrations lifecycle with a new exports lifecycle. Use SQLite for new namespaces; do not claim a deployed key-value class can be switched to it. Check current cf/config helpers and generated lifecycle output against the configuration reference. Do not infer correctness solely from a successful dry run: an ignored lifecycle entry can pass packaging and still deploy the wrong storage.
Lifecycle changes are dangerous
Defining a class locally is safe. Renaming, deleting or transferring a class is a data-affecting operation:
- It is atomic: it cannot be uploaded as a version or deployed gradually, and
you cannot roll back past it. After approval, deploy it alone with cf deploy.
- Deleting a class deletes its stored data. Renaming without a rename entry
orphans data.
- Always show the diff of the
exports/migrationsblock to the user, name
the class and say whether data is lost, and wait for approval, as described in cloudflare-deploy.
WebSockets: use hibernation
- Do not use
addEventListenerfor server-side sockets in a Durable Object. - Memory is lost on hibernation. Anything needed after wake-up goes in storage or
serializeAttachment.
- A pending
setTimeout/setIntervalor an outbound WebSocket keeps the object
awake and billing; use alarms instead.
Alarms
Alarms do not repeat on their own, and each object has one pending alarm. Only schedule one when there is work to do; waking many objects every few seconds is expensive.
Rules of thumb
- Methods on the object are RPC: arguments and results must be structured-
cloneable; throw errors you want the caller to see.
- Reads and writes inside one request are protected by input/output gates; use
blockConcurrencyWhile only for initialization.
- Derive the object name from something stable (
getByName(userId)), and
validate it; a user-supplied name creates an object.
- Test with
@cloudflare/vitest-pool-workers: call RPC methods on a stub and
trigger alarms with runDurableObjectAlarm(stub). Run cf dev to try it locally; state is simulated.
Checklist
- [ ] one object per logical unit, named deterministically
- [ ] SQLite storage; lifecycle entry present; one lifecycle style
- [ ] WebSockets use
acceptWebSocketand handler methods - [ ] no lifecycle change shipped without explicit approval
- [ ] local tests exercise the RPC methods and any alarm
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 repositoryCheckingplugins/cloudflare/skills/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/codewhale-hq/codewhale-plugin-marketplace/cloudflare-durable-objects)