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)

举报或申请下架