workers-best-practices

Workers best practices

workers-best-practices is Cloudflare's agent skill for writing, reviewing and configuring production Cloudflare Workers, built around a table of anti-patterns to flag and current docs over memorized APIs.

Checked by CookiesForAI on : license and last change of the skill re-read from GitHub.

Written by

Install Workers best practices

Install this skill with the skills CLI

Terminal
npx skills add cloudflare/skills --skill workers-best-practices

Or, in Claude Code, add Cloudflare's plugin marketplace

Agent chat
/plugin marketplace add cloudflare/skills

Then install the cloudflare plugin (all 16 skills plus Cloudflare's MCP server)

Agent chat
/plugin install cloudflare@cloudflare

Or, in Codex, add the same marketplace from your terminal

Terminal
codex plugin marketplace add cloudflare/skills

Then install the cloudflare plugin and start a new Codex session

Terminal
codex plugin add cloudflare@cloudflare

In VS Code with GitHub Copilot, Cloudflare's README says to enable chat.plugins.enabled, run Chat: Install Plugin From Source, and enter https://github.com/cloudflare/skills. In Cursor, install it from the Cursor Marketplace.

Or paste this into your coding agent: Install the agent skill workers-best-practices from github.com/cloudflare/skills. Checked by CookiesForAI on : license and last change of the skill re-read from GitHub. A skill can include scripts that run on your computer, so read its source first.

What Workers best practices does

workers-best-practices is an agent skill from Cloudflare that loads when an agent writes, reviews or configures a Cloudflare Worker. Its first instruction is that the agent's built-in knowledge of Workers APIs may be out of date, so it should first look at what the project actually uses (package versions, the generated types and the compatibility settings in the Wrangler config) and fetch Cloudflare's documentation before stating facts about APIs, limits or runtime behavior.

The core of workers-best-practices is a list of 15 anti-patterns with the fix for each. Examples: buffering an unbounded response body instead of streaming it, Math.random for security tokens, background work not tied to ctx.waitUntil, request state kept in module-level variables, hand-written Env types instead of wrangler types, comparing secrets with plain string equality, and calling the REST API when a binding exists.

The skill also asks for a current compatibility date on new Workers and for Workers Logs and Traces to be switched on in production, noting that traces need their own setting. Three reference files cover configuration and observability, runtime patterns, and platform API checks. Durable Objects and Wrangler commands are handed to their own skills.

When to use Workers best practices

  • You want a code review of a Worker before it goes to production.
  • Your Worker runs out of memory or loses background work after the response.
  • You are starting a new Worker and want bindings, types and observability set up right.
  • An agent keeps writing Workers code from an outdated memory of the API.

When to pick something else

  • Running Wrangler commands, deploying or managing KV, R2 and D1: use the wrangler skill from the same repository.

Which agents Workers best practices works in

Cloudflare documents Workers best practices for Claude Code, Codex, GitHub Copilot in VS Code, Cursor, OpenCode, Pi. The open skills CLI also installs it into 78 agents, including Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode (we listed it with the CLI on ). See where each agent looks for skills.

We also list this company's other pages: Cloudflare MCP server.

Workers best practices license

Workers best practices is published under Apache-2.0.

More from Cloudflare

Lists that include workers-best-practices