This is the skill you reach for when you need state that sticks around between requests and belongs to a specific key: a chat room, a leaderboard, a rate limiter, a long-running agent. Each instance gets its own in-memory state plus a transactional KV store, and you can attach WebSockets directly to it. The constraints are tight: one TypeScript file per class, no npm imports, PascalCase class names that map to kebab-case URLs. You deploy once and instances spin up on demand per ID. Works well for multiplayer rooms or per-user agents where you need guaranteed single-threaded execution and can't tolerate the cold-start shuffle of stateless functions. Just remember that cross-instance coordination is on you.

GitHub stars
532
last updated
Jun 11, 2026

Install

$ npx -y skills add butterbase-ai/butterbase-skills --skill durable-objects --agent claude-code

Installs into .claude/skills of the current project.

Files

Butterbase Durable Objects

Durable Objects (DOs) are stateful per-key actors running on Cloudflare Workers. Each instance has its own in-memory state and a built-in transactional KV store. Use one when state must survive across requests for a single room/user/agent. For stateless work, use a serverless function instead (butterbase-skills:function-dev).

One tool: manage_durable_objects.


1. The mental model

Class: ChatRoom (deployed once)
   │
   ├── instance "lobby"      ─►  in-memory state + state.storage  +  WebSockets
   ├── instance "general"    ─►  separate state, separate sockets
   └── instance "user-123"   ─►  separate again

Each URL  https://<app>.butterbase.dev/_do/chat-room/<instance-id>
gets routed to the instance with that id. State is isolated per id.

A class is shared code; an instance is a unique key (/lobby, /general, /user-123). Different ids = different state. There is no shared cross-instance state.


2. Constraints (read these first)

Sponsors

Details

Repository
github.com/butterbase-ai/butterbase-skills
License
MIT
First seen
Jun 11, 2026

More from butterbase-ai/butterbase-skills

All 39

Recommended

1juliusbrussee avatarcavemanjuliusbrussee/cavemanUltra-compressed communication mode. Cuts output tokens 65% (measured) by speaking like caveman while keeping full technical accuracy. Supports intensity levels618.3Kskills.sh installs
2mattpocock avatargrill-memattpocock/skillsA relentless interview to sharpen a plan or design.1.5Mskills.sh installs
3shadcn avatarimproveshadcn/improveSurvey any codebase as a senior advisor and produce prioritized, self-contained implementation plans for OTHER models/agents to execute. Strictly read-only on s40Kskills.sh installs
4obra avatarsystematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes326.7Kskills.sh installs
5forrestchang avatarkarpathy-guidelinesforrestchang/andrej-karpathy-skillsBehavioral guidelines to reduce common LLM coding mistakes through explicit assumptions, simplicity, and verifiable success criteria.17.9Kskills.sh installs
6vercel-labs avatarfind-skillsvercel-labs/skillsHelps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express int4.3Mskills.sh installs