agentleFS
swyxioswyxio/skills/durable-objects/SKILL.md

durable-objects

Skill171 starsChanged 8 months agoMITView on GitHub

Design, implement, debug, or test Cloudflare Durable Objects when the task specifically involves per-key coordination, strongly consistent object-owned state, RPC or HTTP interfaces, alarms, WebSocket hibernation, bindings, or class lifecycle. Do not trigger for ordinary stateless Workers or Cloudflare Agents SDK work already owned by the `agents-sdk` skill.

18 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use sandbox-stable and playwright.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • CloudflareSkill

    sandbox-stable

    Build or maintain Cloudflare Sandbox apps on the stable @cloudflare/sandbox package. Use sandbox-next for preview apps and sandbox-migrate-to-next for stable-to-preview migrations.

    Also in 4 projects that use this

  • OpenAISkill

    playwright

    Use when the task requires automating a real browser from the terminal (navigation, form filling, snapshots, screenshots, data extraction, UI-flow debugging) via `playwright-cli` or the bundled wrapper script.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 18 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use Durable Objects when one named object should serialize access to its own state.

    line 8
  2. Very specific:

    Prefer typed RPC for new internal interfaces.

    line 26
  3. Distinctive:

    Keep state transitions deterministic.

    line 28
  4. Very specific:

    Use blockConcurrencyWhile() for bounded initialization, not routine requests or slow external work.

    line 30
  5. Distinctive:

    Verify the exact class export, binding target, lifecycle declaration, and live path touched by the change.

    line 36

“Common” is measured: kept by at least 6 in 10 of the 18 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Durable Objects

Use Durable Objects when one named object should serialize access to its own state. Retrieve current Cloudflare documentation for APIs, bindings, storage, class lifecycle, limits, and pricing.

Load only the relevant reference:

  • rules.md for partitioning, storage, concurrency, RPC, alarms, and WebSockets.
  • testing.md for Workers Vitest and alarm tests.
  • workers.md for bindings, lifecycle configuration, generated types, and observability.

Design contract

  1. Name the coordination key and deterministic object ID. Avoid a global object unless deliberate low-volume global serialization is the requirement.
  2. Identify object-owned persistent state. Treat caches and external stores as separate consistency boundaries.
  3. Prefer typed RPC for new internal interfaces; retain fetch() when HTTP semantics or a live compatibility contract requires it.
  4. Keep state transitions deterministic. External I/O can interleave, so fence, serialize, or reconcile the affected transition.
  5. Use blockConcurrencyWhile() for bounded initialization, not routine requests or slow external work.
  6. Remember that one object has one alarm. Persist progress, make the handler idempotent, and define bounded failure handling.
  7. Design for constructor reruns and eviction. In-memory state is not durable.

Verify the exact class export, binding target, lifecycle declaration, and live path touched by the change. Test only the relevant concurrency, restart, alarm, or WebSocket behavior.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.