cloudflare-durable-objects:patterns

cloudflare-durable-objects:patterns is a command for coding agents from secondsky/claude-skills. It costs 34 tokens per session (4,228 once invoked), scanned A, original, MIT.

An interactive guide for choosing a Cloudflare Durable Objects pattern and generating starter implementation code. Durable Objects are Cloudflare Workers components that keep state and coordinate activity for a particular object or group.

In plain words
What is it for?
Use it to design features such as chat rooms, collaborative editing, multiplayer games, rate limits, user sessions, distributed locks, counters, or consistent caching.
Why use it?
It helps turn a broad requirement into a suitable design and avoids starting with the wrong state-management pattern. It also includes guidance for testing and deployment.

Command

Part of the cloudflare-durable-objects plugin — 1 skill, 5 commands, 3 agents shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/secondsky/claude-skills/do-patterns
Clone the repo
git clone --depth 1 https://github.com/secondsky/claude-skills

Or install cloudflare-durable-objects, the plugin that ships this one along with the rest of its 1 skill, 5 commands, 3 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cloudflare-durable-objects:patterns

README.md
[![agentmods](https://agentmods.dev/badge/commands/secondsky/claude-skills/do-patterns.svg)](https://agentmods.dev/commands/secondsky/claude-skills/do-patterns)
Your own site
<a href="https://agentmods.dev/commands/secondsky/claude-skills/do-patterns"><img src="https://agentmods.dev/badge/commands/secondsky/claude-skills/do-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 34 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,228 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00034 $0.04228
Opus 5 $0.00017 $0.02114
Sonnet 5 $0.00007 $0.00846
Haiku 4.5 $0.00003 $0.00423

Measured yesterday against content hash 6528a10888d7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cloudflare-durable-objects:patterns scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

async fetch(request: Request): Promise<Response> {
plugins/cloudflare-durable-objects/commands/do-patterns.md · 705 lines

How it starts

The opening of the file, as written. The whole thing — 705 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/do-patterns - Pattern Selection Wizard

Interactive wizard to help select and implement the optimal Durable Objects pattern for your specific use case.

Overview

This command guides you through:

  1. Understanding your requirements
  2. Recommending appropriate DO patterns
  3. Generating pattern-specific implementation
  4. Providing testing and deployment guidance

Step 1: Understand Use Case

Use AskUserQuestion tool:

Question 1: Primary Use Case

header: "Use Case" question: "What is your primary use case for Durable Objects?" multiSelect: false options:

  • label: "Real-time communication (WebSocket)" description: "Chat rooms, collaborative editing, multiplayer games, live updates"
  • label: "State coordination" description: "Leader election, distributed locking, workflow orchestration"
  • label: "Per-user/per-entity state" description: "User sessions, shopping carts, user profiles, device state"
  • label: "Rate limiting / throttling" description: "API rate limiting, DDoS prevention, quota management"
  • label: "Data aggregation" description: "Analytics, counters, leaderboards, metrics collection"
  • label: "Caching with consistency" description: "Distributed cache, cache-aside pattern, write-through cache"

Question 2: Scale Requirements

header: "Scale" question: "What scale do you expect?" multiSelect: false options:

  • label: "Small (<1K instances)" description: "Prototype, small app, specific use case"
  • label: "Medium (1K-100K instances)" description: "Growing app, moderate traffic"
  • label: "Large (100K-1M instances)" description: "High traffic app, many users"
  • label: "Very Large (>1M instances)" description: "Enterprise scale, global application"

Question 3: Data Persistence

header: "Persistence" question: "What are your data persistence requirements?" multiSelect: false options:

  • label: "Ephemeral (in-memory only)" description: "Data can be lost, rebuilt from external sources"
  • label: "Session-based (TTL cleanup)" description: "Data expires after period of inactivity"
  • label: "Permanent (long-term storage)" description: "Data must persist indefinitely"
  • label: "Hybrid (mix of ephemeral and permanent)" description: "Some data temporary, some permanent"

Read the full file on GitHub · 705 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 705 lines · 34 tokens per session scan A 6528a10888d7

Subscribe to this mod's changes

cloudflare-durable-objects:patterns is a command published in the GitHub repository secondsky/claude-skills (214 stars, last pushed 2d ago), licensed MIT. It adds 34 tokens to every session and 4,228 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.