All skills
cloudflare avatar

/durable-objects

@41e0d19 official
by cloudflarecloudflare/skills3k stars
298

Build, debug, or review Cloudflare Durable Objects code for persistent state and coordination.

Use this Skill: https://skilld.dev/gh/cloudflare/skills/durable-objects

This session only. Nothing lands on disk.

referencesrules.md

≈713 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Durable Objects Rules & Best Practices

Choose one object per entity that needs coordinated state. Keep essential data in durable storage; in-memory state must be reconstructible. Prefer SQLite for new classes, and inspect the backend of existing classes before selecting APIs. For idle WebSocket servers, prefer hibernation and plan for state restoration.

Fetch the relevant current documentation before implementing or reviewing changes.

Task Documentation
Choose object boundaries, deterministic routing, parent-child relationships, or initialization Rules of Durable Objects
Choose SQLite or maintain an existing KV-backed class SQLite storage API; Legacy KV storage API
Review storage gates, external I/O races, transactions, or schema initialization Rules of Durable Objects; SQLite storage API; Durable Object State
Configure class lifecycle changes Class exports; Legacy class migrations
Set placement hints or jurisdiction constraints Data location
Create stubs, invoke RPC, or use HTTP handlers Invoke methods; Namespace API
Schedule per-object work and handle retries Alarms
Restore WebSocket connection state after hibernation Use WebSockets
Handle exceptions, restarts, and shutdowns Error handling; Object lifecycle

For verification, use Testing Durable Objects. Keep API signatures, configuration, limits, and implementation examples in the linked docs.

Source: SKILL.md on GitHub

No alerts8d5 checks · Risk SAFE
  • Gen Agent Trust Hub8d

    This skill provides comprehensive guidance for building and debugging Cloudflare Durable Objects. It includes standard coding patterns, configuration examples, and references to official documentation. A minor security consideration is the inherent risk of indirect prompt injection when processing user-provided code for review, which is typical for development-focused skills.

  • Socket8d

    No alerts

  • Snyk8d

    Risk: LOW · No issues

  • Runlayer7mo

    4 files scanned · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 41e0d19. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 hours ago.

Activeupdated 6 hours ago
  • TypeScript
  • cloudflare
  • durable-objects
  • workers
  • stateful
  • coordination
  • websockets
  • sqlite
  • vitest
  • wrangler

README badge

README badge for cloudflare/skills/durable-objects

Creates and reviews Cloudflare Durable Objects for stateful edge applications, covering RPC methods, SQLite storage, alarms, and WebSocket handlers. Use for building coordination systems like chat rooms, multiplayer games, and booking systems, plus Vitest testing and wrangler configuration.

Generated from the current SKILL.md.

Does this skill work with plain Workers or only Durable Objects?
This skill targets Durable Objects specifically. For stateless request handling, use plain Workers instead.
What storage backends does this cover?
The skill covers SQLite (recommended and synchronous) and KV storage (async). SQLite is the primary focus for Durable Objects.
Can I use this skill to test Durable Objects with Vitest?
Yes. The skill includes Vitest setup and testing patterns using `@cloudflare/vitest-pool-workers`, with examples for unit and integration tests including alarm testing.
Does this skill prioritize Cloudflare's official documentation?
Yes. The skill biases towards retrieving from Cloudflare's official docs over pre-trained knowledge for any Durable Objects task.

Generated from the current SKILL.md. These answers refresh after source changes.