wrangler

โดย Cloudflare

Cloudflare Workers CLI สำหรับการปรับใช้ พัฒนา และจัดการ Workers, KV, R2, D1, Vectorize, Hyperdrive, Workers AI, Containers, Queues, Workflows, Pipelines และ Secrets Store โหลดก่อนรันคำสั่ง wrangler เพื่อให้แน่ใจว่าไวยากรณ์และแนวทางปฏิบัติที่ดีที่สุดถูกต้อง

npx skills add https://github.com/cloudflare/skills --skill wrangler

Wrangler CLI

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.

Inspect the Project

  • 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 Wrangler is not a dependency, follow the installation guide 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.

Retrieve What the Task Needs

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 or Cloudflare docs search.

TaskSource
Discover commands and flags, including resource management, deployments, rollback, and diagnosticsProject-local wrangler --help and wrangler <command> --help; command reference
Edit config or add a bindingInstalled wrangler/config-schema.json (usually under node_modules); configuration reference
Deploy a framework applicationFramework guides; follow the guide for the project's existing framework and adapter
Migrate an application to Workers when requestedPages to Workers; Vercel to Workers
Configure staging or productionEnvironments
Set secrets locally, in CI, or on a deployed WorkerSecrets
Generate binding and runtime typesTypeScript
Run locally or choose a testing approachLocal development; testing
Diagnose authentication or select an accountGeneral commands, including whoami; authentication profiles
Deploy an unauthenticated prototypeClaim deployments for eligibility, expiry, and claim URL handling; use a permanent account for production or CI

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.

Apply the Change

  • Prefer wrangler.jsonc for new config. Set a new project's compatibility date 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.
  • 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.
  • Distinguish local simulation from remote bindings during development. A locally running Worker can still access real resources; check the selected bindings before testing writes.
  • 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: connected resources and their data are not rolled back with Worker code.

Validate

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.

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.

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.

Skills เพิ่มเติมจาก Cloudflare

agents-sdk
Cloudflare
สร้าง AI agents บน Cloudflare Workers โดยใช้ Agents SDK โหลดเมื่อสร้าง stateful agents, durable workflows, แอป WebSocket แบบเรียลไทม์, งานตามกำหนดเวลา, MCP servers หรือแอปแชท ครอบคลุม Agent class, การจัดการสถานะ, RPC ที่เรียกได้, การรวม Workflows และ React hooks
building-ai-agent-on-cloudflare
Cloudflare
| สร้างเอเจนต์ AI บน Cloudflare โดยใช้ Agents SDK พร้อมการจัดการสถานะ WebSocket แบบเรียลไทม์ งานตามกำหนดเวลา การรวมเครื่องมือ และความสามารถในการแชท สร้างโค้ดเอเจนต์ที่พร้อมใช้งานจริงซึ่งปรับใช้กับ Workers ใช้เมื่อ: ผู้ใช้ต้องการ "สร้างเอเจนต์", "เอเจนต์ AI", "เอเจนต์แชท", "เอเจนต์ ที่มีสถานะ", พูดถึง "Agents SDK", ต้องการ "AI แบบเรียลไทม์", "WebSocket AI", หรือถามเกี่ยวกับ "การจัดการสถานะ" ของเอเจนต์, "งานตามกำหนดเวลา" หรือ "การเรียกใช้เครื่องมือ
development
building-mcp-server-on-cloudflare
Cloudflare
| สร้างเซิร์ฟเวอร์ MCP (Model Context Protocol) ระยะไกลบน Cloudflare Workers พร้อมเครื่องมือ การตรวจสอบสิทธิ์ OAuth และการปรับใช้ในระบบผลิต สร้างโค้ดเซิร์ฟเวอร์ กำหนดค่าผู้ให้บริการตรวจสอบสิทธิ์ และปรับใช้กับ Workers ใช้เมื่อ: ผู้ใช้ต้องการ "สร้างเซิร์ฟเวอร์ MCP", "สร้างเครื่องมือ MCP", "MCP ระยะไกล", "ปรับใช้ MCP", เพิ่ม "OAuth ให้กับ MCP" หรือกล่าวถึง Model Context Protocol บน Cloudflare นอกจากนี้ยังทำงานเมื่อมี "การตรวจสอบสิทธิ์ MCP" หรือ "การปรับใช้ MCP
development
cloudflare
Cloudflare
ทักษะที่ครอบคลุมแพลตฟอร์ม Cloudflare ครอบคลุม Workers, Pages, พื้นที่จัดเก็บ (KV, D1, R2), AI (Workers AI, Vectorize, Agents SDK), เครือข่าย (Tunnel, Spectrum), ความปลอดภัย (WAF, DDoS) และโครงสร้างพื้นฐานเป็นโค้ด (Terraform, Pulumi) ใช้สำหรับงานพัฒนา Cloudflare ใดๆ
durable-objects
Cloudflare
สร้างและตรวจสอบ Cloudflare Durable Objects ใช้เมื่อสร้างการประสานงานที่มีสถานะ (ห้องแชท เกมผู้เล่นหลายคน ระบบจอง) การใช้งานเมธอด RPC พื้นที่จัดเก็บ SQLite สัญญาณเตือน WebSockets หรือตรวจสอบโค้ด DO เพื่อแนวทางปฏิบัติที่ดีที่สุด ครอบคลุมการรวม Workers การกำหนดค่า wrangler และการทดสอบด้วย Vitest
sandbox-sdk
Cloudflare
สร้างแอปพลิเคชันในสภาพแวดล้อมแซนด์บ็อกซ์สำหรับการรันโค้ดอย่างปลอดภัย โหลดเมื่อสร้างการรันโค้ด AI, ตัวแปลโค้ด, ระบบ CI/CD, สภาพแวดล้อมการพัฒนาที่โต้ตอบได้ หรือการรันโค้ดที่ไม่น่าเชื่อถือ ครอบคลุมวงจรชีวิตของ Sandbox SDK, คำสั่ง, ไฟล์, ตัวแปลโค้ด และ URL แสดงตัวอย่าง
web-perf
Cloudflare
วิเคราะห์ประสิทธิภาพเว็บด้วย Chrome DevTools MCP วัด Core Web Vitals (FCP, LCP, TBT, CLS, Speed Index) ระบุทรัพยากรที่บล็อกการเรนเดอร์ ห่วงโซ่การพึ่งพาเครือข่าย การเลื่อนเลย์เอาต์ ปัญหาแคช และช่องว่างด้านการเข้าถึง ใช้เมื่อถูกขอให้ตรวจสอบ โปรไฟล์ แก้ไขข้อบกพร่อง หรือปรับปรุงประสิทธิภาพการโหลดหน้าเว็บ คะแนน Lighthouse หรือความเร็วไซต์
workers-best-practices
Cloudflare
ตรวจสอบและเขียนโค้ด Cloudflare Workers ตามแนวทางปฏิบัติที่ดีที่สุดสำหรับโปรดักชัน ใช้เมื่อเขียน Workers ใหม่ ตรวจสอบโค้ด Worker กำหนดค่า wrangler.jsonc หรือตรวจสอบรูปแบบที่ไม่เหมาะสมของ Workers ทั่วไป (การสตรีม, floating promises, global state, secrets, bindings, observability) เน้นการดึงข้อมูลจากเอกสารของ Cloudflare มากกว่าความรู้ที่ฝึกไว้ล่วงหน้า