workers-best-practices

Validate Cloudflare Workers code and wrangler.jsonc against production best practices.

Updated Aug 4, 2023
One-click install
npx skills add https://github.com/EmreOzdemiroglu/dotfiles --skill workers-best-practices-emreozdemiroglu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: workers-best-practices
Source: https://github.com/EmreOzdemiroglu/dotfiles/tree/main/nvim/custom_rules/workers-best-practices
Command: npx skills add https://github.com/EmreOzdemiroglu/dotfiles --skill workers-best-practices-emreozdemiroglu

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Cloudflare Workers code often ships with subtle production issues—type drift, unsafe patterns (like floating promises or global request state), misconfigured wrangler settings, and security footguns—that are hard to catch during development.

Core Features & Use Cases

  • Best-practice aligned review and authoring guidance focused on production patterns and common anti-patterns in Workers code.
  • Config and type correctness checks using the latest Workers best practices page, @cloudflare/workers-types, and wrangler’s config-schema.json.
  • Operational guidance for real-world development flows, including streaming, ctx.waitUntil, bindings vs REST, observability configuration, security (Web Crypto), and safe review workflow.

Quick Start

Review your Worker code and wrangler.jsonc for production best-practice compliance, ensuring streaming, proper promise handling, correct binding access patterns, and safe secret usage.

Frequently Asked Questions about workers-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I review Cloudflare Workers code for production best practices and common anti-patterns?

Review Cloudflare Workers code for production best practices by detecting common anti-patterns like floating promises, global request state, and unsafe streaming, ensuring your codebase meets operational standards before deployment.

What are the best practices for configuring wrangler.jsonc fields and bindings in Cloudflare Workers?

Configuring wrangler.jsonc correctly requires validating fields against the latest config-schema.json, ensuring binding-code consistency, and verifying that Workers types match your declared bindings to prevent type drift.

Does Cloudflare Workers code require specific security practices like Web Crypto and timing-safe comparisons?

Cloudflare Workers code requires specific security practices including using Web Crypto APIs and timing-safe comparisons to prevent security footguns, ensuring your application handles sensitive data safely.

How do I handle ctx.waitUntil and streaming properly when writing new Cloudflare Workers?

Handle ctx.waitUntil and streaming in Cloudflare Workers by applying safe promise handling patterns and avoiding global request state, ensuring your asynchronous operations execute correctly without leaking state between requests.

Why does my Cloudflare Workers code have type drift and unsafe patterns during development?

Cloudflare Workers code often ships with type drift and unsafe patterns because standard development flows miss production checks against the latest @cloudflare/workers-types, allowing subtle issues to pass undetected.

Can I use this approach to validate observability configuration and secret usage for existing Workers codebases?

You can validate observability configuration and secret usage for existing Workers codebases by reviewing your operational setup against latest official sources, ensuring safe review workflow and compatibility.