
wrangler
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.
- Installs
- 104
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/cloudflare/cloudflare-docs --skill wrangler- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads wrangler automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Wrangler CLI
Deploy, develop, and manage Cloudflare Workers and associated resources.
FIRST: Verify Wrangler Installation
wrangler --version # Requires v4.x+
If not installed:
npm install -D wrangler@latest
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 typesto update TypeScript bindings. - Local dev defaults to local storage: Bindings use local simulation unless
remote: true. - Validate config before deploy: Run
wrangler checkto catch errors early. - Use environments for staging/prod: Define
env.stagingandenv.productionin 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 |
| Validate configuration | wrangler check |
| View live logs | wrangler tail |
| Delete Worker | wrangler delete |
| Auth status | wrangler whoami |
Configuration (wrangler.jsonc)
Minimal Config
{
"$schema": "./node_modules/wrangler/config-schema.json",
"name": "my-worker",
"main": "src/index.ts",
"compatibility_date": "2026-01-01"
}
Full Config with Bindings
{
"$schema": "./node_modules/wrangler/config-schema.json",
"name": "my-worker",
"main": "src/index.ts",
"compatibility_date": "2026-01-01",
"compatibility_flags": ["nodejs_compat_v2"],
// Environment variables
"vars": {
"ENVIRONMENT": "production"
},
// KV Namespace
"kv_namespaces": [
{ "binding": "KV", "id": "<KV_NAMESPACE_ID>" }
],
// R2 Bucket
"r2_buckets": [
{ "binding": "BUCKET", "bucket_name": "my-bucket" }
],
// D1 Database
"d1_databases": [
{ "binding": "DB", "database_name": "my-db", "database_id": "<DB_ID>" }
],
// Workers AI (always remote)
"ai": { "binding": "AI" },
// Vectorize
"vectorize": [
{ "binding": "VECTOR_INDEX", "index_name": "my-index" }
],
// Hyperdrive
"hyperdrive": [
{ "binding": "HYPERDRIVE", "id": "<HYPERDRIVE_ID>" }
],
// Durable Objects
"durable_objects": {
"bindings": [
{ "name": "COUNTER", "class_name": "Counter" }
]
},
// Cron triggers
"triggers": {
"crons": ["0 * * * *"]
},
// Environments
"env": {
"staging": {
"name": "my-worker-staging",
"vars": { "ENVIRONMENT": "staging" }
}
}
}
Generate Types from Config
# Generate worker-configuration.d.ts
wrangler types
# Custom output path
wrangler types ./src/env.d.ts
# Check types are up to date (CI)
wrangler types --check
Local Development
Start Dev Server
# Local mode (default) - uses local storage simulation
wrangler dev
# With specific environment
wrangler dev --env staging
# Force local-only (disable remote bindings)
wrangler dev --local
# Remote mode - runs on Cloudflare edge (legacy)
wrangler dev --remote
# Custom port
wrangler dev --port 8787
# Live reload for HTML changes
wrangler dev --live-reload
# Test scheduled/cron handlers
wrangler dev --test-scheduled
# Then visit: http://localhost:8787/__scheduled
Remote Bindings for Local Dev
Use remote: true in binding config to connect to real resources while running locally:
{
"r2_buckets": [
{ "binding": "BUCKET", "bucket_name": "my-bucket", "remote": true }
],
"ai": { "binding": "AI", "remote": true },
"vectorize": [
{ "binding": "INDEX", "index_name": "my-index", "remote": true }
]
}
Recommended remote bindings: AI (required), Vectorize, Browser Rendering, mTLS, Images.
Local Secrets
Create .dev.vars for local development secrets:
API_KEY=local-dev-key
DATABASE_URL=postgres://localhost:5432/dev
Deployment
Deploy Worker
# Deploy to production
wrangler deploy
# Deploy specific environment
wrangler deploy --env staging
# Dry run (validate without deploying)
wrangler deploy --dry-run
# Keep dashboard-set variables
wrangler deploy --keep-vars
# Minify code
wrangler deploy --minify
Manage Secrets
# Set secret interactively
wrangler secret put API_KEY
# Set from stdin
echo "secret-value" | wrangler secret put API_KEY
# List secrets
wrangler secret list
# Delete secret
wrangler secret delete API_KEY
# Bulk secrets from JSON file
wrangler secret bulk secrets.json
Versions and Rollback
# List recent versions
wrangler versions list
# View specific version
wrangler versions view <VERSION_ID>
# Rollback to previous version
wrangler rollback
# Rollback to specific version
wrangler rollback <VERSION_ID>
KV (Key-Value Store)
Manage Namespaces
# Create namespace
wrangler kv namespace create MY_KV
# List namespaces
wrangler kv namespace list
# Delete namespace
wrangler kv namespace delete --namespace-id <ID>
Manage Keys
# Put value
wrangler kv key put --namespace-id <ID> "key" "value"
# Put with expiration (seconds)
wrangler kv key put --namespace-id <ID> "key" "value" --expiration-ttl 3600
# Get value
wrangler kv key get --namespace-id <ID> "key"
# List keys
wrangler kv key list --namespace-id <ID>
# Delete key
wrangler kv key delete --namespace-id <ID> "key"
# Bulk put from JSON
wrangler kv bulk put --namespace-id <ID> data.json
Config Binding
{
"kv_namespaces": [
{ "binding": "CACHE", "id": "<NAMESPACE_ID>" }
]
}
R2 (Object Storage)
Manage Buckets
# Create bucket
wrangler r2 bucket create my-bucket
# Create with location hint
wrangler r2 bucket create my-bucket --location wnam
# List buckets
wrangler r2 bucket list
# Get bucket info
wrangler r2 bucket info my-bucket
# Delete bucket
wrangler r2 bucket delete my-bucket
Manage Objects
# Upload object
wrangler r2 object put my-bucket/path/file.txt --file ./local-file.txt
# Download object
wrangler r2 object get my-bucket/path/file.txt
# Delete object
wrangler r2 object delete my-bucket/path/file.txt
Config Binding
{
"r2_buckets": [
{ "binding": "ASSETS", "bucket_name": "my-bucket" }
]
}
D1 (SQL Database)
Manage Databases
# Create database
wrangler d1 create my-database
# Create with location
wrangler d1 create my-database --location wnam
# List databases
wrangler d1 list
# Get database info
wrangler d1 info my-database
# Delete database
wrangler d1 delete my-database
Execute SQL
# Execute SQL command (remote)
wrangler d1 execute my-database --remote --command "SELECT * FROM users"
# Execute SQL file (remote)
wrangler d1 execute my-database --remote --file ./schema.sql
# Execute locally
wrangler d1 execute my-database --local --command "SELECT * FROM users"
Migrations
# Create migration
wrangler d1 migrations create my-database create_users_table
# List pending migrations
wrangler d1 migrations list my-database --local
# Apply migrations locally
wrangler d1 migrations apply my-database --local
# Apply migrations to remote
wrangler d1 migrations apply my-database --remote
Export/Backup
# Export schema and data
wrangler d1 export my-database --remote --output backup.sql
# Export schema only
wrangler d1 export my-database --remote --output schema.sql --no-data
Config Binding
{
"d1_databases": [
{
"binding": "DB",
"database_name": "my-database",
"database_id": "<DATABASE_ID>",
"migrations_dir": "./migrations"
}
]
}
Vectorize (Vector Database)
Manage Indexes
# Create index with dimensions
wrangler vectorize create my-index --dimensions 768 --metric cosine
# Create with preset (auto-configures dimensions/metric)
wrangler vectorize create my-index --preset @cf/baai/bge-base-en-v1.5
# List indexes
wrangler vectorize list
# Get index info
wrangler vectorize get my-index
# Delete index
wrangler vectorize delete my-index
Manage Vectors
# Insert vectors from NDJSON file
wrangler vectorize insert my-index --file vectors.ndjson
# Query vectors
wrangler vectorize query my-index --vector "[0.1, 0.2, ...]" --top-k 10
Config Binding
{
"vectorize": [
{ "binding": "SEARCH_INDEX", "index_name": "my-index" }
]
}
Hyperdrive (Database Accelerator)
Manage Configs
# Create config
wrangler hyperdrive create my-hyperdrive \
--connection-string "postgres://user:pass@host:5432/database"
# List configs
wrangler hyperdrive list
# Get config details
wrangler hyperdrive get <HYPERDRIVE_ID>
# Update config
wrangler hyperdrive update <HYPERDRIVE_ID> --origin-password "new-password"
# Delete config
wrangler hyperdrive delete <HYPERDRIVE_ID>
Config Binding
{
"compatibility_flags": ["nodejs_compat_v2"],
"hyperdrive": [
{ "binding": "HYPERDRIVE", "id": "<HYPERDRIVE_ID>" }
]
}
Workers AI
List Models
# List available models
wrangler ai models
# List finetunes
wrangler ai finetune list
Config Binding
{
"ai": { "binding": "AI" }
}
Note: Workers AI always runs remotely and incurs usage charges even in local dev.
Queues
Manage Queues
# Create queue
wrangler queues create my-queue
# List queues
wrangler queues list
# Delete queue
wrangler queues delete my-queue
# Add consumer to queue
wrangler queues consumer add my-queue my-worker
# Remove consumer
wrangler queues consumer remove my-queue my-worker
Config Binding
{
"queues": {
"producers": [
{ "binding": "MY_QUEUE", "queue": "my-queue" }
],
"consumers": [
{
"queue": "my-queue",
"max_batch_size": 10,
"max_batch_timeout": 30
}
]
}
}
Containers
Build and Push Images
# Build container image
wrangler containers build -t my-app:latest .
# Build and push in one command
wrangler containers build -t my-app:latest . --push
# Push existing image to Cloudflare registry
wrangler containers push my-app:latest
Manage Containers
# List containers
wrangler containers list
# Get container info
wrangler containers info <CONTAINER_ID>
# Delete container
wrangler containers delete <CONTAINER_ID>
Manage Images
# List images in registry
wrangler containers images list
# Delete image
wrangler containers images delete my-app:latest
Manage External Registries
# List configured registries
wrangler containers registries list
# Configure external registry (e.g., ECR)
wrangler containers registries configure <DOMAIN> \
--public-credential <AWS_ACCESS_KEY_ID>
# Delete registry configuration
wrangler containers registries delete <DOMAIN>
Workflows
Manage Workflows
# List workflows
wrangler workflows list
# Describe workflow
wrangler workflows describe my-workflow
# Trigger workflow instance
wrangler workflows trigger my-workflow
# Trigger with parameters
wrangler workflows trigger my-workflow --params '{"key": "value"}'
# Delete workflow
wrangler workflows delete my-workflow
Manage Workflow Instances
# List instances
wrangler workflows instances list my-workflow
# Describe instance
wrangler workflows instances describe my-workflow <INSTANCE_ID>
# Terminate instance
wrangler workflows instances terminate my-workflow <INSTANCE_ID>
Config Binding
{
"workflows": [
{
"binding": "MY_WORKFLOW",
"name": "my-workflow",
"class_name": "MyWorkflow"
}
]
}
Pipelines
Manage Pipelines
# Create pipeline
wrangler pipelines create my-pipeline --r2 my-bucket
# List pipelines
wrangler pipelines list
# Show pipeline details
wrangler pipelines show my-pipeline
# Update pipeline
wrangler pipelines update my-pipeline --batch-max-mb 100
# Delete pipeline
wrangler pipelines delete my-pipeline
Config Binding
{
"pipelines": [
{ "binding": "MY_PIPELINE", "pipeline": "my-pipeline" }
]
}
Secrets Store
Manage Stores
# Create store
wrangler secrets-store store create my-store
# List stores
wrangler secrets-store store list
# Delete store
wrangler secrets-store store delete <STORE_ID>
Manage Secrets in Store
# Add secret to store
wrangler secrets-store secret put <STORE_ID> my-secret
# List secrets in store
wrangler secrets-store secret list <STORE_ID>
# Get secret
wrangler secrets-store secret get <STORE_ID> my-secret
# Delete secret from store
wrangler secrets-store secret delete <STORE_ID> my-secret
Config Binding
{
"secrets_store_secrets": [
{
"binding": "MY_SECRET",
"store_id": "<STORE_ID>",
"secret_name": "my-secret"
}
]
}
Pages (Frontend Deployment)
# Create Pages project
wrangler pages project create my-site
# Deploy directory to Pages
wrangler pages deploy ./dist
# Deploy with specific branch
wrangler pages deploy ./dist --branch main
# List deployments
wrangler pages deployment list --project-name my-site
Observability
Tail Logs
# Stream live logs
wrangler tail
# Tail specific Worker
wrangler tail my-worker
# Filter by status
wrangler tail --status error
# Filter by search term
wrangler tail --search "error"
# JSON output
wrangler tail --format json
Config Logging
{
"observability": {
"enabled": true,
"head_sampling_rate": 1
}
}
Testing
Local Testing with Vitest
npm install -D @cloudflare/vitest-pool-workers vitest
vitest.config.ts:
import { defineWorkersConfig } from "@cloudflare/vitest-pool-workers/config";
export default defineWorkersConfig({
test: {
poolOptions: {
workers: {
wrangler: { configPath: "./wrangler.jsonc" },
},
},
},
});
Test Scheduled Events
# Enable in dev
wrangler dev --test-scheduled
# Trigger via HTTP
curl http://localhost:8787/__scheduled
Troubleshooting
Common Issues
| Issue | Solution |
|---|---|
command not found: wrangler | Install: npm install -D wrangler |
| Auth errors | Run wrangler login |
| Config validation errors | Run wrangler check |
| Type errors after config change | Run wrangler types |
| Local storage not persisting | Check .wrangler/state directory |
| Binding undefined in Worker | Verify binding name matches config exactly |
Debug Commands
# Check auth status
wrangler whoami
# Validate config
wrangler check
# View config schema
wrangler docs configuration
Best Practices
- Version control
wrangler.jsonc: Treat as source of truth for Worker config. - Use automatic provisioning: Omit resource IDs for auto-creation on deploy.
- Run
wrangler typesin CI: Add to build step to catch binding mismatches. - Use environments: Separate staging/production with
env.staging,env.production. - Set
compatibility_date: Update quarterly to get new runtime features. - Use
.dev.varsfor local secrets: Never commit secrets to config. - Test locally first:
wrangler devwith local bindings before deploying. - Use
--dry-runbefore major deploys: Validate changes without deployment.
FAQ
What does the wrangler skill do?
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.
How do I install wrangler?
Run npx skills add https://github.com/cloudflare/cloudflare-docs --skill wrangler in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/wrangler/ (personal) or .claude/skills/wrangler/ (project).
Which AI agents can use wrangler?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is wrangler safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains wrangler?
It is published by cloudflare in cloudflare/cloudflare-docs, and it is an official skill from the maker of the technology it covers. It has 104 recorded installs.
More from cloudflare/cloudflare-docs
eli5
cloudflare/cloudflare-docs
Transform technical jargon into clear explanations using before/after comparisons, metaphors, and practical context
code-review
cloudflare/cloudflare-docs
Review the changed lines of a single file in a pull request for bugs, correctness, error handling, security, and maintainability, and return structured findings.
cloudflare
cloudflare/cloudflare-docs
Open the skill to read its SKILL.md instructions.
docs-review
cloudflare/cloudflare-docs
Reviews documentation PRs and provides GitHub PR suggestions. Load when asked to review, suggest changes, or provide feedback on docs content. Covers MDX, frontmatter, style guide, components, and content accuracy.
changelog
cloudflare/cloudflare-docs
Open the skill to read its SKILL.md instructions.
durable-objects
cloudflare/cloudflare-docs
Open the skill to read its SKILL.md instructions.
Popular devops & cloud skills
microsoft-foundry
microsoft/azure-skills
Build, deploy, evaluate, optimize, fine-tune, and manage Microsoft Foundry agents, models, and resources end to end. USE FOR: foundry, azd ai agent, azd provision/deploy, hosted agent scaffold/develop/run/deploy/troubleshoot, prompt agent create, managed harness agent create, GitHub Copilot harness agent, create agent, update agent, add tool to agent, invoke agent, agent insights, evaluate agent, batch eval, continuous eval, continuous monitoring, agent CI/CD, optimize prompt, improve prompt, optimize agent instructions, Agent Optimizer scaffold, dataset curation from traces, deploy model, model fine-tuning (SFT/DPO/RFT), Foundry project, RBAC, role assignment, permissions, quota, capacity, region, deployment failure, AI Services, create Foundry resource, knowledge index, customize deployment, onboard, availability, training-data, grader, distillation, large file upload. DO NOT USE FOR: Azure Functions, App Service, general Azure deploy (use azure-deploy), general Azure prep (use azure
azure-diagnostics
microsoft/azure-skills
Debug Azure production issues on Azure using AppLens, Azure Monitor, resource health, and safe triage. WHEN: debug production issues, troubleshoot app service, app service high CPU, app service deployment failure, troubleshoot container apps, container app 503 or target port mismatch, troubleshoot functions, function telemetry missing or stopped after a config/connection-string change, troubleshoot AKS, VM RDP, Linux SSH, VM black screen, can't connect to VM, reset VM password, NSG or firewall blocking, kubectl cannot connect, kube-system/CoreDNS failures, pod pending, crashloop, node not ready, upgrade failures, analyze logs, KQL, insights, image pull failures, cold start issues, health probe failures, resource health, root cause of errors, troubleshoot event hubs, troubleshoot service bus, messaging SDK error, AMQP connection failure, message lock lost, lock renewal during long-running processing, service bus dead letter.
azure-prepare
microsoft/azure-skills
Prepare azd-based Azure projects for deployment: generates azure.yaml, infrastructure (Bicep/Terraform), and Dockerfiles for the Azure Developer CLI (azd) workflow. USE ONLY when the user explicitly wants to use azd as the deployment tool, or the project already has an azure.yaml file. DO NOT USE FOR: non-azd deployments, Python App Service code-only deploys (use python-appservice-deploy), or cross-cloud migration (use azure-cloud-migrate). WHEN: prepare app for azd, create azure.yaml, set up azd infrastructure, modernize app for Azure with azd, deploy with azd, function app, timer trigger, service bus trigger, event-driven function, managed identity, generate Bicep, generate Terraform, create and deploy to Azure.
azure-ai
microsoft/azure-skills
Use for Azure AI: Search, Speech, OpenAI, Document Intelligence. Helps with search, vector/hybrid search, speech-to-text, text-to-speech, transcription, OCR. WHEN: AI Search, query search, vector search, hybrid search, semantic search, speech-to-text, text-to-speech, transcribe, OCR, convert text to speech.
azure-deploy
microsoft/azure-skills
Execute Azure deployments for ALREADY-PREPARED applications that have existing .azure/deployment-plan.md and infrastructure files. DO NOT use this skill when the user asks to CREATE a new application — use azure-prepare instead. This skill runs azd up, azd deploy, terraform apply, and az deployment commands with built-in error recovery. Requires .azure/deployment-plan.md from azure-prepare and validated status from azure-validate. WHEN: "run azd up", "run azd deploy", "execute deployment", "push to production", "push to cloud", "go live", "ship it", "bicep deploy", "terraform apply", "publish to Azure", "launch on Azure". DO NOT USE WHEN: "create and deploy", "build and deploy", "create a new app", "set up infrastructure", "create and deploy to Azure using Terraform" — use azure-prepare for these.
azure-validate
microsoft/azure-skills
Pre-deployment validation for Azure readiness. Run deep checks on configuration, infrastructure (Bicep or Terraform), RBAC role assignments, managed identity permissions, and prerequisites before deploying. WHEN: validate my app, check deployment readiness, run preflight checks, verify configuration, check if ready to deploy, validate azure.yaml, validate Bicep, test before deploying, troubleshoot deployment errors, validate Azure Functions, validate function app, validate serverless deployment, verify RBAC roles, check role assignments, review managed identity permissions, what-if analysis, validate Container Apps deployment.