Index of every page on this site: llms.txt
All skills
cloudflare avatar

/workers-best-practices

@5108325 official
by cloudflarecloudflare/skills3.4k stars
357
Run it yourself

Cloudflare Workers best practices for production applications. Use when writing, reviewing, or configuring Workers.

Use this Skill: https://skilld.dev/gh/cloudflare/skills/workers-best-practices

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesskill-feedback.md

≈706 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Skill feedback

GitHub issues are public: anyone can read an issue once it is posted. Never include sensitive information, and never post an issue until the user has seen the exact title and body and approved it.

Use this when the user reports that the workers-best-practices skill gave incorrect or outdated guidance, is missing information, or could be improved. This is about the skill (agent instructions), not about Cloudflare products.

What not to include

The issue is drafted from the conversation, so remove the following before drafting and describe the problem in general terms instead:

  • Credentials, API tokens, secrets, and passwords
  • Account IDs, zone IDs, and other resource identifiers
  • Customer or personal data, such as names, email addresses, and IP addresses
  • Internal hostnames and URLs
  • Private code, configuration, and logs

Steps

  1. Ask permission – Ask the user if they would like to submit feedback to the skill maintainers. If they decline, move on.

  2. Draft the issue – Fill in the table below from the conversation and use it as the issue body. Always identify which specific file and section caused the problem. Leave out everything listed in What not to include.

  3. Review with the user – Show the user the exact title and body, then ask a yes/no question, such as "Post this as a public issue on cloudflare/skills?" Submit only after the user answers yes. If they ask for changes, apply them and ask again. If they answer no, do not post. Agreeing to send feedback in step 1 is not approval of the text.

  4. Submit – Create a GitHub issue on the cloudflare/skills repository with the approved draft as the body, for example with gh issue create --repo cloudflare/skills. The title must follow this format: skill-feedback: workers-best-practices: <summary of the problem>.

  5. Share the result – Share the issue URL with the user after submission. If submission fails, give the user the approved title and body, and this link to create the issue manually: https://github.com/cloudflare/skills/issues/new

Issue body

Field Value
Type bug (incorrect guidance), outdated, missing, or improvement
Skill workers-best-practices
Source File and section, e.g. SKILL.md > "Section name" or references/<file>.md > "Section name"
Agent The agent and model in use, if known
Task What the user was trying to do, e.g. "deploy a preview"
Expected What should have happened, e.g. "Create a Preview deployment"
Actual What the skill said or what happened, e.g. "Unknown option: --preview"
Impact The effect on the user, e.g. "Time spent finding the correct syntax"
Suggested fix How the skill should change; leave blank if unsure

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning9d5 checks · Risk SAFE
  • Gen Agent Trust Hub10d

    This skill provides a comprehensive set of best practices for developing and reviewing Cloudflare Workers, focusing on security, performance, and maintainability. It includes specific guidance on avoiding common pitfalls and implementing secure coding patterns.

  • Socket9d

    No alerts

  • Snyk10d

    Risk: LOW · No issues

  • Runlayer8mo

    3/3 files flagged

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 5108325. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 days ago.

Activeupdated 3 weeks ago
  • Security
  • cloudflare
  • workers
  • best-practices
  • wrangler
  • observability
  • streaming
  • bindings
  • durable-objects
  • code-review

README badge

README badge for cloudflare/skills/workers-best-practices

Reviews and authors Cloudflare Workers code against production best practices, including streaming, floating promises, global state, secrets, bindings, and observability. Fetches latest Workers types and config schema rather than relying on pre-trained knowledge, making it suitable for code review and new Worker development in wrangler projects.

Generated from the current SKILL.md.

Does this skill cover Durable Objects and Workflows?
No. This skill focuses on Workers-specific best practices. Load the separate durable-objects skill for Durable Objects guidance, and refer to the Rules of Workflows documentation for Workflows.
Should I use pre-trained knowledge or fetch fresh docs?
Always fetch fresh docs. The skill is designed to retrieve the latest Workers best practices page, types, and wrangler schema before writing or reviewing code, because APIs and config fields change frequently.
What anti-patterns does this skill flag?
Common patterns like unbounded `await response.text()` calls, hardcoded secrets, floating promises, module-level request state, destructuring ctx, and using the Cloudflare REST API from inside a Worker instead of in-process bindings.
Does this skill validate TypeScript types and config?
Yes. The skill checks binding types, handler signatures, wrangler.jsonc config fields, and will flag unsafe patterns like bare `any` types, double-casts, and hand-written Env interfaces that drift from actual bindings.
Can this skill help me set up observability and logging?
Yes. The skill covers enabling observability in wrangler config with head_sampling_rate and recommends structured JSON logging patterns for production Workers.

Generated from the current SKILL.md. These answers refresh after source changes.