Update to Cloudflare
Snapshot Nov 4, 2026 · 12:08 UTC · version 1.0.4
Collection source: downloaded plugin package. These snapshots do not have a confirmed matching collection source. Differences in file lists alone do not establish changes to the package.
Instructions updated for wrangler
Full description — Now says: Run or troubleshoot Wrangler CLI commands in projects that have a wrangler.jsonc, wrangler.json, or wrangler.toml file, including local development,...
Observed in instructions or declared skills. Runtime behavior has not been tested.
Up to 3 plugins free · no card required.
All fields and original values.
Full description
Oct 1, 2026 · 00:02 UTC
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 s...
Nov 4, 2026 · 12:08 UTC
Run or troubleshoot Wrangler CLI commands in projects that have a wrangler.jsonc, wrangler.json, or wrangler.toml file, including local development, Previews, deployment, and resource management. For new projects and projects without a W...
Skill instructions
Oct 1, 2026 · 00:02 UTC
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 s...
Nov 4, 2026 · 12:08 UTC
Run or troubleshoot Wrangler CLI commands in projects that have a wrangler.jsonc, wrangler.json, or wrangler.toml file, including local development, Previews, deployment, and resource management. For new projects and projects without a W...
Supporting files
Oct 1, 2026 · 00:02 UTC
[]
Nov 4, 2026 · 12:08 UTC
[{"relative_path":"references/skill-feedback.md","size_in_bytes":2781}]
Compare saved observations
Download comparison JSONSKILL.md text changes
− removed · + added
--- before +++ after @@ -1,922 +1,75 @@ --- 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. +description: Run or troubleshoot Wrangler CLI commands in projects that have a wrangler.jsonc, wrangler.json, or wrangler.toml file, including local development, Previews, deployment, and resource management. For new projects and projects without a Wrangler configuration file, use the cf CLI instead. --- # Wrangler CLI -Your knowledge of Wrangler CLI flags, config fields, and subcommands may be outdated. **Prefer retrieval over pre-training** for any Wrangler task. +Use this skill only when the project has `wrangler.jsonc`, `wrangler.json`, or `wrangler.toml` and no `cloudflare.config.ts`, or when the user asks for Wrangler. For a new project, a project with `cloudflare.config.ts`, or a project with no Cloudflare configuration, use the Cloudflare CLI (`cf`) instead: load the `cf-cli` skill if it is installed, or follow [Use cf with coding agents](https://developers.cloudflare.com/cf/agents/index.md). Do not add Wrangler to those projects. -## Retrieval Sources +Use the project's Wrangler version and retrieve the relevant documentation before writing commands or configuration. CLI flags and configuration fields change; do not rely on memorized examples. -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. +## Inspect the Project -| 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 | +- Find the package manager, installed Wrangler version, package scripts, framework, and Wrangler config. Run commands through the project's scripts or package manager so they use its local version. Install dependencies using the existing lockfile when needed; do not silently upgrade Wrangler to match current docs. If the project has a Wrangler configuration file but Wrangler is not a dependency, follow the [installation guide](https://developers.cloudflare.com/workers/wrangler/install-and-update/index.md) to add it locally. +- Identify the config used by the build or deploy command, including framework-generated config. Edit its source rather than generated output. +- Establish the target account, Worker, environment, and resource before running commands that change them. For data operations, determine whether the target is local or remote. -## FIRST: Check if Wrangler is installed, and if not, install it +## Retrieve What the Task Needs -Check if Wrangler is installed by running: +Use the Cloudflare MCP `docs` tool if available, or fetch the relevant linked page directly. Follow links to the specific command or product involved; avoid loading the entire reference. If a page moves, rediscover it through the [Wrangler command index](https://developers.cloudflare.com/workers/wrangler/commands/index.md) or Cloudflare docs search. -```bash -wrangler --version # Requires v4.x+ -``` +| Task | Source | +| --- | --- | +| Discover commands and flags, including resource management, deployments, rollback, and diagnostics | Project-local `wrangler --help` and `wrangler <command> --help`; [command reference](https://developers.cloudflare.com/workers/wrangler/commands/index.md) | +| Edit config or add a binding | Installed `wrangler/config-schema.json` (usually under `node_modules`); [configuration reference](https://developers.cloudflare.com/workers/wrangler/configuration/index.md) | +| Deploy a framework application | [Framework guides](https://developers.cloudflare.com/workers/framework-guides/index.md); follow the guide for the project's existing framework and adapter | +| Migrate an application to Workers when requested | [Pages to Workers](https://developers.cloudflare.com/workers/static-assets/migration-guides/migrate-from-pages/index.md); [Vercel to Workers](https://developers.cloudflare.com/workers/static-assets/migration-guides/vercel-to-workers/index.md) | +| Configure staging or production | [Environments](https://developers.cloudflare.com/workers/wrangler/environments/index.md) | +| Set secrets locally, in CI, or on a deployed Worker | [Secrets](https://developers.cloudflare.com/workers/configuration/secrets/index.md) | +| Generate binding and runtime types | [TypeScript](https://developers.cloudflare.com/workers/languages/typescript/index.md) | +| Run locally or choose a testing approach | [Local development](https://developers.cloudflare.com/workers/local-development/index.md); [testing](https://developers.cloudflare.com/workers/testing/index.md) | +| Choose roles, scopes, or API token permissions for Wrangler | [Roles and permissions](https://developers.cloudflare.com/workers/authorization/index.md); [Workers roles and permissions](https://developers.cloudflare.com/workers/authorization/workers/index.md#wrangler) | +| Create or manage a branch or pull request environment | [Previews overview](https://developers.cloudflare.com/workers/previews/index.md); [get started](https://developers.cloudflare.com/workers/previews/get-started/index.md); [configuration](https://developers.cloudflare.com/workers/previews/configuration/index.md) | +| Decide whether Preview resources are isolated or shared | [Resources and isolation](https://developers.cloudflare.com/workers/previews/resources/index.md), including its current limitations | +| Configure Preview URLs, access, debugging, or CI | [Custom domains](https://developers.cloudflare.com/workers/previews/custom-domains/index.md); [test and debug](https://developers.cloudflare.com/workers/previews/test-and-debug/index.md); [examples](https://developers.cloudflare.com/workers/previews/examples/index.md) | +| Choose between Previews, Version URLs, and Wrangler environments | [Compare workflows](https://developers.cloudflare.com/workers/previews/compare-workflows/index.md) | +| Diagnose authentication or select an account | [General commands](https://developers.cloudflare.com/workers/wrangler/commands/general/index.md), including `whoami`; [authentication profiles](https://developers.cloudflare.com/workers/wrangler/profiles/index.md) | +| Deploy an unauthenticated prototype | [Claim deployments](https://developers.cloudflare.com/workers/platform/claim-deployments/index.md) for eligibility, expiry, and claim URL handling; use a permanent account for production or CI | -If Wrangler is not installed, you should install it by running: +Use installed help and schema to check whether documented features exist in the project's version. If a required feature needs an upgrade, make that dependency explicit. If retrieval is unavailable, state the gap and use available local evidence rather than inventing syntax. -```bash -npm install -D wrangler@latest -``` +## Apply the Change -Wherever possible, you should use Wrangler instead of manually constructing API requests. +- Prefer `wrangler.jsonc` for new config. Set a new project's [compatibility date](https://developers.cloudflare.com/workers/configuration/compatibility-dates/index.md) to today; review runtime changes and test when advancing an existing project's date. Preserve existing project conventions and avoid incidental format migrations. +- Check environment inheritance before adding bindings or variables. Some fields must be specified separately for each environment; a working default config does not establish that staging is configured. +- With the Cloudflare Vite plugin, select the environment via `CLOUDFLARE_ENV` at dev or build time. Deploy the resulting build; setting an environment at deploy time does not retarget its flattened config. See [Vite environments](https://developers.cloudflare.com/workers/vite-plugin/reference/cloudflare-environments/index.md). +- Reconcile dashboard changes with the config before deploying: Wrangler can overwrite dashboard variables and routes. When binding existing resources, verify their identifiers; omitted identifiers can trigger [automatic provisioning](https://developers.cloudflare.com/workers/wrangler/configuration/index.md#automatic-provisioning). +- Distinguish local simulation from remote bindings during development. A locally running Worker can still access real resources; check the selected bindings before testing writes. +- Before a remote command, identify the authenticated member or API token and retrieve the current role and scope required for the exact operation. Prefer the narrowest scope that satisfies the user's intent. The `wrangler login` OAuth flow does not support granular authorization; use an account-owned API token when granular access is required, and never ask the user to paste its value into chat. +- Keep secret values out of command arguments, source code, and logs. Use the documented interactive input or protected file/stdin mechanism for the command. Local secret files must be ignored by version control and are not automatically uploaded as deployed secrets. For missing local secrets, check file precedence and any `secrets.required` declaration in the secrets docs. +- Treat `wrangler secret put` and `secret delete` as deployments: they create a version and deploy it immediately. Use the documented `wrangler versions secret` workflow when the change must be staged. +- Before a rollback, check [rollback limitations](https://developers.cloudflare.com/workers/versions-and-deployments/rollbacks/index.md): connected resources and their data are not rolled back with Worker code. -## Key Guidelines +## Work with Workers Previews -- **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. +- Workers Previews requires project-local Wrangler 4.135.0 or later; project commands do not use a newer global installation. Check the project's pinned version and make any required dependency upgrade explicit. +- Use Previews for branch and pull request environments under the same Worker. Use Version URLs to inspect a specific uploaded version with production resources, and Wrangler environments for persistent, separately deployed Workers. Follow [Compare workflows](https://developers.cloudflare.com/workers/previews/compare-workflows/index.md) rather than adapting an older aliased Version URL workflow. +- First inspect how the user manages production configuration and deployments. Configure Preview domains through the same configuration system as production, such as Wrangler, the dashboard, or Terraform. Run Preview deployments through the user's existing path, such as the local CLI, Workers Builds, or external CI, unless the user requests a different workflow. Mirror the management approach, not production resource bindings or data. +- Before deploying, follow the current [configuration placement table](https://developers.cloudflare.com/workers/previews/configuration/index.md#what-goes-in-the-previews-block) and [resource matrix and limitations](https://developers.cloudflare.com/workers/previews/resources/index.md). Do not infer isolation from the Preview name or allow writes to production resources unless the user explicitly intends to share them. +- Tell the user that Preview URLs are public unless access controls are configured, then let them decide whether to protect the URLs. Follow the [custom domain and access guidance](https://developers.cloudflare.com/workers/previews/custom-domains/index.md) for the chosen setup. +- Confirm which Worker or Wrangler environment the user intends to target. When targeting a Wrangler environment, pass the same `--env` value to every Preview command; omitting it targets the top-level Worker. -## Quick Start: New Worker +## Validate -```bash -# Initialize new project -npx wrangler init my-worker +After changing config or bindings in a TypeScript project, regenerate types with the project's `wrangler types` command rather than hand-editing generated declarations. Run the relevant existing typecheck or tests. -# Or with a framework -npx create-cloudflare@latest my-app -``` +For deployment changes, use the project's build workflow and `wrangler deploy --dry-run` where supported, with the intended config and environment. A successful dry run checks the build and packaging; it does not prove remote resources or runtime behavior work. Use task-specific local or remote checks as appropriate to the requested work. -## Quick Reference: Core Commands +For Previews, a returned URL does not validate behavior that depends on bindings Wrangler reports as missing. Validate the behavior the user requested, using Preview-specific logs and configuration when needed. Writes to production resources, destructive testing, and deletion of named Previews must match the user's explicit intent. -| 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` | +Report what changed, the target environment, checks performed, and any unresolved validation gaps. Link the documentation used when the result depends on current command or configuration behavior. ---- - -## Configuration (wrangler.jsonc) - -### Minimal Config - -```jsonc -{ - "$schema": "./node_modules/wrangler/config-schema.json", - "name": "my-worker", - "main": "src/index.ts", - "compatibility_date": "2026-01-01" -} -``` - -### Full Config with Bindings - -```jsonc -{ - "$schema": "./node_modules/wrangler/config-schema.json", - "name": "my-worker", - "main": "src/index.ts", - "compatibility_date": "2026-01-01", - "compatibility_flags": ["nodejs_compat"], - - // 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 - -```bash -# 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 - -```bash -# 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: - -```jsonc -{ - "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 - -```bash -# 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 - -> **Security**: Never pass secret values as command arguments or pipe them via `echo`. -> Use the interactive prompt (preferred), pipe from a file, or use `secret bulk`. -> Never output, log, or hardcode secret values in commands. - -```bash -# Set secret — interactive prompt (preferred, wrangler will ask for the value securely) -wrangler secret put API_KEY - -# Set secret from a file (useful for PEM keys, CI environments) -wrangler secret put PRIVATE_KEY < path/to/private-key.pem - -# List secrets -wrangler secret list - -# Delete secret -wrangler secret delete API_KEY - -# Bulk secrets from JSON file (do not commit this file to version control) -wrangler secret bulk secrets.json -``` - -### Versions and Rollback - -```bash -# 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 - -```bash -# 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 - -```bash -# 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 - -```jsonc -{ - "kv_namespaces": [ - { "binding": "CACHE", "id": "<NAMESPACE_ID>" } - ] -} -``` - ---- - -## R2 (Object Storage) - -### Manage Buckets - -```bash -# 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 - -```bash -# 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 - -```jsonc -{ - "r2_buckets": [ - { "binding": "ASSETS", "bucket_name": "my-bucket" } - ] -} -``` - ---- - -## D1 (SQL Database) - -### Manage Databases - -```bash -# 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 - -```bash -# 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 - -```bash -# 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 - -```bash -# 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 - -```jsonc -{ - "d1_databases": [ - { - "binding": "DB", - "database_name": "my-database", - "database_id": "<DATABASE_ID>", - "migrations_dir": "./migrations" - } - ] -} -``` - ---- - -## Vectorize (Vector Database) - -### Manage Indexes - -```bash -# 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 - -```bash -# 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 - -```jsonc -{ - "vectorize": [ - { "binding": "SEARCH_INDEX", "index_name": "my-index" } - ] -} -``` - ---- - -## Hyperdrive (Database Accelerator) - -### Manage Configs - -```bash -# Create config -wrangler hyperdrive create my-hyperdrive \ - --origin-host db.example.com \ - --origin-port 5432 \ - --database my-database \ - --origin-user db-user \ - --origin-password "$DB_PASSWORD" - -# Or using a connection string from an environment variable -wrangler hyperdrive create my-hyperdrive \ - --connection-string "$HYPERDRIVE_CONNECTION_STRING" - -# List configs -wrangler hyperdrive list - -# Get config details -wrangler hyperdrive get <HYPERDRIVE_ID> - -# Update config -wrangler hyperdrive update <HYPERDRIVE_ID> \ - --origin-password "$DB_PASSWORD" - -# Delete config -wrangler hyperdrive delete <HYPERDRIVE_ID> -``` - -### Config Binding - -```jsonc -{ - "compatibility_flags": ["nodejs_compat"], - "hyperdrive": [ - { "binding": "HYPERDRIVE", "id": "<HYPERDRIVE_ID>" } - ] -} -``` - ---- - -## Workers AI - -### List Models - -```bash -# List available models -wrangler ai models - -# List finetunes -wrangler ai finetune list -``` - -### Config Binding - -```jsonc -{ - "ai": { "binding": "AI" } -} -``` - -**Note**: Workers AI always runs remotely and incurs usage charges even in local dev. - ---- - -## Queues - -### Manage Queues - -```bash -# 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 - -```jsonc -{ - "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 - -```bash -# 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 - -```bash -# List containers -wrangler containers list - -# Get container info -wrangler containers info <CONTAINER_ID> - -# Delete container -wrangler containers delete <CONTAINER_ID> -``` - -### Manage Images - -```bash -# List images in registry -wrangler containers images list - -# Delete image -wrangler containers images delete my-app:latest -``` - -### Manage External Registries - -> **Security**: Never hardcode registry credentials in commands. Use environment variables. - -```bash -# List configured registries -wrangler containers registries list - -# Configure external registry (e.g., ECR) -wrangler containers registries configure <DOMAIN> \ - --aws-access-key-id "$AWS_ACCESS_KEY_ID" - -# Configure DockerHub -wrangler containers registries configure <DOMAIN> \ - --dockerhub-username "$DOCKERHUB_USERNAME" - -# Delete registry configuration -wrangler containers registries delete <DOMAIN> -``` - ---- - -## Workflows - -### Manage Workflows - -```bash -# 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 - -```bash -# 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 - -```jsonc -{ - "workflows": [ - { - "binding": "MY_WORKFLOW", - "name": "my-workflow", - "class_name": "MyWorkflow" - } - ] -} -``` - ---- - -## Pipelines - -### Manage Pipelines - -```bash -# 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 - -```jsonc -{ - "pipelines": [ - { "binding": "MY_PIPELINE", "pipeline": "my-pipeline" } - ] -} -``` - ---- - -## Secrets Store - -### Manage Stores - -```bash -# 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 - -```bash -# 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 - -```jsonc -{ - "secrets_store_secrets": [ - { - "binding": "MY_SECRET", - "store_id": "<STORE_ID>", - "secret_name": "my-secret" - } - ] -} -``` - ---- - -## Pages (Frontend Deployment) - -```bash -# 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 - -```bash -# 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 - -```jsonc -{ - "observability": { - "enabled": true, - "head_sampling_rate": 1 - } -} -``` - ---- - -## Testing - -### Local Testing with Vitest - -```bash -npm install -D @cloudflare/vitest-pool-workers vitest -``` - -`vitest.config.ts`: -```typescript -import { defineWorkersConfig } from "@cloudflare/vitest-pool-workers/config"; - -export default defineWorkersConfig({ - test: { - poolOptions: { - workers: { - wrangler: { configPath: "./wrangler.jsonc" }, - }, - }, - }, -}); -``` - -### Test Scheduled Events - -```bash -# 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` | -| Startup time limit exceeded | Run `wrangler check startup` to profile startup and generate CPU profiles | -| 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 - -```bash -# Check auth status -wrangler whoami - -# Profile Worker startup time -wrangler check startup - -# View config schema -wrangler docs configuration -``` - ---- - -## Best Practices +## Skill feedback -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. +If the user reports that this skill gave incorrect or outdated guidance, or is missing information, read [references/skill-feedback.md](references/skill-feedback.md).
Full technical diff · 3 changed fields
changed /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."
"Run or troubleshoot Wrangler CLI commands in projects that have a wrangler.jsonc, wrangler.json, or wrangler.toml file, including local development, Previews, deployment, and resource management. For new projects and projects without a Wrangler configuration file, use the cf CLI instead."
changed /included_files
[]
[
{
"relative_path": "references/skill-feedback.md",
"size_in_bytes": 2781
}
]changed /skill_md_contents
"---\nname: wrangler\ndescription: 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.\n---\n\n# Wrangler CLI\n\nYour knowledge of Wrangler CLI flags, config fields, and subcommands may be outdated. **Prefer retrieval over pre-training** for any Wrangler task.\n\n## Retrieval Sources\n\nFetch 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.\n\n| Source | How to retrieve | Use for |\n|--------|----------------|---------|\n| Wrangler docs | `https://developers.cloudflare.com/workers/wrangler/` | CLI commands, flags, config reference |\n| Wrangler config schema | `node_modules/wrangler/config-schema.json` | Config fields, binding shapes, allowed values |\n| Cloudflare docs | Search tool or `https://developers.cloudflare.com/workers/` | API reference, compatibility dates/flags |\n\n## FIRST: Check if Wrangler is installed, and if not, install it\n\nCheck if Wrangler is installed by running:\n\n```bash\nwrangler --version # Requires v4.x+\n```\n\nIf Wrangler is not installed, you should install it by running:\n\n```bash\nnpm install -D wrangler@latest\n```\n\nWherever possible, you should use Wrangler instead of manually constructing API requests.\n\n## Key Guidelines\n\n- **Use `wrangler.jsonc`**: Prefer JSON config over TOML. Newer features are JSON-only.\n- **Set `compatibility_date`**: Use a recent date (within 30 days). Check https://developers.cloudflare.com/workers/configuration/compatibility-dates/\n- **Generate types after config changes**: Run `wrangler types` to update TypeScript bindings.\n- **Local dev defaults to local storage**: Bindings use local simulation unless `remote: true`.\n- **Profile Worker startup**: Run `wrangler check startup` to measure startup time and detect scripts that exceed the startup time limit.\n- **Use environments for staging/prod**: Define `env.staging` and `env.production` in config.\n\n## Quick Start: New Worker\n\n```bash\n# Initialize new project\nnpx wrangler init my-worker\n\n# Or with a framework\nnpx create-cloudflare@latest my-app\n```\n\n## Quick Reference: Core Commands\n\n| Task | Command |\n|------|---------|\n| Start local dev server | `wrangler dev` |\n| Deploy to Cloudflare | `wrangler deploy` |\n| Deploy dry run | `wrangler deploy --dry-run` |\n| Generate TypeScript types | `wrangler types` |\n| Profile Worker startup time | `wrangler check startup` |\n| View live logs | `wrangler tail` |\n| Delete Worker | `wrangler delete` |\n| Auth status | `wrangler whoami` |\n\n---\n\n## Configuration (wrangler.jsonc)\n\n### Minimal Config\n\n```jsonc\n{\n \"$schema\": \"./node_modules/wrangler/config-schema.json\",\n \"name\": \"my-worker\",\n \"main\": \"src/index.ts\",\n \"compatibility_date\": \"2026-01-01\"\n}\n```\n\n### Full Config with Bindings\n\n```jsonc\n{\n \"$schema\": \"./node_modules/wrangler/config-schema.json\",\n \"name\": \"my-worker\",\n \"main\": \"src/index.ts\",\n \"compatibility_date\": \"2026-01-01\",\n \"compatibility_flags\": [\"nodejs_compat\"],\n\n // Environment variables\n \"vars\": {\n \"ENVIRONMENT\": \"production\"\n },\n\n // KV Namespace\n \"kv_namespaces\": [\n { \"binding\": \"KV\", \"id\": \"<KV_NAMESPACE_ID>\" }\n ],\n\n // R2 Bucket\n \"r2_buckets\": [\n { \"binding\": \"BUCKET\", \"bucket_name\": \"my-bucket\" }\n ],\n\n // D1 Database\n \"d1_databases\": [\n { \"binding\": \"DB\", \"database_name\": \"my-db\", \"database_id\": \"<DB_ID>\" }\n ],\n\n // Workers AI (always remote)\n \"ai\": { \"binding\": \"AI\" },\n\n // Vectorize\n \"vectorize\": [\n { \"binding\": \"VECTOR_INDEX\", \"index_name\": \"my-index\" }\n ],\n\n // Hyperdrive\n \"hyperdrive\": [\n { \"binding\": \"HYPERDRIVE\", \"id\": \"<HYPERDRIVE_ID>\" }\n ],\n\n // Durable Objects\n \"durable_objects\": {\n \"bindings\": [\n { \"name\": \"COUNTER\", \"class_name\": \"Counter\" }\n ]\n },\n\n // Cron triggers\n \"triggers\": {\n \"crons\": [\"0 * * * *\"]\n },\n\n // Environments\n \"env\": {\n \"staging\": {\n \"name\": \"my-worker-staging\",\n \"vars\": { \"ENVIRONMENT\": \"staging\" }\n }\n }\n}\n```\n\n### Generate Types from Config\n\n```bash\n# Generate worker-configuration.d.ts\nwrangler types\n\n# Custom output path\nwrangler types ./src/env.d.ts\n\n# Check types are up to date (CI)\nwrangler types --check\n```\n\n---\n\n## Local Development\n\n### Start Dev Server\n\n```bash\n# Local mode (default) - uses local storage simulation\nwrangler dev\n\n# With specific environment\nwrangler dev --env staging\n\n# Force local-only (disable remote bindings)\nwrangler dev --local\n\n# Remote mode - runs on Cloudflare edge (legacy)\nwrangler dev --remote\n\n# Custom port\nwrangler dev --port 8787\n\n# Live reload for HTML changes\nwrangler dev --live-reload\n\n# Test scheduled/cron handlers\nwrangler dev --test-scheduled\n# Then visit: http://localhost:8787/__scheduled\n```\n\n### Remote Bindings for Local Dev\n\nUse `remote: true` in binding config to connect to real resources while running locally:\n\n```jsonc\n{\n \"r2_buckets\": [\n { \"binding\": \"BUCKET\", \"bucket_name\": \"my-bucket\", \"remote\": true }\n ],\n \"ai\": { \"binding\": \"AI\", \"remote\": true },\n \"vectorize\": [\n { \"binding\": \"INDEX\", \"index_name\": \"my-index\", \"remote\": true }\n ]\n}\n```\n\n**Recommended remote bindings**: AI (required), Vectorize, Browser Rendering, mTLS, Images.\n\n### Local Secrets\n\nCreate `.dev.vars` for local development secrets:\n\n```\nAPI_KEY=local-dev-key\nDATABASE_URL=postgres://localhost:5432/dev\n```\n\n---\n\n## Deployment\n\n### Deploy Worker\n\n```bash\n# Deploy to production\nwrangler deploy\n\n# Deploy specific environment\nwrangler deploy --env staging\n\n# Dry run (validate without deploying)\nwrangler deploy --dry-run\n\n# Keep dashboard-set variables\nwrangler deploy --keep-vars\n\n# Minify code\nwrangler deploy --minify\n```\n\n### Manage Secrets\n\n> **Security**: Never pass secret values as command arguments or pipe them via `echo`.\n> Use the interactive prompt (preferred), pipe from a file, or use `secret bulk`.\n> Never output, log, or hardcode secret values in commands.\n\n```bash\n# Set secret — interactive prompt (preferred, wrangler will ask for the value securely)\nwrangler secret put API_KEY\n\n# Set secret from a file (useful for PEM keys, CI environments)\nwrangler secret put PRIVATE_KEY < path/to/private-key.pem\n\n# List secrets\nwrangler secret list\n\n# Delete secret\nwrangler secret delete API_KEY\n\n# Bulk secrets from JSON file (do not commit this file to version control)\nwrangler secret bulk secrets.json\n```\n\n### Versions and Rollback\n\n```bash\n# List recent versions\nwrangler versions list\n\n# View specific version\nwrangler versions view <VERSION_ID>\n\n# Rollback to previous version\nwrangler rollback\n\n# Rollback to specific version\nwrangler rollback <VERSION_ID>\n```\n\n---\n\n## KV (Key-Value Store)\n\n### Manage Namespaces\n\n```bash\n# Create namespace\nwrangler kv namespace create MY_KV\n\n# List namespaces\nwrangler kv namespace list\n\n# Delete namespace\nwrangler kv namespace delete --namespace-id <ID>\n```\n\n### Manage Keys\n\n```bash\n# Put value\nwrangler kv key put --namespace-id <ID> \"key\" \"value\"\n\n# Put with expiration (seconds)\nwrangler kv key put --namespace-id <ID> \"key\" \"value\" --expiration-ttl 3600\n\n# Get value\nwrangler kv key get --namespace-id <ID> \"key\"\n\n# List keys\nwrangler kv key list --namespace-id <ID>\n\n# Delete key\nwrangler kv key delete --namespace-id <ID> \"key\"\n\n# Bulk put from JSON\nwrangler kv bulk put --namespace-id <ID> data.json\n```\n\n### Config Binding\n\n```jsonc\n{\n \"kv_namespaces\": [\n { \"binding\": \"CACHE\", \"id\": \"<NAMESPACE_ID>\" }\n ]\n}\n```\n\n---\n\n## R2 (Object Storage)\n\n### Manage Buckets\n\n```bash\n# Create bucket\nwrangler r2 bucket create my-bucket\n\n# Create with location hint\nwrangler r2 bucket create my-bucket --location wnam\n\n# List buckets\nwrangler r2 bucket list\n\n# Get bucket info\nwrangler r2 bucket info my-bucket\n\n# Delete bucket\nwrangler r2 bucket delete my-bucket\n```\n\n### Manage Objects\n\n```bash\n# Upload object\nwrangler r2 object put my-bucket/path/file.txt --file ./local-file.txt\n\n# Download object\nwrangler r2 object get my-bucket/path/file.txt\n\n# Delete object\nwrangler r2 object delete my-bucket/path/file.txt\n```\n\n### Config Binding\n\n```jsonc\n{\n \"r2_buckets\": [\n { \"binding\": \"ASSETS\", \"bucket_name\": \"my-bucket\" }\n ]\n}\n```\n\n---\n\n## D1 (SQL Database)\n\n### Manage Databases\n\n```bash\n# Create database\nwrangler d1 create my-database\n\n# Create with location\nwrangler d1 create my-database --location wnam\n\n# List databases\nwrangler d1 list\n\n# Get database info\nwrangler d1 info my-database\n\n# Delete database\nwrangler d1 delete my-database\n```\n\n### Execute SQL\n\n```bash\n# Execute SQL command (remote)\nwrangler d1 execute my-database --remote --command \"SELECT * FROM users\"\n\n# Execute SQL file (remote)\nwrangler d1 execute my-database --remote --file ./schema.sql\n\n# Execute locally\nwrangler d1 execute my-database --local --command \"SELECT * FROM users\"\n```\n\n### Migrations\n\n```bash\n# Create migration\nwrangler d1 migrations create my-database create_users_table\n\n# List pending migrations\nwrangler d1 migrations list my-database --local\n\n# Apply migrations locally\nwrangler d1 migrations apply my-database --local\n\n# Apply migrations to remote\nwrangler d1 migrations apply my-database --remote\n```\n\n### Export/Backup\n\n```bash\n# Export schema and data\nwrangler d1 export my-database --remote --output backup.sql\n\n# Export schema only\nwrangler d1 export my-database --remote --output schema.sql --no-data\n```\n\n### Config Binding\n\n```jsonc\n{\n \"d1_databases\": [\n {\n \"binding\": \"DB\",\n \"database_name\": \"my-database\",\n \"database_id\": \"<DATABASE_ID>\",\n \"migrations_dir\": \"./migrations\"\n }\n ]\n}\n```\n\n---\n\n## Vectorize (Vector Database)\n\n### Manage Indexes\n\n```bash\n# Create index with dimensions\nwrangler vectorize create my-index --dimensions 768 --metric cosine\n\n# Create with preset (auto-configures dimensions/metric)\nwrangler vectorize create my-index --preset @cf/baai/bge-base-en-v1.5\n\n# List indexes\nwrangler vectorize list\n\n# Get index info\nwrangler vectorize get my-index\n\n# Delete index\nwrangler vectorize delete my-index\n```\n\n### Manage Vectors\n\n```bash\n# Insert vectors from NDJSON file\nwrangler vectorize insert my-index --file vectors.ndjson\n\n# Query vectors\nwrangler vectorize query my-index --vector \"[0.1, 0.2, ...]\" --top-k 10\n```\n\n### Config Binding\n\n```jsonc\n{\n \"vectorize\": [\n { \"binding\": \"SEARCH_INDEX\", \"index_name\": \"my-index\" }\n ]\n}\n```\n\n---\n\n## Hyperdrive (Database Accelerator)\n\n### Manage Configs\n\n```bash\n# Create config\nwrangler hyperdrive create my-hyperdrive \\\n --origin-host db.example.com \\\n --origin-port 5432 \\\n --database my-database \\\n --origin-user db-user \\\n --origin-password \"$DB_PASSWORD\"\n\n# Or using a connection string from an environment variable\nwrangler hyperdrive create my-hyperdrive \\\n --connection-string \"$HYPERDRIVE_CONNECTION_STRING\"\n\n# List configs\nwrangler hyperdrive list\n\n# Get config details\nwrangler hyperdrive get <HYPERDRIVE_ID>\n\n# Update config\nwrangler hyperdrive update <HYPERDRIVE_ID> \\\n --origin-password \"$DB_PASSWORD\"\n\n# Delete config\nwrangler hyperdrive delete <HYPERDRIVE_ID>\n```\n\n### Config Binding\n\n```jsonc\n{\n \"compatibility_flags\": [\"nodejs_compat\"],\n \"hyperdrive\": [\n { \"binding\": \"HYPERDRIVE\", \"id\": \"<HYPERDRIVE_ID>\" }\n ]\n}\n```\n\n---\n\n## Workers AI\n\n### List Models\n\n```bash\n# List available models\nwrangler ai models\n\n# List finetunes\nwrangler ai finetune list\n```\n\n### Config Binding\n\n```jsonc\n{\n \"ai\": { \"binding\": \"AI\" }\n}\n```\n\n**Note**: Workers AI always runs remotely and incurs usage charges even in local dev.\n\n---\n\n## Queues\n\n### Manage Queues\n\n```bash\n# Create queue\nwrangler queues create my-queue\n\n# List queues\nwrangler queues list\n\n# Delete queue\nwrangler queues delete my-queue\n\n# Add consumer to queue\nwrangler queues consumer add my-queue my-worker\n\n# Remove consumer\nwrangler queues consumer remove my-queue my-worker\n```\n\n### Config Binding\n\n```jsonc\n{\n \"queues\": {\n \"producers\": [\n { \"binding\": \"MY_QUEUE\", \"queue\": \"my-queue\" }\n ],\n \"consumers\": [\n {\n \"queue\": \"my-queue\",\n \"max_batch_size\": 10,\n \"max_batch_timeout\": 30\n }\n ]\n }\n}\n```\n\n---\n\n## Containers\n\n### Build and Push Images\n\n```bash\n# Build container image\nwrangler containers build -t my-app:latest .\n\n# Build and push in one command\nwrangler containers build -t my-app:latest . --push\n\n# Push existing image to Cloudflare registry\nwrangler containers push my-app:latest\n```\n\n### Manage Containers\n\n```bash\n# List containers\nwrangler containers list\n\n# Get container info\nwrangler containers info <CONTAINER_ID>\n\n# Delete container\nwrangler containers delete <CONTAINER_ID>\n```\n\n### Manage Images\n\n```bash\n# List images in registry\nwrangler containers images list\n\n# Delete image\nwrangler containers images delete my-app:latest\n```\n\n### Manage External Registries\n\n> **Security**: Never hardcode registry credentials in commands. Use environment variables.\n\n```bash\n# List configured registries\nwrangler containers registries list\n\n# Configure external registry (e.g., ECR)\nwrangler containers registries configure <DOMAIN> \\\n --aws-access-key-id \"$AWS_ACCESS_KEY_ID\"\n\n# Configure DockerHub\nwrangler containers registries configure <DOMAIN> \\\n --dockerhub-username \"$DOCKERHUB_USERNAME\"\n\n# Delete registry configuration\nwrangler containers registries delete <DOMAIN>\n```\n\n---\n\n## Workflows\n\n### Manage Workflows\n\n```bash\n# List workflows\nwrangler workflows list\n\n# Describe workflow\nwrangler workflows describe my-workflow\n\n# Trigger workflow instance\nwrangler workflows trigger my-workflow\n\n# Trigger with parameters\nwrangler workflows trigger my-workflow --params '{\"key\": \"value\"}'\n\n# Delete workflow\nwrangler workflows delete my-workflow\n```\n\n### Manage Workflow Instances\n\n```bash\n# List instances\nwrangler workflows instances list my-workflow\n\n# Describe instance\nwrangler workflows instances describe my-workflow <INSTANCE_ID>\n\n# Terminate instance\nwrangler workflows instances terminate my-workflow <INSTANCE_ID>\n```\n\n### Config Binding\n\n```jsonc\n{\n \"workflows\": [\n {\n \"binding\": \"MY_WORKFLOW\",\n \"name\": \"my-workflow\",\n \"class_name\": \"MyWorkflow\"\n }\n ]\n}\n```\n\n---\n\n## Pipelines\n\n### Manage Pipelines\n\n```bash\n# Create pipeline\nwrangler pipelines create my-pipeline --r2 my-bucket\n\n# List pipelines\nwrangler pipelines list\n\n# Show pipeline details\nwrangler pipelines show my-pipeline\n\n# Update pipeline\nwrangler pipelines update my-pipeline --batch-max-mb 100\n\n# Delete pipeline\nwrangler pipelines delete my-pipeline\n```\n\n### Config Binding\n\n```jsonc\n{\n \"pipelines\": [\n { \"binding\": \"MY_PIPELINE\", \"pipeline\": \"my-pipeline\" }\n ]\n}\n```\n\n---\n\n## Secrets Store\n\n### Manage Stores\n\n```bash\n# Create store\nwrangler secrets-store store create my-store\n\n# List stores\nwrangler secrets-store store list\n\n# Delete store\nwrangler secrets-store store delete <STORE_ID>\n```\n\n### Manage Secrets in Store\n\n```bash\n# Add secret to store\nwrangler secrets-store secret put <STORE_ID> my-secret\n\n# List secrets in store\nwrangler secrets-store secret list <STORE_ID>\n\n# Get secret\nwrangler secrets-store secret get <STORE_ID> my-secret\n\n# Delete secret from store\nwrangler secrets-store secret delete <STORE_ID> my-secret\n```\n\n### Config Binding\n\n```jsonc\n{\n \"secrets_store_secrets\": [\n {\n \"binding\": \"MY_SECRET\",\n \"store_id\": \"<STORE_ID>\",\n \"secret_name\": \"my-secret\"\n }\n ]\n}\n```\n\n---\n\n## Pages (Frontend Deployment)\n\n```bash\n# Create Pages project\nwrangler pages project create my-site\n\n# Deploy directory to Pages\nwrangler pages deploy ./dist\n\n# Deploy with specific branch\nwrangler pages deploy ./dist --branch main\n\n# List deployments\nwrangler pages deployment list --project-name my-site\n```\n\n---\n\n## Observability\n\n### Tail Logs\n\n```bash\n# Stream live logs\nwrangler tail\n\n# Tail specific Worker\nwrangler tail my-worker\n\n# Filter by status\nwrangler tail --status error\n\n# Filter by search term\nwrangler tail --search \"error\"\n\n# JSON output\nwrangler tail --format json\n```\n\n### Config Logging\n\n```jsonc\n{\n \"observability\": {\n \"enabled\": true,\n \"head_sampling_rate\": 1\n }\n}\n```\n\n---\n\n## Testing\n\n### Local Testing with Vitest\n\n```bash\nnpm install -D @cloudflare/vitest-pool-workers vitest\n```\n\n`vitest.config.ts`:\n```typescript\nimport { defineWorkersConfig } from \"@cloudflare/vitest-pool-workers/config\";\n\nexport default defineWorkersConfig({\n test: {\n poolOptions: {\n workers: {\n wrangler: { configPath: \"./wrangler.jsonc\" },\n },\n },\n },\n});\n```\n\n### Test Scheduled Events\n\n```bash\n# Enable in dev\nwrangler dev --test-scheduled\n\n# Trigger via HTTP\ncurl http://localhost:8787/__scheduled\n```\n\n---\n\n## Troubleshooting\n\n### Common Issues\n\n| Issue | Solution |\n|-------|----------|\n| `command not found: wrangler` | Install: `npm install -D wrangler` |\n| Auth errors | Run `wrangler login` |\n| Startup time limit exceeded | Run `wrangler check startup` to profile startup and generate CPU profiles |\n| Type errors after config change | Run `wrangler types` |\n| Local storage not persisting | Check `.wrangler/state` directory |\n| Binding undefined in Worker | Verify binding name matches config exactly |\n\n### Debug Commands\n\n```bash\n# Check auth status\nwrangler whoami\n\n# Profile Worker startup time\nwrangler check startup\n\n# View config schema\nwrangler docs configuration\n```\n\n---\n\n## Best Practices\n\n1. **Version control `wrangler.jsonc`**: Treat as source of truth for Worker config.\n2. **Use automatic provisioning**: Omit resource IDs for auto-creation on deploy.\n3. **Run `wrangler types` in CI**: Add to build step to catch binding mismatches.\n4. **Use environments**: Separate staging/production with `env.staging`, `env.production`.\n5. **Set `compatibility_date`**: Update quarterly to get new runtime features.\n6. **Use `.dev.vars` for local secrets**: Never commit secrets to config.\n7. **Test locally first**: `wrangler dev` with local bindings before deploying.\n8. **Use `--dry-run` before major deploys**: Validate changes without deployment.\n9. **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.\n""---\nname: wrangler\ndescription: Run or troubleshoot Wrangler CLI commands in projects that have a wrangler.jsonc, wrangler.json, or wrangler.toml file, including local development, Previews, deployment, and resource management. For new projects and projects without a Wrangler configuration file, use the cf CLI instead.\n---\n\n# Wrangler CLI\n\nUse this skill only when the project has `wrangler.jsonc`, `wrangler.json`, or `wrangler.toml` and no `cloudflare.config.ts`, or when the user asks for Wrangler. For a new project, a project with `cloudflare.config.ts`, or a project with no Cloudflare configuration, use the Cloudflare CLI (`cf`) instead: load the `cf-cli` skill if it is installed, or follow [Use cf with coding agents](https://developers.cloudflare.com/cf/agents/index.md). Do not add Wrangler to those projects.\n\nUse the project's Wrangler version and retrieve the relevant documentation before writing commands or configuration. CLI flags and configuration fields change; do not rely on memorized examples.\n\n## Inspect the Project\n\n- Find the package manager, installed Wrangler version, package scripts, framework, and Wrangler config. Run commands through the project's scripts or package manager so they use its local version. Install dependencies using the existing lockfile when needed; do not silently upgrade Wrangler to match current docs. If the project has a Wrangler configuration file but Wrangler is not a dependency, follow the [installation guide](https://developers.cloudflare.com/workers/wrangler/install-and-update/index.md) to add it locally.\n- Identify the config used by the build or deploy command, including framework-generated config. Edit its source rather than generated output.\n- Establish the target account, Worker, environment, and resource before running commands that change them. For data operations, determine whether the target is local or remote.\n\n## Retrieve What the Task Needs\n\nUse the Cloudflare MCP `docs` tool if available, or fetch the relevant linked page directly. Follow links to the specific command or product involved; avoid loading the entire reference. If a page moves, rediscover it through the [Wrangler command index](https://developers.cloudflare.com/workers/wrangler/commands/index.md) or Cloudflare docs search.\n\n| Task | Source |\n| --- | --- |\n| Discover commands and flags, including resource management, deployments, rollback, and diagnostics | Project-local `wrangler --help` and `wrangler <command> --help`; [command reference](https://developers.cloudflare.com/workers/wrangler/commands/index.md) |\n| Edit config or add a binding | Installed `wrangler/config-schema.json` (usually under `node_modules`); [configuration reference](https://developers.cloudflare.com/workers/wrangler/configuration/index.md) |\n| Deploy a framework application | [Framework guides](https://developers.cloudflare.com/workers/framework-guides/index.md); follow the guide for the project's existing framework and adapter |\n| Migrate an application to Workers when requested | [Pages to Workers](https://developers.cloudflare.com/workers/static-assets/migration-guides/migrate-from-pages/index.md); [Vercel to Workers](https://developers.cloudflare.com/workers/static-assets/migration-guides/vercel-to-workers/index.md) |\n| Configure staging or production | [Environments](https://developers.cloudflare.com/workers/wrangler/environments/index.md) |\n| Set secrets locally, in CI, or on a deployed Worker | [Secrets](https://developers.cloudflare.com/workers/configuration/secrets/index.md) |\n| Generate binding and runtime types | [TypeScript](https://developers.cloudflare.com/workers/languages/typescript/index.md) |\n| Run locally or choose a testing approach | [Local development](https://developers.cloudflare.com/workers/local-development/index.md); [testing](https://developers.cloudflare.com/workers/testing/index.md) |\n| Choose roles, scopes, or API token permissions for Wrangler | [Roles and permissions](https://developers.cloudflare.com/workers/authorization/index.md); [Workers roles and permissions](https://developers.cloudflare.com/workers/authorization/workers/index.md#wrangler) |\n| Create or manage a branch or pull request environment | [Previews overview](https://developers.cloudflare.com/workers/previews/index.md); [get started](https://developers.cloudflare.com/workers/previews/get-started/index.md); [configuration](https://developers.cloudflare.com/workers/previews/configuration/index.md) |\n| Decide whether Preview resources are isolated or shared | [Resources and isolation](https://developers.cloudflare.com/workers/previews/resources/index.md), including its current limitations |\n| Configure Preview URLs, access, debugging, or CI | [Custom domains](https://developers.cloudflare.com/workers/previews/custom-domains/index.md); [test and debug](https://developers.cloudflare.com/workers/previews/test-and-debug/index.md); [examples](https://developers.cloudflare.com/workers/previews/examples/index.md) |\n| Choose between Previews, Version URLs, and Wrangler environments | [Compare workflows](https://developers.cloudflare.com/workers/previews/compare-workflows/index.md) |\n| Diagnose authentication or select an account | [General commands](https://developers.cloudflare.com/workers/wrangler/commands/general/index.md), including `whoami`; [authentication profiles](https://developers.cloudflare.com/workers/wrangler/profiles/index.md) |\n| Deploy an unauthenticated prototype | [Claim deployments](https://developers.cloudflare.com/workers/platform/claim-deployments/index.md) for eligibility, expiry, and claim URL handling; use a permanent account for production or CI |\n\nUse installed help and schema to check whether documented features exist in the project's version. If a required feature needs an upgrade, make that dependency explicit. If retrieval is unavailable, state the gap and use available local evidence rather than inventing syntax.\n\n## Apply the Change\n\n- Prefer `wrangler.jsonc` for new config. Set a new project's [compatibility date](https://developers.cloudflare.com/workers/configuration/compatibility-dates/index.md) to today; review runtime changes and test when advancing an existing project's date. Preserve existing project conventions and avoid incidental format migrations.\n- Check environment inheritance before adding bindings or variables. Some fields must be specified separately for each environment; a working default config does not establish that staging is configured.\n- With the Cloudflare Vite plugin, select the environment via `CLOUDFLARE_ENV` at dev or build time. Deploy the resulting build; setting an environment at deploy time does not retarget its flattened config. See [Vite environments](https://developers.cloudflare.com/workers/vite-plugin/reference/cloudflare-environments/index.md).\n- Reconcile dashboard changes with the config before deploying: Wrangler can overwrite dashboard variables and routes. When binding existing resources, verify their identifiers; omitted identifiers can trigger [automatic provisioning](https://developers.cloudflare.com/workers/wrangler/configuration/index.md#automatic-provisioning).\n- Distinguish local simulation from remote bindings during development. A locally running Worker can still access real resources; check the selected bindings before testing writes.\n- Before a remote command, identify the authenticated member or API token and retrieve the current role and scope required for the exact operation. Prefer the narrowest scope that satisfies the user's intent. The `wrangler login` OAuth flow does not support granular authorization; use an account-owned API token when granular access is required, and never ask the user to paste its value into chat.\n- Keep secret values out of command arguments, source code, and logs. Use the documented interactive input or protected file/stdin mechanism for the command. Local secret files must be ignored by version control and are not automatically uploaded as deployed secrets. For missing local secrets, check file precedence and any `secrets.required` declaration in the secrets docs.\n- Treat `wrangler secret put` and `secret delete` as deployments: they create a version and deploy it immediately. Use the documented `wrangler versions secret` workflow when the change must be staged.\n- Before a rollback, check [rollback limitations](https://developers.cloudflare.com/workers/versions-and-deployments/rollbacks/index.md): connected resources and their data are not rolled back with Worker code.\n\n## Work with Workers Previews\n\n- Workers Previews requires project-local Wrangler 4.135.0 or later; project commands do not use a newer global installation. Check the project's pinned version and make any required dependency upgrade explicit.\n- Use Previews for branch and pull request environments under the same Worker. Use Version URLs to inspect a specific uploaded version with production resources, and Wrangler environments for persistent, separately deployed Workers. Follow [Compare workflows](https://developers.cloudflare.com/workers/previews/compare-workflows/index.md) rather than adapting an older aliased Version URL workflow.\n- First inspect how the user manages production configuration and deployments. Configure Preview domains through the same configuration system as production, such as Wrangler, the dashboard, or Terraform. Run Preview deployments through the user's existing path, such as the local CLI, Workers Builds, or external CI, unless the user requests a different workflow. Mirror the management approach, not production resource bindings or data.\n- Before deploying, follow the current [configuration placement table](https://developers.cloudflare.com/workers/previews/configuration/index.md#what-goes-in-the-previews-block) and [resource matrix and limitations](https://developers.cloudflare.com/workers/previews/resources/index.md). Do not infer isolation from the Preview name or allow writes to production resources unless the user explicitly intends to share them.\n- Tell the user that Preview URLs are public unless access controls are configured, then let them decide whether to protect the URLs. Follow the [custom domain and access guidance](https://developers.cloudflare.com/workers/previews/custom-domains/index.md) for the chosen setup.\n- Confirm which Worker or Wrangler environment the user intends to target. When targeting a Wrangler environment, pass the same `--env` value to every Preview command; omitting it targets the top-level Worker.\n\n## Validate\n\nAfter changing config or bindings in a TypeScript project, regenerate types with the project's `wrangler types` command rather than hand-editing generated declarations. Run the relevant existing typecheck or tests.\n\nFor deployment changes, use the project's build workflow and `wrangler deploy --dry-run` where supported, with the intended config and environment. A successful dry run checks the build and packaging; it does not prove remote resources or runtime behavior work. Use task-specific local or remote checks as appropriate to the requested work.\n\nFor Previews, a returned URL does not validate behavior that depends on bindings Wrangler reports as missing. Validate the behavior the user requested, using Preview-specific logs and configuration when needed. Writes to production resources, destructive testing, and deletion of named Previews must match the user's explicit intent.\n\nReport what changed, the target environment, checks performed, and any unresolved validation gaps. Link the documentation used when the result depends on current command or configuration behavior.\n\n## Skill feedback\n\nIf the user reports that this skill gave incorrect or outdated guidance, or is missing information, read [references/skill-feedback.md](references/skill-feedback.md).\n"
Full snapshot data
{
"description": "Run or troubleshoot Wrangler CLI commands in projects that have a wrangler.jsonc, wrangler.json, or wrangler.toml file, including local development, Previews, deployment, and resource management. For new projects and projects without a Wrangler configuration file, use the cf CLI instead.",
"included_files": [
{
"relative_path": "references/skill-feedback.md",
"size_in_bytes": 2781
}
],
"name": "wrangler",
"skill_md_contents": "---\nname: wrangler\ndescription: Run or troubleshoot Wrangler CLI commands in projects that have a wrangler.jsonc, wrangler.json, or wrangler.toml file, including local development, Previews, deployment, and resource management. For new projects and projects without a Wrangler configuration file, use the cf CLI instead.\n---\n\n# Wrangler CLI\n\nUse this skill only when the project has `wrangler.jsonc`, `wrangler.json`, or `wrangler.toml` and no `cloudflare.config.ts`, or when the user asks for Wrangler. For a new project, a project with `cloudflare.config.ts`, or a project with no Cloudflare configuration, use the Cloudflare CLI (`cf`) instead: load the `cf-cli` skill if it is installed, or follow [Use cf with coding agents](https://developers.cloudflare.com/cf/agents/index.md). Do not add Wrangler to those projects.\n\nUse the project's Wrangler version and retrieve the relevant documentation before writing commands or configuration. CLI flags and configuration fields change; do not rely on memorized examples.\n\n## Inspect the Project\n\n- Find the package manager, installed Wrangler version, package scripts, framework, and Wrangler config. Run commands through the project's scripts or package manager so they use its local version. Install dependencies using the existing lockfile when needed; do not silently upgrade Wrangler to match current docs. If the project has a Wrangler configuration file but Wrangler is not a dependency, follow the [installation guide](https://developers.cloudflare.com/workers/wrangler/install-and-update/index.md) to add it locally.\n- Identify the config used by the build or deploy command, including framework-generated config. Edit its source rather than generated output.\n- Establish the target account, Worker, environment, and resource before running commands that change them. For data operations, determine whether the target is local or remote.\n\n## Retrieve What the Task Needs\n\nUse the Cloudflare MCP `docs` tool if available, or fetch the relevant linked page directly. Follow links to the specific command or product involved; avoid loading the entire reference. If a page moves, rediscover it through the [Wrangler command index](https://developers.cloudflare.com/workers/wrangler/commands/index.md) or Cloudflare docs search.\n\n| Task | Source |\n| --- | --- |\n| Discover commands and flags, including resource management, deployments, rollback, and diagnostics | Project-local `wrangler --help` and `wrangler <command> --help`; [command reference](https://developers.cloudflare.com/workers/wrangler/commands/index.md) |\n| Edit config or add a binding | Installed `wrangler/config-schema.json` (usually under `node_modules`); [configuration reference](https://developers.cloudflare.com/workers/wrangler/configuration/index.md) |\n| Deploy a framework application | [Framework guides](https://developers.cloudflare.com/workers/framework-guides/index.md); follow the guide for the project's existing framework and adapter |\n| Migrate an application to Workers when requested | [Pages to Workers](https://developers.cloudflare.com/workers/static-assets/migration-guides/migrate-from-pages/index.md); [Vercel to Workers](https://developers.cloudflare.com/workers/static-assets/migration-guides/vercel-to-workers/index.md) |\n| Configure staging or production | [Environments](https://developers.cloudflare.com/workers/wrangler/environments/index.md) |\n| Set secrets locally, in CI, or on a deployed Worker | [Secrets](https://developers.cloudflare.com/workers/configuration/secrets/index.md) |\n| Generate binding and runtime types | [TypeScript](https://developers.cloudflare.com/workers/languages/typescript/index.md) |\n| Run locally or choose a testing approach | [Local development](https://developers.cloudflare.com/workers/local-development/index.md); [testing](https://developers.cloudflare.com/workers/testing/index.md) |\n| Choose roles, scopes, or API token permissions for Wrangler | [Roles and permissions](https://developers.cloudflare.com/workers/authorization/index.md); [Workers roles and permissions](https://developers.cloudflare.com/workers/authorization/workers/index.md#wrangler) |\n| Create or manage a branch or pull request environment | [Previews overview](https://developers.cloudflare.com/workers/previews/index.md); [get started](https://developers.cloudflare.com/workers/previews/get-started/index.md); [configuration](https://developers.cloudflare.com/workers/previews/configuration/index.md) |\n| Decide whether Preview resources are isolated or shared | [Resources and isolation](https://developers.cloudflare.com/workers/previews/resources/index.md), including its current limitations |\n| Configure Preview URLs, access, debugging, or CI | [Custom domains](https://developers.cloudflare.com/workers/previews/custom-domains/index.md); [test and debug](https://developers.cloudflare.com/workers/previews/test-and-debug/index.md); [examples](https://developers.cloudflare.com/workers/previews/examples/index.md) |\n| Choose between Previews, Version URLs, and Wrangler environments | [Compare workflows](https://developers.cloudflare.com/workers/previews/compare-workflows/index.md) |\n| Diagnose authentication or select an account | [General commands](https://developers.cloudflare.com/workers/wrangler/commands/general/index.md), including `whoami`; [authentication profiles](https://developers.cloudflare.com/workers/wrangler/profiles/index.md) |\n| Deploy an unauthenticated prototype | [Claim deployments](https://developers.cloudflare.com/workers/platform/claim-deployments/index.md) for eligibility, expiry, and claim URL handling; use a permanent account for production or CI |\n\nUse installed help and schema to check whether documented features exist in the project's version. If a required feature needs an upgrade, make that dependency explicit. If retrieval is unavailable, state the gap and use available local evidence rather than inventing syntax.\n\n## Apply the Change\n\n- Prefer `wrangler.jsonc` for new config. Set a new project's [compatibility date](https://developers.cloudflare.com/workers/configuration/compatibility-dates/index.md) to today; review runtime changes and test when advancing an existing project's date. Preserve existing project conventions and avoid incidental format migrations.\n- Check environment inheritance before adding bindings or variables. Some fields must be specified separately for each environment; a working default config does not establish that staging is configured.\n- With the Cloudflare Vite plugin, select the environment via `CLOUDFLARE_ENV` at dev or build time. Deploy the resulting build; setting an environment at deploy time does not retarget its flattened config. See [Vite environments](https://developers.cloudflare.com/workers/vite-plugin/reference/cloudflare-environments/index.md).\n- Reconcile dashboard changes with the config before deploying: Wrangler can overwrite dashboard variables and routes. When binding existing resources, verify their identifiers; omitted identifiers can trigger [automatic provisioning](https://developers.cloudflare.com/workers/wrangler/configuration/index.md#automatic-provisioning).\n- Distinguish local simulation from remote bindings during development. A locally running Worker can still access real resources; check the selected bindings before testing writes.\n- Before a remote command, identify the authenticated member or API token and retrieve the current role and scope required for the exact operation. Prefer the narrowest scope that satisfies the user's intent. The `wrangler login` OAuth flow does not support granular authorization; use an account-owned API token when granular access is required, and never ask the user to paste its value into chat.\n- Keep secret values out of command arguments, source code, and logs. Use the documented interactive input or protected file/stdin mechanism for the command. Local secret files must be ignored by version control and are not automatically uploaded as deployed secrets. For missing local secrets, check file precedence and any `secrets.required` declaration in the secrets docs.\n- Treat `wrangler secret put` and `secret delete` as deployments: they create a version and deploy it immediately. Use the documented `wrangler versions secret` workflow when the change must be staged.\n- Before a rollback, check [rollback limitations](https://developers.cloudflare.com/workers/versions-and-deployments/rollbacks/index.md): connected resources and their data are not rolled back with Worker code.\n\n## Work with Workers Previews\n\n- Workers Previews requires project-local Wrangler 4.135.0 or later; project commands do not use a newer global installation. Check the project's pinned version and make any required dependency upgrade explicit.\n- Use Previews for branch and pull request environments under the same Worker. Use Version URLs to inspect a specific uploaded version with production resources, and Wrangler environments for persistent, separately deployed Workers. Follow [Compare workflows](https://developers.cloudflare.com/workers/previews/compare-workflows/index.md) rather than adapting an older aliased Version URL workflow.\n- First inspect how the user manages production configuration and deployments. Configure Preview domains through the same configuration system as production, such as Wrangler, the dashboard, or Terraform. Run Preview deployments through the user's existing path, such as the local CLI, Workers Builds, or external CI, unless the user requests a different workflow. Mirror the management approach, not production resource bindings or data.\n- Before deploying, follow the current [configuration placement table](https://developers.cloudflare.com/workers/previews/configuration/index.md#what-goes-in-the-previews-block) and [resource matrix and limitations](https://developers.cloudflare.com/workers/previews/resources/index.md). Do not infer isolation from the Preview name or allow writes to production resources unless the user explicitly intends to share them.\n- Tell the user that Preview URLs are public unless access controls are configured, then let them decide whether to protect the URLs. Follow the [custom domain and access guidance](https://developers.cloudflare.com/workers/previews/custom-domains/index.md) for the chosen setup.\n- Confirm which Worker or Wrangler environment the user intends to target. When targeting a Wrangler environment, pass the same `--env` value to every Preview command; omitting it targets the top-level Worker.\n\n## Validate\n\nAfter changing config or bindings in a TypeScript project, regenerate types with the project's `wrangler types` command rather than hand-editing generated declarations. Run the relevant existing typecheck or tests.\n\nFor deployment changes, use the project's build workflow and `wrangler deploy --dry-run` where supported, with the intended config and environment. A successful dry run checks the build and packaging; it does not prove remote resources or runtime behavior work. Use task-specific local or remote checks as appropriate to the requested work.\n\nFor Previews, a returned URL does not validate behavior that depends on bindings Wrangler reports as missing. Validate the behavior the user requested, using Preview-specific logs and configuration when needed. Writes to production resources, destructive testing, and deletion of named Previews must match the user's explicit intent.\n\nReport what changed, the target environment, checks performed, and any unresolved validation gaps. Link the documentation used when the result depends on current command or configuration behavior.\n\n## Skill feedback\n\nIf the user reports that this skill gave incorrect or outdated guidance, or is missing information, read [references/skill-feedback.md](references/skill-feedback.md).\n"
}SHA-256 of public snapshot: ac5f95a3eaf8ad80a628126819dd2734bb6f6b4266bd274037882244354b83b1