workers-best-practices

Review Cloudflare Workers code and wrangler config for production best-practice violations.

Updated Apr 14, 2026
One-click install
npx skills add https://github.com/dallay/opencode-docker --skill workers-best-practices-dallay
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: workers-best-practices
Source: https://github.com/dallay/opencode-docker/tree/main/config/skills/workers-best-practices
Command: npx skills add https://github.com/dallay/opencode-docker --skill workers-best-practices-dallay

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers and reviewers find and fix production-ready issues in Cloudflare Workers projects by enforcing current platform best practices, preventing runtime crashes, security mistakes, and configuration drift from wrangler config and types.

Core Features & Use Cases

  • Documentation-first reviews: instructs retrieval of the latest Cloudflare Workers docs, @cloudflare/workers-types, and the wrangler schema before making assertions.
  • Config and binding validation: checks compatibility_date, nodejs_compat, observability, secret handling, and binding-code consistency between wrangler config and source.
  • Runtime pattern checks: identifies streaming anti-patterns, floating promises, module-level mutable state, insecure crypto usage, passThroughOnException misuse, and serialization boundary errors.
  • Review workflow: prescribes a repeatable process (retrieve, read full files, check types, validate config, run tools) and output formats for prioritized findings.

Quick Start

Review the repository's Worker code and wrangler configuration for compatibility_date, nodejs_compat, binding consistency, streaming/floating-promise issues, and secret leakage while citing authoritative Cloudflare docs.

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 readiness?

Validate Cloudflare Workers production readiness by checking fetch handlers, wrangler.jsonc configurations, Durable Objects, and observability settings against latest platform best practices. This review process verifies streaming patterns, floating promises, global state, and secret handling to prevent runtime crashes and security mistakes.

What are common anti-patterns when configuring wrangler.jsonc for Workers?

Common wrangler.jsonc anti-patterns include incorrect compatibility_date settings, missing nodejs_compat flags, observability misconfigurations, and binding-code inconsistencies between the configuration file and source code. These configuration drift issues can cause runtime errors and security vulnerabilities in Cloudflare Workers.

Why does my Cloudflare Worker crash due to module-level mutable state?

Cloudflare Workers crash due to module-level mutable state because the runtime isolates requests, meaning global variables do not persist reliably across executions. Production code reviews identify this anti-pattern alongside floating promises and serialization boundary errors to prevent unexpected state loss and concurrency issues.

How do I validate Durable Objects and Queues bindings in my Workers project?

Validate Durable Objects and Queues bindings by retrieving the latest @cloudflare/workers-types and wrangler schema, then comparing binding declarations in wrangler config against the actual source code access patterns. This ensures binding consistency and prevents runtime reference errors.

Does passThroughOnException misuse cause security issues in Cloudflare Workers?

Yes, passThroughOnException misuse causes security issues by potentially exposing internal error details or bypassing intended security boundaries. Production best-practice reviews flag insecure crypto usage and passThroughOnException misuse to enforce proper error handling and data protection.