workers-best-practices

Review Cloudflare Workers code and wrangler.jsonc against current best practices.

17|1|Updated Feb 2, 2024
One-click install
npx skills add https://github.com/FormalSnake/dotfiles --skill workers-best-practices-formalsnake
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: workers-best-practices
Source: https://github.com/FormalSnake/dotfiles/tree/main/users/kyandesutter/claude/skills/workers-best-practices
Command: npx skills add https://github.com/FormalSnake/dotfiles --skill workers-best-practices-formalsnake

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It reduces production failures and security issues in Cloudflare Workers by ensuring code, types, and wrangler configuration follow current best practices instead of relying on outdated knowledge.

Core Features & Use Cases

  • Best-practices-driven code review: flags common anti-patterns such as floating promises, unbounded buffering, unsafe global state, and incorrect error handling.
  • Config and type validation workflow: guides retrieval of the latest Workers best practices, Workers types, and wrangler config schema, then checks binding correctness, handler signatures, and serialization boundaries.
  • Security and observability enforcement: emphasizes correct secret handling via wrangler secret, secure randomness via Web Crypto, structured logging/observability settings, and evidence-based review outputs.

Quick Start

Ask the AI to review your Workers code and wrangler.jsonc for anti-patterns, type correctness, and production best-practice compliance, using fresh retrieval from 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 check my Cloudflare Workers code for production readiness?

Reviewing Cloudflare Workers code for production readiness involves checking for common anti-patterns like floating promises and unsafe global state. You must validate wrangler.jsonc configuration, ensure correct secret handling, and verify handler signatures against the latest Workers type definitions and best-practices guidance.

What are common Cloudflare Workers anti-patterns I should look for in code review?

Common Cloudflare Workers anti-patterns to look for in code review include floating promises, unbounded buffering, unsafe global state, and incorrect error handling. You should also check for improper secret handling, insecure randomness, and missing structured logging or observability settings in request/response flows.

How do I validate wrangler.jsonc settings and bindings for Cloudflare Workers?

Validate wrangler.jsonc settings by retrieving the latest wrangler config schema and Workers type definitions. Check binding correctness, verify handler signatures, and ensure serialization boundaries are properly defined without guessing API shapes or type signatures.

Does this Workers review process support TypeScript types and Web Crypto security?

Yes, the Workers review process supports TypeScript types and Web Crypto security. It emphasizes evidence-based retrieval of Workers type definitions to validate type correctness, and enforces secure randomness via Web Crypto APIs alongside correct secret handling via wrangler secret.

Why does my Cloudflare Worker fail in production after passing local tests?

Your Cloudflare Worker may fail in production due to anti-patterns not caught locally, such as unbounded buffering, unsafe global state, or incorrect error handling. Validate your wrangler.jsonc configuration and ensure your code follows current production best practices and security guidance.