Skip to main content
command CX Codex

cloudflare-worker — Claude Code command for Cloudflare Workers

Generate a Cloudflare Worker from a task description, with Wrangler configuration and sample requests. Useful for building an API, WebSocket service, or authentication middleware.

no license ★ 1,357 updated 2026-03-01

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/commands/cloudflare-worker.md
Open on GitHub

What cloudflare-worker does

Describe the task, and this command drafts a Cloudflare Workers solution. TypeScript and ES modules are the defaults. It asks for complete files rather than isolated edits, with output sections for the main Worker, wrangler.jsonc, types when needed, and usage or test examples.

The suggested Cloudflare service depends on the job: D1 is suited to relational data, while R2 is for object storage. The Wrangler configuration is expected to include the bindings used by the code, environment variables, and compatibility settings; the instructions set compatibility_date to 2025-03-07 and enable nodejs_compat. For WebSockets inside a Durable Object, the command calls for the hibernation API and dedicated message and close handlers. Ambiguous requirements should prompt a clarifying question.

What it helps with

  • generate a REST API for Cloudflare Workers
  • draft a Durable Objects WebSocket server
  • write authentication middleware backed by Workers KV
  • prepare Wrangler configuration with the bindings the code uses

Example prompts for the agent

  • Create a Cloudflare Workers REST API that returns JSON data.
  • Draft a Durable Objects WebSocket server with message handlers.
  • Write authentication middleware using Workers KV.

How to install cloudflare-worker

Manually: put the files in place

.claude/commands/cloudflare-worker.md

Call it with /cloudflare-worker. For all projects use ~/.claude/commands/

Questions about cloudflare-worker

How do I install cloudflare-worker in Claude Code?

Copy the command file to .claude/commands/cloudflare-worker.md.

What does cloudflare-worker do?

It generates Cloudflare Workers code from a task description, along with Wrangler configuration and sample requests or tests. TypeScript and ES modules are the defaults.

How does it handle WebSockets in Durable Objects?

It uses the WebSocket hibernation API: this.ctx.acceptWebSocket(server) accepts the connection, while webSocketMessage() and webSocketClose() handle events.

Similar slash commands

All slash commands for Cloud: AWS, Azure, GCP →

From the same set112

The whole set →
orchestration-readme orchestration-readme breaks large features into structured task files, tracks active stages, and aligns code changes with Git commits inside Claude Code. CX Codex +1 ★ 1,357repo stars data-engineer The data-engineer subagent designs data pipelines, warehouses, and streaming systems. Use it for ETL/ELT work, Spark jobs, Airflow flows, or Kafka architectures. CX Codex ★ 1,357repo stars database-optimizer database-optimizer — a subagent for database performance analysis: finds bottlenecks in SQL queries, indexing, schema design and infrastructure. CX Codex ★ 1,357repo stars ui-designer ui-designer — a Claude Code subagent for building interface mockups, design systems, and accessible layouts using magic and context7 MCP servers. CX Codex ★ 1,357repo stars legacy-modernizer legacy-modernizer is a Claude Code subagent for planning and carrying out gradual changes to legacy systems. It engages on framework upgrades, codebase refactors, and monolith decomposition. CX Codex ★ 1,357repo stars todo-worktree todo-worktree takes tasks from a todo list and implements them inside isolated git worktrees with strict phased approvals. CX Codex +1 ★ 1,357repo stars package-skill package-skill is a Claude Code command that checks a skill and builds a ZIP for sharing, team distribution, or publication. CX Codex +1 ★ 1,357repo stars parallel-tasks-help parallel-tasks-help is a Claude Code command that explains how to run /parallel-tasks, with its options, agent types, and examples. It also covers task systems and coordination stages. CX Codex +1 ★ 1,357repo stars

Project sponsors

Companies that keep this analytics open