Workers Development

cloudflare/skills/skills/workers-development

作者 cloudflare6eb6c781aa9b6438e0c7307bd102788a75fe1a6d無授權條款3.2K 個星標收錄於 2026年11月7日更新於 2026年11月7日儲存庫今天更新

Run, inspect, and debug Cloudflare Workers during local development with cf dev, wrangler dev, or the Cloudflare Vite plugin, using Local Explorer to read and seed binding data and query local traces and logs. Also routes production debugging to Workers observability. Use for debugging requests whether or not the project uses Wrangler.

AI 產生的概覽

指導使用 cf dev、Wrangler 或 Vite 外掛在本機執行、檢視與偵錯 Cloudflare Workers,並處理線上可觀測性。

功能
說明如何用專案現有工具啟動 Worker 本機開發伺服器,並透過 Local Explorer 介面及其 OpenAPI 描述的 API 檢視或寫入本機綁定資料(KV、R2、D1、Durable Objects、Workflows、Cron)。內容包括在加入記錄前先查看已擷取的本機追蹤與日誌、確認哪些綁定為遠端,以及把已部署 Worker 的偵錯交給 Workers 可觀測性或 Cloudflare MCP 伺服器。產出為操作指引與指令,而非檔案。
適用情境
適用於在本機開發或偵錯 Cloudflare Worker 時,需要啟動開發伺服器、檢視或寫入綁定資料、讀取本機追蹤與日誌的情況。也適用於排查已部署 Worker 的日誌、追蹤或指標。
執行需求
需要一個帶有自身開發工具的 Cloudflare Workers 專案(cf、Wrangler 或 Cloudflare Vite 外掛)以及執行中的本機開發伺服器;查閱文件需要網路,偵錯線上 Worker 還需 Cloudflare 帳戶存取權,可選用 Cloudflare MCP 伺服器。僅為說明文件,不含指令碼。

Workers development and debugging

Use the project's existing tooling, scripts, and configuration. Installed help, the Local Explorer API schema, and current docs describe the supported operations; read them rather than guessing endpoints or flags.

NeedTools and discovery
Run locallyUse the project's existing dev command: cf dev in a cf project, otherwise the Wrangler or Cloudflare Vite dev script. See local development.
Inspect or seed local binding dataLocal Explorer is a UI and API for local KV, R2, D1, SQLite-backed Durable Objects, and Workflows, and can trigger Cron handlers. Open /cdn-cgi/local/explorer on the dev server's origin.
Debug local requestsLocal Explorer captures traces and logs from every local invocation, including binding operations, without code changes. Check traces before adding logging.
Debug a deployed WorkerChoose logs, traces, or metrics with Workers observability, or the cloudflare skill's observability reference when installed. If the Cloudflare MCP server is connected (bundled with this plugin), use search to find the Workers Observability API operations, then execute to call them, scoped to the target account, Worker, and time window.

Use the Local Explorer API

When the dev server detects an AI agent, including under cf dev, it prints a hint with the API URL and relevant endpoints. Fetch the OpenAPI specification from /cdn-cgi/local/explorer/api on the dev server's origin, then extract only the operations the task needs. If no hint appears, request that URL directly. If the API or an operation is missing, compare the installed Wrangler or Vite plugin version against the requirements in the Local Explorer docs.

Bindings are simulated locally by default, but a binding set to remote: true reaches the real deployed resource while the Worker runs locally. Traces also capture those remote calls. Identify which bindings are remote before seeding or writing data.

Skill feedback

If the user reports that this skill gave incorrect or outdated guidance, or is missing information, read references/skill-feedback.md [blocked].

來源與署名

來源:cloudflare/skills位於skills/workers-development提交6eb6c78

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

在 README 中新增徽章

向讀者展示該技能已收錄於 SourceWeft,徽章連結到本頁。

「Listed on SourceWeft」徽章預覽
[![Listed on SourceWeft](https://sourceweft.com/badge/skills/gh-cloudflare-skills-workers-development-skills-workers-development-aae70b66896f63b2.svg)](https://sourceweft.com/skills/gh-cloudflare-skills-workers-development-skills-workers-development-aae70b66896f63b2?utm_source=readme&utm_medium=badge)

檢舉或申請下架