# cloudflare-worker

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

- command · `type=command` · Claude Code, Codex, GitHub Copilot, Gemini CLI · ★ 1357 repo stars
- Author: qdhenry
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/qdhenry/Claude-Command-Suite/tree/HEAD/.claude/commands/dev/cloudflare-worker.md
- Updated: 2026-03-01
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/commands/cloudflare-worker

## What it 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.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/commands/cloudflare-worker.md` — Call it with /cloudflare-worker. For all projects use ~/.claude/commands/

### Codex

**Manually: put the files in place**
- File: `~/.codex/prompts/cloudflare-worker.md` — Call it with /prompts:cloudflare-worker. Codex marks this format deprecated in favour of skills

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/prompts/cloudflare-worker.prompt.md`

### Gemini CLI

**Manually: put the files in place**
- File: `.gemini/commands/cloudflare-worker.toml` — Gemini stores commands as TOML: the prompt text goes into the prompt field

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/qdhenry/Claude-Command-Suite/tree/HEAD/.claude/commands/dev/cloudflare-worker.md

## When to use it
- 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
- 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.

## Similar
- [cloudflare-worker-builder](https://affpapa.org/en/nevibecode/skills/cloudflare-worker-builder.md) — skill · 1400 installs
- [Cloudflare Worker taste](https://affpapa.org/en/nevibecode/prompts/cloudflare-worker-taste.md) — prompt · ★ 178201 repo stars
- [cloudflare-worker-dev](https://affpapa.org/en/nevibecode/skills/cloudflare-worker-dev.md) — skill · 189 installs
- [cloudflare](https://affpapa.org/en/nevibecode/skills/cloudflare-cloudflare.md) — skill · 159200 installs
- [cloudflare-email-service](https://affpapa.org/en/nevibecode/skills/cloudflare-email-service.md) — skill · 120200 installs
- [sentry-cloudflare-sdk](https://affpapa.org/en/nevibecode/skills/sentry-cloudflare-sdk.md) — skill · 2800 installs

From the same set: [qdhenry/claude-command-suite](https://affpapa.org/en/nevibecode/by/qdhenry/claude-command-suite.md) — 112 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
