cloudflare-workers-dev-experience
Get your Cloudflare Workers project running locally with Wrangler and Miniflare. This skill covers project initialization, wrangler.jsonc configuration for KV, D1, and R2 bindings, TypeScript setup, and common development errors. Use it to troubleshoot binding issues, HMR problems, and deployment mismatches.
Cloudflare Workers Dev Experience sets up local development with Wrangler, Miniflare, and hot reload for testing Workers code.
AI-generated summary based on this skill's SKILL.md
Install
secondsky/claude-skills/cloudflare-workers-dev-experience · repository language: TypeScript
git clone https://github.com/secondsky/claude-skills
cp -r claude-skills/plugins/cloudflare-workers/skills/cloudflare-workers-dev-experience ~/.claude/skills/cloudflare-workers-dev-experienceFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I set up Cloudflare Workers local development?
Cloudflare Workers dev experience starts with installing Wrangler (npm install -g wrangler) and running wrangler init to scaffold your project. This creates wrangler.jsonc with your worker configuration. Use wrangler dev to start the local server on port 8787, which runs your worker through Miniflare for local testing before deployment.
Why is wrangler dev not working with hot reload?
Cloudflare Workers' hot reload (HMR) requires proper wrangler.jsonc setup. Ensure your file changes are in the src/ directory and wrangler dev is running. If changes aren't reflecting, check that your wrangler version is current (wrangler update) and that no build errors are blocking recompilation. Restart wrangler dev if needed.
How do I configure wrangler.jsonc with bindings and environment variables?
Cloudflare Workers bindings go in wrangler.jsonc under [[env.production.kv_namespaces]], [[d1_databases]], or [[r2_buckets]]. Define environment variables in [env.production.vars]. For local development, Miniflare reads these automatically. Use wrangler dev --remote to test against live bindings, or --local for Miniflare simulation.
What does 'binding undefined env.KV error' mean in Cloudflare Workers?
Cloudflare Workers throws this error when wrangler.jsonc doesn't declare the binding or the binding name in your code doesn't match the config. Verify [[kv_namespaces]] has the correct binding name and namespace_id. For local dev, ensure Miniflare is running (wrangler dev without --remote). Check your worker accesses env.KV_NAMESPACE, not a different name.
How do I debug Cloudflare Workers locally with TypeScript?
Cloudflare Workers TypeScript debugging uses wrangler types to generate type definitions (wrangler types). Add "types": "@cloudflare/workers-types" to tsconfig.json. Use wrangler dev to run locally, then inspect logs with wrangler tail. For VSCode debugging, attach to the Node process or use console.log in your worker code to see output in the terminal.
How do I set up Cloudflare KV locally with Wrangler?
Cloudflare Workers KV local setup requires declaring [[kv_namespaces]] in wrangler.jsonc with binding and id. Run wrangler dev to start Miniflare, which simulates KV locally. Use env.KV_BINDING.get/put/delete in your worker code. For testing against live KV, use wrangler dev --remote instead of local mode.
SKILL.md
rendered from the published skill — quoted content, verbatim
Cloudflare Workers Developer Experience
Local development setup with Wrangler, Miniflare, and modern tooling.
Quick Start
# Create new project
bunx create-cloudflare@latest my-worker
# Or from scratch
mkdir my-worker && cd my-worker
bun init -y
bun add -d wrangler @cloudflare/workers-types
# Start local development
bunx wrangler dev
Secure Installation
Scaffolding tools like bunx create-cloudflare download and execute remote code. Before running, follow supply chain security best practices:
- Block post-install scripts —
npm config set ignore-scripts true(or Bun: disabled by default) - Cooldown period — Wait 7 days for new package versions to be vetted by the community
- Audit before installing — Run
socket package score npm <pkg>or usesocket npm install <pkg>to check packages
Load the dependency-upgrade skill for full security configuration including Socket
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 7 files
plugins/cloudflare-workers/skills/cloudflare-workers-dev-experience/SKILL.md
plugins/cloudflare-workers/skills/cloudflare-workers-dev-experience/references/debugging-tools.md
plugins/cloudflare-workers/skills/cloudflare-workers-dev-experience/references/local-development.md
plugins/cloudflare-workers/skills/cloudflare-workers-dev-experience/references/wrangler-config.md
plugins/cloudflare-workers/skills/cloudflare-workers-dev-experience/scripts/dev-setup.sh
plugins/cloudflare-workers/skills/cloudflare-workers-dev-experience/templates/dev-script.ts
plugins/cloudflare-workers/skills/cloudflare-workers-dev-experience/templates/wrangler-config.jsonc