Skip to content

secondsky/claude-skills / plugins/cloudflare-durable-objects/skills/cloudflare-durable-objects

cloudflare-durable-objects

Verified

Cloudflare Durable Objects for stateful coordination and real-time apps. Use for chat, multiplayer games, WebSocket hibernation, or encountering class export, migration, alarm errors.

FileKindSize
SKILL.mdskill md21.6 KB
references/advanced-sql-patterns.mdmarkdown15.8 KB
references/alarms-api.mdmarkdown6.5 KB
references/best-practices.mdmarkdown8.5 KB
references/common-patterns.mdmarkdown16.7 KB
references/data-modeling.mdmarkdown16.9 KB
references/error-codes.mdmarkdown7.7 KB
references/gradual-deployments.mdmarkdown13.9 KB
references/migration-cheatsheet.mdmarkdown3.2 KB
references/migrations-guide.mdmarkdown7.3 KB
references/monitoring-debugging.mdmarkdown18.2 KB
references/performance-optimization.mdmarkdown16.2 KB
references/rpc-metadata.mdmarkdown16.9 KB
references/rpc-patterns.mdmarkdown6.5 KB
references/security-best-practices.mdmarkdown15.9 KB
references/state-api-reference.mdmarkdown6.0 KB
references/stubs-routing.mdmarkdown10.6 KB
references/top-errors.mdmarkdown10.2 KB
references/typescript-config.mdmarkdown8.3 KB
references/vitest-testing.mdmarkdown18.1 KB
references/websocket-hibernation.mdmarkdown6.3 KB
references/wrangler-commands.mdmarkdown3.4 KB
scripts/check-versions.shexecutablescript593 B
scripts/migration-generator.shexecutablescript13.4 KB
scripts/setup-vitest-do.shexecutablescript10.2 KB
scripts/validate-do-config.shexecutablescript10.0 KB
templates/alarms-api-do.tsscript6.1 KB
templates/basic-do.tsscript2.9 KB
templates/gradual-deployment-config.jsoncother10.4 KB
templates/location-hints.tsscript6.8 KB
templates/multi-do-coordination.tsscript7.8 KB
templates/package.jsonmanifest384 B
templates/rpc-metadata-do.tsscript10.8 KB
templates/rpc-vs-fetch.tsscript6.0 KB
templates/state-api-patterns.tsscript5.8 KB
templates/ttl-cleanup-do.tsscript17.6 KB
templates/vitest-do-test.tsscript12.3 KB
templates/websocket-hibernation-do.tsscript6.0 KB
templates/wrangler-do-config.jsoncother2.0 KB

references/wrangler-commands.md

View on GitHub
# Wrangler CLI Commands for Durable Objects

Complete reference for managing Durable Objects with wrangler CLI.

---

## Development Commands

### Dev Server

```bash
# Start local dev server
npx wrangler dev

# Dev with remote Durable Objects (not local)
npx wrangler dev --remote

# Dev with specific port
npx wrangler dev --port 8787
```

### Deployment

```bash
# Deploy to production
npx wrangler deploy

# Deploy specific environment
npx wrangler deploy --env production

# Dry run (show what would be deployed)
npx wrangler deploy --dry-run
```

---

## Durable Objects Commands

### List DO Namespaces

```bash
# List all DO namespaces in account
npx wrangler d1 list
```

### View DO Objects

```bash
# List all instances of a DO class
npx wrangler durable-objects namespace list <BINDING_NAME>

# Get info about specific DO instance
npx wrangler durable-objects namespace get <BINDING_NAME> --id <OBJECT_ID>
```

### Delete DO Instances

```bash
# Delete specific DO instance (deletes all storage)
npx wrangler durable-objects namespace delete <BINDING_NAME> --id <OBJECT_ID>

# DANGEROUS: Delete all instances in namespace
npx wrangler durable-objects namespace delete-all <BINDING_NAME>
```

---

## Logs and Debugging

### Tail Logs

```bash
# Tail logs from deployed Worker
npx wrangler tail

# Tail with filter
npx wrangler tail --format pretty

# Tail specific DO
npx wrangler tail --search "DurableObject"
```

### View Logs

```bash
# View recent logs
npx wrangler pages deployment tail

# Filter by log level
npx wrangler tail --level error
```

---

## Type Generation

### Generate TypeScript Types

```bash
# Generate types for bindings
npx wrangler types

# This creates worker-configuration.d.ts with:
# - DurableObjectNamespace types
# - Env interface
# - Binding types
```

---

## Migrations

**Migrations are configured in `wrangler.jsonc`, not via CLI commands.**

Example migration workflow:

1. Edit `wrangler.jsonc` to add migration
2. Run `npx wrangler deploy`
3. Migration applies atomically on deploy

See `migrations-guide.md` for detailed migration patterns.

---

## Useful Flags

### Common Flags

```bash
# Show help
npx wrangler --help
npx wrangler deploy --help

# Specify config file
npx wrangler deploy --config wrangler.production.jsonc

# Specify environment
npx wrangler deploy --env staging

# Verbose output
npx wrangler deploy --verbose

# Compatibility date
npx wrangler deploy --compatibility-date 2025-10-22
```

---

## Example Workflows

### Initial Setup

```bash
# 1. Initialize project
npm create cloudflare@latest my-do-app -- \
  --template=cloudflare/durable-objects-template \
  --ts --git --deploy false

cd my-do-app

# 2. Install dependencies
npm install

# 3. Start dev server
npm run dev

# 4. Deploy
npm run deploy
```

### Update and Deploy

```bash
# 1. Make code changes
# 2. Test locally
npm run dev

# 3. Deploy
npm run deploy

# 4. Tail logs
npx wrangler tail
```

### Add New DO Class

```bash
# 1. Create DO class file (e.g., src/counter.ts)
# 2. Update wrangler.jsonc:
#    - Add binding
#    - Add migration
# 3. Deploy
npm run deploy
```

---

## Troubleshooting

### Check Deployment Status

```bash
npx wrangler deployments list
```

### Rollback Deployment

```bash
# Cloudflare automatically keeps recent versions
# Use dashboard to rollback if needed
```

### Clear Local Cache

```bash
rm -rf .wrangler
```

---

**Official Docs**: https://developers.cloudflare.com/workers/wrangler/commands/
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall