workers-best-practices

Review Cloudflare Workers code for streaming, promises, state, secrets, and error handling.

Updated Nov 3, 2025
One-click install
npx skills add https://github.com/ethicalcapital/skills --skill workers-best-practices-ethicalcapital
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: workers-best-practices
Source: https://github.com/ethicalcapital/skills/tree/main/workers-best-practices
Command: npx skills add https://github.com/ethicalcapital/skills --skill workers-best-practices-ethicalcapital

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides guidelines for reviewing, writing, and debugging Cloudflare Workers code, ensuring production-quality standards are met.

Core Features & Use Cases

  • Code Quality Guidelines: Offers best practices for streaming responses, managing promises, state, secrets, and error handling.
  • Performance Optimization: Focuses on optimizing streaming responses and managing CPU and memory efficiently.
  • Security: Ensures proper management of secrets and adherence to security best practices.
  • Observability: Emphasizes structured logging and PostHog events for error tracking and monitoring.
  • Quick Start: Streamlines development workflows with guidelines on using environment variables, bindings, and queueing for heavy work.

Quick Start

Review your Cloudflare Workers code using the 'workers-best-practices' skill to ensure it follows best practices for production deployment.

Frequently Asked Questions about workers-best-practices

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

FAQPage Schema
What are the best practices for managing state and secrets in Cloudflare Workers?

Best practices for managing state and secrets in Cloudflare Workers involve using environment variables and bindings securely to ensure production-quality code and proper access management.

How do I optimize streaming responses in Cloudflare Workers?

Optimizing streaming responses in Cloudflare Workers requires managing CPU and memory efficiently while adhering to performance optimization guidelines to ensure smooth data flow.

Why does unmanaged promise handling cause issues in Cloudflare Workers?

Unhandled promises in Cloudflare Workers lead to execution failures and unpredictable state; proper promise management is essential to maintain code quality and prevent runtime errors.

What is the best way to track errors in Cloudflare Workers?

The best way to track errors in Cloudflare Workers is implementing observability through structured logging and PostHog events for comprehensive error tracking and monitoring.

Can I use queueing for heavy work in Cloudflare Workers?

Yes, you can use queueing for heavy work in Cloudflare Workers to streamline development workflows and offload intensive processes from the main execution thread.

How do I handle environment variables and bindings when writing Cloudflare Workers code?

Handling environment variables and bindings in Cloudflare Workers requires following quick start guidelines to streamline development workflows and ensure secure configuration.