wranglerManage Cloudflare Workers, KV, D1, R2, and secrets using the Wrangler CLI. Use when deploying workers, managing databases, storing objects, or configuring Cloudflare resources. Covers worker deployment, KV namespaces, D1 SQL databases, R2 object storage, secrets management, and tailing logs.
Install via ClawdBot CLI:
clawdbot install Asleep123/wranglerManage Cloudflare Workers and associated services via the wrangler CLI.
npm install -g wrangler or use project-local npx wranglerwrangler login (opens browser for OAuth)wrangler whoami# Initialize new worker
wrangler init <name>
# Local development
wrangler dev [script]
# Deploy
wrangler deploy [script]
# List deployments
wrangler deployments list
# View deployment
wrangler deployments view [deployment-id]
# Rollback
wrangler rollback [version-id]
# Delete worker
wrangler delete [name]
# Tail logs (live)
wrangler tail [worker]
# Add/update secret (interactive)
wrangler secret put <key>
# Add secret from stdin
echo "value" | wrangler secret put <key>
# List secrets
wrangler secret list
# Delete secret
wrangler secret delete <key>
# Bulk upload from JSON file
wrangler secret bulk secrets.json
# Create namespace
wrangler kv namespace create <name>
# List namespaces
wrangler kv namespace list
# Delete namespace
wrangler kv namespace delete --namespace-id <id>
# Put key
wrangler kv key put <key> <value> --namespace-id <id>
# Get key
wrangler kv key get <key> --namespace-id <id>
# Delete key
wrangler kv key delete <key> --namespace-id <id>
# List keys
wrangler kv key list --namespace-id <id>
# Bulk operations (JSON file)
wrangler kv bulk put <file> --namespace-id <id>
wrangler kv bulk delete <file> --namespace-id <id>
# Create database
wrangler d1 create <name>
# List databases
wrangler d1 list
# Database info
wrangler d1 info <name>
# Execute SQL
wrangler d1 execute <database> --command "SELECT * FROM users"
# Execute SQL file
wrangler d1 execute <database> --file schema.sql
# Local execution (for dev)
wrangler d1 execute <database> --local --command "..."
# Export database
wrangler d1 export <name> --output backup.sql
# Delete database
wrangler d1 delete <name>
# Migrations
wrangler d1 migrations create <database> <name>
wrangler d1 migrations apply <database>
wrangler d1 migrations list <database>
# Create bucket
wrangler r2 bucket create <name>
# List buckets
wrangler r2 bucket list
# Delete bucket
wrangler r2 bucket delete <name>
# Upload object
wrangler r2 object put <bucket>/<key> --file <path>
# Download object
wrangler r2 object get <bucket>/<key> --file <path>
# Delete object
wrangler r2 object delete <bucket>/<key>
# Create queue
wrangler queues create <name>
# List queues
wrangler queues list
# Delete queue
wrangler queues delete <name>
Wrangler supports both TOML and JSON/JSONC config formats:
wrangler.toml — traditional formatwrangler.json or wrangler.jsonc — newer, with JSON schema support⚠️ Important: If both exist, JSON takes precedence. Pick one format to avoid confusion where edits to TOML are ignored.
{
"$schema": "./node_modules/wrangler/config-schema.json",
"name": "my-worker",
"main": "src/index.ts",
"compatibility_date": "2024-12-30"
}
name = "my-worker"
main = "src/index.ts"
compatibility_date = "2024-12-30"
With bindings:
name = "my-worker"
main = "src/index.ts"
compatibility_date = "2024-12-30"
# KV binding
[[kv_namespaces]]
binding = "MY_KV"
id = "xxx"
# D1 binding
[[d1_databases]]
binding = "DB"
database_name = "my-db"
database_id = "xxx"
# R2 binding
[[r2_buckets]]
binding = "BUCKET"
bucket_name = "my-bucket"
# Environment variables
[vars]
API_URL = "https://api.example.com"
# Secrets (set via `wrangler secret put`)
# Referenced as env.SECRET_NAME in worker code
Static assets (for frameworks like Next.js):
name = "my-site"
main = ".open-next/worker.js"
compatibility_date = "2024-12-30"
compatibility_flags = ["nodejs_compat"]
[assets]
directory = ".open-next/assets"
binding = "ASSETS"
wrangler deploy -e production
wrangler deploy -e staging
Custom domains must be configured in the Cloudflare dashboard under Worker Settings > Domains & Routes, or via the Cloudflare API. Wrangler doesn't directly manage custom domains.
# Creates local D1/KV/R2 for dev
wrangler dev --local
wrangler deployments list
wrangler deployments view
For DNS/domain management, see the cloudflare skill (uses Cloudflare API directly).
| Issue | Solution |
|-------|----------|
| "Not authenticated" | Run wrangler login |
| Node version error | Requires Node.js v20+ |
| "No config found" | Ensure config file exists (wrangler.toml or wrangler.jsonc) or use -c path/to/config |
| Config changes ignored | Check for wrangler.json/wrangler.jsonc — JSON takes precedence over TOML |
| Binding not found | Check wrangler.toml bindings match code references |
Generated Mar 1, 2026
A startup needs to quickly deploy a scalable API for their web application using Cloudflare Workers. They use wrangler to initialize, develop locally with wrangler dev, and deploy the worker, handling API routes and logic without managing servers. This enables rapid iteration and global distribution with low latency.
An e-commerce platform uses Cloudflare KV to store product metadata like prices and inventory levels, with D1 for customer orders and user data. Wrangler helps create and manage these resources, allowing bulk operations for KV updates and SQL queries for order processing, ensuring fast access and data consistency.
A media company hosts a static website using R2 for asset storage and Workers for dynamic elements like user comments or live updates. Wrangler is used to deploy the worker, manage R2 buckets for images and videos, and configure bindings to integrate storage with the worker logic for a performant site.
A fintech application requires secure management of API keys and tokens for third-party services. Using wrangler secret commands, they add, list, and update secrets interactively or via bulk uploads, ensuring sensitive data is encrypted and accessible only to the deployed workers without exposing it in code.
A logistics company uses Cloudflare Queues to handle asynchronous tasks like order processing or shipment updates. Wrangler helps create and manage queues, integrating them with Workers to offload heavy computations, improving reliability and scalability for real-time tracking and notifications.
A company offers a cloud-based service using Workers for backend logic, with tiered pricing based on usage (e.g., API calls, storage). Wrangler enables easy deployment and management of workers and resources like D1 and R2, allowing rapid feature updates and scaling to support paying subscribers.
A platform provides free tools for developers to build and test applications with Cloudflare services, using wrangler for deployment and resource management. Revenue comes from premium features like advanced analytics, higher limits, or dedicated support, leveraging wrangler's efficiency to reduce operational costs.
A media business hosts content on R2 and serves it via Workers, using wrangler to manage storage and deployment. They generate revenue through ads, subscriptions, or pay-per-view models, with wrangler helping optimize performance and costs for global content distribution.
💬 Integration Tip
Use wrangler dev with local bindings to test D1, KV, and R2 integrations before deployment, ensuring configurations in wrangler.toml or wrangler.jsonc match code references to avoid binding errors.
Automatically update Clawdbot and all installed skills once daily. Runs via cron, checks for updates, applies them, and messages the user with a summary of what changed.
Full desktop computer use for headless Linux servers. Xvfb + XFCE virtual desktop with xdotool automation. 17 actions (click, type, scroll, screenshot, drag,...
Essential Docker commands and workflows for container management, image operations, and debugging.
Tool discovery and shell one-liner reference for sysadmin, DevOps, and security tasks. AUTO-CONSULT this skill when the user is: troubleshooting network issues, debugging processes, analyzing logs, working with SSL/TLS, managing DNS, testing HTTP endpoints, auditing security, working with containers, writing shell scripts, or asks 'what tool should I use for X'. Source: github.com/trimstray/the-book-of-secret-knowledge
Deploy applications and manage projects with complete CLI reference. Commands for deployments, projects, domains, environment variables, and live documentation access.
Monitor topics of interest and proactively alert when important developments occur. Use when user wants automated monitoring of specific subjects (e.g., product releases, price changes, news topics, technology updates). Supports scheduled web searches, AI-powered importance scoring, smart alerts vs weekly digests, and memory-aware contextual summaries.