Agent skill

Workers Best Practices

by hodgef in hodgef/apiker

Reviews and authors Cloudflare Workers code against production best practices.

MITAuto-check passedDevOps & Cloud

Install Workers Best Practices

skills CLI
$ npx skills add hodgef/apiker --skill workers-best-practices -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install hodgef/apiker workers-best-practices --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/hodgef/apiker.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/workers-best-practices .claude/skills/workers-best-practices && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
workers-best-practices
GitHub stars
127
Used in
6 other repos
Token cost
~1.8k tokens
SKILL.md length
706 words
Files
3 (incl. references)
Skills in repo
11
Repo updated
First seen
Licence
MIT

At a glance

Reviews and authors Cloudflare Workers code against production best practices.

  • Works in 8 steps: Retrieve — fetch latest best practices… → Read full files — not just diffs;… → Check types — binding access, handler… → …
  • Tasks that involve State management
  • SKILL.md covers Retrieval Sources, FIRST: Fetch Latest References, Reference Documentation and Rules Quick Reference, plus 4 more sections
  • Calls wrangler, npm and npx; reaches developers.cloudflare.com

What it does

Workers Best Practices is an agent skill from hodgef/apiker. 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.

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/review.md` and `references/rules.md`).

It sits in DevOps & Cloud, covering State management and Observability. It works with Cloudflare Workers, Cloudflare and Node.js. The repository describes itself as: 🔼 Create Serverless APIs with Cloudflare Workers, Durable Objects & Wrangler. The licence is MIT.

When your agent uses it

  • Tasks that involve State management
  • Tasks that involve Observability

Example prompts

  • “Use the workers-best-practices skill to review and authors Cloudflare Workers code against production best practices”
  • “/workers-best-practices”

Requirements

  • Node.js

Workflow steps

8 steps, taken from the first numbered list in SKILL.md.

  1. Retrieve — fetch latest best practices page, workers types, and wrangler schema
  2. Read full files — not just diffs; context matters for binding access patterns
  3. Check types — binding access, handler signatures, no any, no unsafe casts (see references/review.md)
  4. Check config — compatibility_date, nodejs_compat, observability, secrets, binding-code consistency
  5. Check patterns — streaming, floating promises, global state, serialization boundaries
  6. Check security — crypto usage, secret handling, timing-safe comparisons, error handling
  7. Validate with tools — npx tsc --noEmit, lint for no-floating-promises
  8. Reference rules — see references/rules.md for each rule's correct pattern

What it can do on your machine

Read from SKILL.md and the folder at commit 444ace2. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • wrangler
    • npm
    • npx

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • developers.cloudflare.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Workers Best Practices loads about 1.8k tokens when it runs, and up to ~7.9k if it reads all its reference files. Until then it costs about 96 tokens; SKILL.md has 706 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~96
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~7.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from hodgef/apiker at commit 444ace2, republished under its MIT licence (© hodgef). 706 words, ~1,761 tokens.

Download SKILL.mdSave it as .claude/skills/workers-best-practices/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
workers-best-practices
description
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.

Your knowledge of Cloudflare Workers APIs, types, and configuration may be outdated. Prefer retrieval over pre-training for any Workers code task — writing or reviewing.

Retrieval Sources

Fetch the latest versions before writing or reviewing Workers code. Do not rely on baked-in knowledge for API signatures, config fields, or binding shapes.

SourceHow to retrieveUse for
Workers best practicesFetch https://developers.cloudflare.com/workers/best-practices/workers-best-practices/Canonical rules, patterns, anti-patterns
Workers typesSee references/review.md for retrieval stepsAPI signatures, handler types, binding types
Wrangler config schemanode_modules/wrangler/config-schema.jsonConfig fields, binding shapes, allowed values
Cloudflare docsSearch tool or https://developers.cloudflare.com/workers/API reference, compatibility dates/flags

FIRST: Fetch Latest References

Before reviewing or writing Workers code, retrieve the current best practices page and relevant type definitions. If the project's node_modules has an older version, prefer the latest published version.

bash
# Fetch latest workers types
mkdir -p /tmp/workers-types-latest && \
  npm pack @cloudflare/workers-types --pack-destination /tmp/workers-types-latest && \
  tar -xzf /tmp/workers-types-latest/cloudflare-workers-types-*.tgz -C /tmp/workers-types-latest
# Types at /tmp/workers-types-latest/package/index.d.ts

Reference Documentation

  • references/rules.md — all best practice rules with code examples and anti-patterns
  • references/review.md — type validation, config validation, binding access patterns, review process

Rules Quick Reference

Configuration
RuleSummary
Compatibility dateSet compatibility_date to today on new projects; update periodically on existing ones
nodejs_compatEnable the nodejs_compat flag — many libraries depend on Node.js built-ins
wrangler typesRun wrangler types to generate Env — never hand-write binding interfaces
SecretsUse wrangler secret put, never hardcode secrets in config or source
wrangler.jsoncUse JSONC config for non-secret settings — newer features are JSON-only
Request & Response Handling
RuleSummary
StreamingStream large/unknown payloads — never await response.text() on unbounded data
waitUntilUse ctx.waitUntil() for post-response work; do not destructure ctx
Architecture
RuleSummary
Bindings over RESTUse in-process bindings (KV, R2, D1, Queues) — not the Cloudflare REST API
Queues & WorkflowsMove async/background work off the critical path
Service bindingsUse service bindings for Worker-to-Worker calls — not public HTTP
HyperdriveAlways use Hyperdrive for external PostgreSQL/MySQL connections
Observability
RuleSummary
Logs & TracesEnable observability in config with head_sampling_rate; use structured JSON logging
Code Patterns
RuleSummary
No global request stateNever store request-scoped data in module-level variables
Floating promisesEvery Promise must be awaited, returned, voided, or passed to ctx.waitUntil()
Security
RuleSummary
Web CryptoUse crypto.randomUUID() / crypto.getRandomValues() — never Math.random() for security
No passThroughOnExceptionUse explicit try/catch with structured error responses
Show full SKILL.md (352 more words)Show less

Anti-Patterns to Flag

Anti-patternWhy it matters
await response.text() on unbounded dataMemory exhaustion — 128 MB limit
Hardcoded secrets in source or configCredential leak via version control
Math.random() for tokens/IDsPredictable, not cryptographically secure
Bare fetch() without await or waitUntilFloating promise — dropped result, swallowed error
Module-level mutable variables for request stateCross-request data leaks, stale state, I/O errors
Cloudflare REST API from inside a WorkerUnnecessary network hop, auth overhead, added latency
ctx.passThroughOnException() as error handlingHides bugs, makes debugging impossible
Hand-written Env interfaceDrifts from actual wrangler config bindings
Direct string comparison for secret valuesTiming side-channel — use crypto.subtle.timingSafeEqual
Destructuring ctx (const { waitUntil } = ctx)Loses this binding — throws "Illegal invocation" at runtime
any on Env or handler paramsDefeats type safety for all binding access
as unknown as T double-castHides real type incompatibilities — fix the design
implements on platform base classes (instead of extends)Legacy — loses this.ctx, this.env. Applies to DurableObject, WorkerEntrypoint, Workflow
env.X inside platform base classShould be this.env.X in classes extending DurableObject, WorkerEntrypoint, etc.

Review Workflow

  1. Retrieve — fetch latest best practices page, workers types, and wrangler schema
  2. Read full files — not just diffs; context matters for binding access patterns
  3. Check types — binding access, handler signatures, no any, no unsafe casts (see references/review.md)
  4. Check config — compatibility_date, nodejs_compat, observability, secrets, binding-code consistency
  5. Check patterns — streaming, floating promises, global state, serialization boundaries
  6. Check security — crypto usage, secret handling, timing-safe comparisons, error handling
  7. Validate with tools — npx tsc --noEmit, lint for no-floating-promises
  8. Reference rules — see references/rules.md for each rule's correct pattern

Scope

This skill covers Workers-specific best practices and code review. For related topics:

  • Durable Objects: load the durable-objects skill
  • Workflows: see Rules of Workflows
  • Wrangler CLI commands: load the wrangler skill

Principles

  • Be certain. Retrieve before flagging. If unsure about an API, config field, or pattern, fetch the docs first.
  • Provide evidence. Reference line numbers, tool output, or docs links.
  • Focus on what developers will copy. Workers code in examples and docs gets pasted into production.
  • Correctness over completeness. A concise example that works beats a comprehensive one with errors.

© hodgef, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in .agents/skills/workers-best-practices of hodgef/apiker.

  • SKILL.md
  • references/review.md
  • references/rules.md

Open the folder on GitHubat commit 444ace2

Used in 6 other repositories

We found 6 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 6 other GitHub owners. This page covers the copy in hodgef/apiker, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Workers Best Practices next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Workers Best Practices compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Workers Best Practices this skillhodgef/apiker1276 repos~1.8kAutomated safety check: PassMIT
Observability Triageevery-app/open-seo23k—~1.7kAutomated safety check: PassMIT
Cloudflare Sandboxsecondsky/claude-skills227—~4.5kAutomated safety check: PassMIT
Effect Httpapi Workers PatternsConsensys/c0105—~1.4kAutomated safety check: PassLGPL-3.0
Building AI Agent On CloudflareCommandCodeAI/agent-skills132—~2.3kAutomated safety check: PassMIT
Cloudflare Nextjssecondsky/claude-skills227—~5.3kAutomated safety check: NotesMIT

Similar skills

  • Observability Triage

    every-app/open-seo

    Triage OpenSEO production errors in Cloudflare Workers Observability — verified query recipes, counting gotchas, and a known-noise filter list applied automatically.

    23k GitHub stars~1.7k tokensUpdated today
    DevOps & CloudAuto-check passed
  • Cloudflare Sandbox

    secondsky/claude-skills

    Cloudflare Sandboxes SDK for secure code execution in Linux containers at edge.

    227 GitHub stars~4.5k tokensUpdated 11 days ago
    DevOps & CloudAuto-check passed
  • Build, refactor, or review Effect v4 HttpApi services on Cloudflare Workers.

    105 GitHub stars~1.4k tokensUpdated 1 mo ago
    DevOps & CloudAuto-check passed
  • Building AI Agent On Cloudflare

    CommandCodeAI/agent-skills

    Builds AI agents on Cloudflare using the Agents SDK with state management, real-time WebSockets, scheduled tasks, tool integration, and chat capabilities.

    132 GitHub stars~2.3k tokensUpdated 7 mo ago
    Backend & APIsAuto-check passed
  • Cloudflare Nextjs

    secondsky/claude-skills

    Deploy Next.js to Cloudflare Workers via the OpenNext adapter (@opennextjs/cloudflare).

    227 GitHub stars~5.3k tokensUpdated 11 days ago
    Backend & APIsAuto-check: notes
  • Sap Btp Developer Guide

    secondsky/sap-skills

    Develops business applications on SAP Business Technology Platform (BTP) using CAP (Node.js/Java) or ABAP Cloud.

    462 GitHub stars~4.4k tokensUpdated 4 days ago
    DevOps & CloudAuto-check passed

More from hodgef/apiker

All 11 skills in this repo
  • Cloudflare

    hodgef/apiker

    Comprehensive Cloudflare platform skill covering Workers, Pages, storage (KV, D1, R2), AI (Workers AI, Vectorize, Agents SDK), feature flags (Flagship), networking (Tunnel, Spectrum), security (WAF…

    127 GitHub starsUsed in 7 repos~2.2k tokens
    Auto-check passed
  • Durable Objects

    hodgef/apiker

    Create and review Cloudflare Durable Objects. An agent skill from hodgef/apiker.

    127 GitHub starsUsed in 4 repos~1.5k tokens
    Auto-check passed
  • Send and receive transactional emails with Cloudflare Email Service (Email Sending + Email Routing).

    127 GitHub starsUsed in 2 repos~2k tokens
    Auto-check passed
  • Web Perf

    hodgef/apiker

    Analyzes web performance using Chrome DevTools MCP. An agent skill from hodgef/apiker.

    127 GitHub starsUsed in 5 repos~2k tokens
    Auto-check passed
  • Apiker

    hodgef/apiker

    Develop, review, and extend the Apiker library — a framework for building serverless REST APIs on Cloudflare Workers + Durable Objects.

    127 GitHub stars~1.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Agents SDK

    hodgef/apiker

    Build AI agents on Cloudflare Workers using the Agents SDK. An agent skill from hodgef/apiker.

    127 GitHub starsUsed in 3 repos~3k tokens
    Auto-check passed

Questions about Workers Best Practices

What does Workers Best Practices do?

Reviews and authors Cloudflare Workers code against production best practices. Workers Best Practices is an agent skill from hodgef/apiker. Reviews and authors Cloudflare Workers code against production best practices.

When should I use Workers Best Practices?

Workers Best Practices fits situations like: tasks that involve State management; tasks that involve Observability.

How do I install Workers Best Practices in Claude Code?

Run `npx skills add hodgef/apiker --skill workers-best-practices -a claude-code`. Or copy the skill folder (.agents/skills/workers-best-practices in hodgef/apiker) into .claude/skills/workers-best-practices in your project. Claude Code loads it when a task matches its description.

How do I install Workers Best Practices in Codex?

Run `npx skills add hodgef/apiker --skill workers-best-practices -a codex`. Or copy the skill folder (.agents/skills/workers-best-practices in hodgef/apiker) into .agents/skills/workers-best-practices in your project. Codex loads it when a task matches its description.

Can I use Workers Best Practices in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add hodgef/apiker --skill workers-best-practices -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/workers-best-practices, .gemini/skills/workers-best-practices, .github/skills/workers-best-practices and .opencode/skills/workers-best-practices in your project.

What does Workers Best Practices need to run?

Going by SKILL.md and its folder, Workers Best Practices needs the command-line tools its instructions call (wrangler, npm and npx). Our summary lists: Node.js.

Does Workers Best Practices access the network?

SKILL.md names 1 domain. In commands or code: developers.cloudflare.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Workers Best Practices safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Workers Best Practices use?

Workers Best Practices is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Workers Best Practices use?

About 1.8k tokens (SKILL.md is roughly 7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 6.2k tokens, read only when the agent opens those files.

What are the alternatives to Workers Best Practices?

Skills that share tags, products or a category with Workers Best Practices: Observability Triage (every-app/open-seo, 23k stars), Cloudflare Sandbox (secondsky/claude-skills, 227 stars), Effect Httpapi Workers Patterns (Consensys/c0, 105 stars) and Building AI Agent On Cloudflare (CommandCodeAI/agent-skills, 132 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Workers Best Practices?

hodgef (a GitHub user) maintains it in hodgef/apiker, which has 127 GitHub stars. The repository holds 11 skills in this directory. The repository was last updated on August 20, 2026.

Source: hodgef/apiker on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.