workers-best-practices

Review Cloudflare Workers code against latest best practices and wrangler.jsonc configs.

Updated Mar 31, 2024
One-click install
npx skills add https://github.com/claughinghouse/dotfiles --skill workers-best-practices-claughinghouse
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: workers-best-practices
Source: https://github.com/claughinghouse/dotfiles/tree/main/dot_config/opencode/skills/workers-best-practices
Command: npx skills add https://github.com/claughinghouse/dotfiles --skill workers-best-practices-claughinghouse

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Reviews and authors Cloudflare Workers code against production best practices. Load when writing new Workers, reviewing Worker code, configuring wrangler.jsonc, or checking for common Workers anti-patterns (streaming, floating promises, global state, secrets, bindings, observability). Biases towards retrieval from Cloudflare docs over pre-trained knowledge.

Core Features & Use Cases

  • Retrieval-driven guidance: fetch latest best practices, types, and config schemas before reviews to ensure alignment with current standards.
  • Anti-pattern detection: identify streaming pitfalls, floating promises, global state usage, insecure secret handling, and observability gaps.
  • Structured review workflow: validate bindings, config fields, and observability settings to produce actionable feedback.

Quick Start

Review a new or existing Worker script against the latest Cloudflare Workers best-practices and annotate any anti-patterns.

Frequently Asked Questions about workers-best-practices

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

FAQPage Schema
How do I check my Cloudflare Workers code for anti-patterns?

Detecting Cloudflare Workers anti-patterns involves reviewing scripts for floating promises, global state usage, and insecure secret handling. Retrieving the latest types and documentation before flagging ensures the review aligns with current production standards.

What are common Cloudflare Workers misconfigurations in wrangler.jsonc?

Common Cloudflare Workers misconfigurations in wrangler.jsonc involve incorrect bindings, missing observability settings, and invalid config fields. Validating the wrangler config schema against current documentation helps identify and resolve these structural misconfigurations.

Does this approach retrieve the latest Cloudflare Workers types before reviewing code?

Yes, the approach retrieves the latest Cloudflare Workers types, best practices pages, and wrangler config schema before reviewing code. This retrieval-driven guidance ensures feedback is based on current standards rather than pre-trained knowledge.

What is the best way to enforce Cloudflare Workers observability and secrets checks?

The best way to enforce Cloudflare Workers observability and secrets checks is through a structured review workflow. This process validates observability settings and secure secret handling while fetching current documentation to produce actionable feedback.

Why does my Cloudflare Worker have global state issues?

Cloudflare Workers global state issues occur because scripts run in isolated execution environments that do not persist state between requests. Identifying global state usage as an anti-pattern during code review prevents unexpected behavior in production deployments.