workers-best-practices

Reviews and implements Cloudflare Workers code against runtime APIs, bindings, and config rules.

1|Updated Jul 16, 2026
One-click install
npx skills add https://github.com/sota411/codex-config --skill workers-best-practices-sota411
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: workers-best-practices
Source: https://github.com/sota411/codex-config/tree/main/user-skills/workers-best-practices
Command: npx skills add https://github.com/sota411/codex-config --skill workers-best-practices-sota411

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Cloudflare Workers code often breaks due to stale API signatures, wrong binding access patterns, floating promises, secrets in config, or outdated compatibility dates. This Skill grounds implementation and review work in the current Workers runtime types, Wrangler schema, and documented best practices so changes are verified rather than assumed. ## Core Features & Use Cases - Implementation guidance: Applies rules for streaming, waitUntil, request isolation, secrets management, bindings, Queues, Workflows, Hyperdrive, and observability when writing Workers code. - Structured code review: Checks type integrity (no any, no double-casting), binding access patterns (env.X vs this.env.X), wrangler config validity, serialization boundaries, and security issues, reporting findings with severity, file/line, and evidence. - Retrieval-first verification: Fetches the latest @cloudflare/workers-types and Wrangler config-schema.json instead of guessing API signatures or config fields. - Use Case: When adding a Queue binding to a Worker, use this Skill to verify the binding type, update wrangler.jsonc correctly, ensure messages are serializable, and confirm no floating promises remain in the handler. ## Quick Start Review my Cloudflare Worker code and wrangler config for best-practice violations and type errors.

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 best practices?▼

Fetch the latest @cloudflare/workers-types and Wrangler config schema, then check binding access patterns, handler signatures, config validity, and anti-patterns like floating promises or global state. Report findings with severity, file/line, and evidence.

What is the correct way to access bindings in Cloudflare Workers?▼

Module export handlers (fetch, scheduled, queue) access bindings via the env parameter as env.X. Classes extending platform base classes like WorkerEntrypoint or DurableObject use this.env.X. Mixing these patterns is the most common Workers error.

Should I use wrangler.toml or wrangler.jsonc for Workers config?▼

Use wrangler.jsonc for new projects since newer features are JSON-only and JSONC supports comments. wrangler.toml is legacy and acceptable in existing projects but should be flagged in new ones.

Why does my Cloudflare Worker crash on large responses?▼

Buffering entire bodies with await response.text() or arrayBuffer() exceeds the 128 MB memory limit on large payloads. Stream data through using TransformStream or pass response.body directly to the new Response instead.

When should I use Queues versus Workflows in Cloudflare Workers?▼

Use Queues for decoupling producers from consumers, fan-out, and simple single-step background jobs with at-least-once delivery. Use Workflows for multi-step durable execution where each step's result is persisted and only failed steps retry.

How do I store secrets for Cloudflare Workers securely?▼

Set secrets with wrangler secret put and access them via env at runtime; never place them in wrangler config vars or source code. Non-secret configuration values belong in the vars section of wrangler.jsonc.