Agent Skills: Wrangler CLI

Cloudflare Workers CLI for deploying, developing, and managing Workers, KV, R2, D1, Vectorize, Hyperdrive, Workers AI, Containers, Queues, Workflows, Pipelines, and Secrets Store. Load before running wrangler commands to ensure correct syntax and best practices. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.

UncategorizedID: fubira/claude-code-settings/wrangler

Install this agent skill to your local

pnpm dlx add-skill https://github.com/fubira/claude-code-settings/tree/HEAD/skills-disabled/wrangler

Skill Files

Browse the full folder contents for wrangler.

Download Skill

Loading file tree…

skills-disabled/wrangler/SKILL.md

Skill Metadata

Name
wrangler
Description
Cloudflare Workers CLI for deploying, developing, and managing Workers, KV, R2, D1, Vectorize, Hyperdrive, Workers AI, Containers, Queues, Workflows, Pipelines, and Secrets Store. Load before running wrangler commands to ensure correct syntax and best practices. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.

Wrangler CLI

Your knowledge of Wrangler CLI flags, config fields, and subcommands may be outdated. Prefer retrieval over pre-training for any Wrangler task.

Retrieval Sources

Fetch the latest information before writing or reviewing Wrangler commands and config. Do not rely on baked-in knowledge for CLI flags, config fields, or binding shapes.

| Source | How to retrieve | Use for | |--------|----------------|---------| | Wrangler docs | https://developers.cloudflare.com/workers/wrangler/ | CLI commands, flags, config reference | | Wrangler config schema | node_modules/wrangler/config-schema.json | Config fields, binding shapes, allowed values | | Cloudflare docs | Search tool or https://developers.cloudflare.com/workers/ | API reference, compatibility dates/flags |

Reference Files

Detailed commands and config snippets live in references/. Read the file matching the task:

| Task area | File | |-----------|------| | wrangler.jsonc config, bindings, wrangler types | references/configuration.md | | wrangler dev, remote bindings, .dev.vars, deploy, secrets, rollback | references/dev-deploy.md | | KV, R2, D1 (namespaces, objects, SQL, migrations) | references/storage.md | | Vectorize, Hyperdrive, Workers AI | references/data-ai.md | | Queues, Containers, Workflows, Pipelines, Secrets Store, Pages | references/services.md | | wrangler tail, Vitest testing, troubleshooting | references/observability-testing.md |

FIRST: Check if Wrangler is installed, and if not, install it

Check if Wrangler is installed by running:

wrangler --version  # Requires v4.x+

If Wrangler is not installed, you should install it by running:

npm install -D wrangler@latest

Wherever possible, you should use Wrangler instead of manually constructing API requests.

Key Guidelines

  • Use wrangler.jsonc: Prefer JSON config over TOML. Newer features are JSON-only.
  • Set compatibility_date: Use a recent date (within 30 days). Check https://developers.cloudflare.com/workers/configuration/compatibility-dates/
  • Generate types after config changes: Run wrangler types to update TypeScript bindings.
  • Local dev defaults to local storage: Bindings use local simulation unless remote: true.
  • Profile Worker startup: Run wrangler check startup to measure startup time and detect scripts that exceed the startup time limit.
  • Use environments for staging/prod: Define env.staging and env.production in config.

Quick Start: New Worker

# Initialize new project
npx wrangler init my-worker

# Or with a framework
npx create-cloudflare@latest my-app

Quick Reference: Core Commands

| Task | Command | |------|---------| | Start local dev server | wrangler dev | | Deploy to Cloudflare | wrangler deploy | | Deploy dry run | wrangler deploy --dry-run | | Generate TypeScript types | wrangler types | | Profile Worker startup time | wrangler check startup | | View live logs | wrangler tail | | Delete Worker | wrangler delete | | Auth status | wrangler whoami |

Best Practices

  1. Version control wrangler.jsonc: Treat as source of truth for Worker config.
  2. Use automatic provisioning: Omit resource IDs for auto-creation on deploy.
  3. Run wrangler types in CI: Add to build step to catch binding mismatches.
  4. Use environments: Separate staging/production with env.staging, env.production.
  5. Set compatibility_date: Update quarterly to get new runtime features.
  6. Use .dev.vars for local secrets: Never commit secrets to config.
  7. Test locally first: wrangler dev with local bindings before deploying.
  8. Use --dry-run before major deploys: Validate changes without deployment.
  9. Never embed secrets in commands: Use interactive prompts (wrangler secret put), file-based input (wrangler secret bulk), or secure CI environment variables. Never echo, log, or pass secret values as CLI arguments.