cloudflare-workers
Use these Cloudflare Worker guidelines when editing, reviewing, or executing a Cloudflare Worker; e.g. D1 queries, handlers, Wrangler commands, and Wrangler…
от quisido★ 31 звезда на GitHub
Установить cloudflare-workers в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Cloudflare Workers guidelines
Configuration
- Keep
wrangler.jsoncenvironments separated intodev,staging, andproduction. Each should have distinct binding names and dataset names.
Commands
- Use
wrangler deploy --dry-runto validate the build output. - Use
wrangler dev --persist-to ../../.wrangler/statefor local development so that D1 and KV state is persisted across restarts. - Run
wrangler typesto regenerateworker-configuration.d.tswhenever new bindings are added or changed inwrangler.jsonc.
Deployments occur through CI/CD. You do not have access to the necessary secrets to deploy.
Conventions
- Access secrets and bindings exclusively via the typed
Envinterface generated inworker-configuration.d.ts; never hard-code secrets or credentials. - Emit observability data through the
@quisido/workerframework (emitPublicMetric/emitPrivateMetric), not directwriteDataPointcalls; see "Worker framework" below. fetchhandlers should always return aResponse; never let unhandled exceptions propagate to the runtime.- Respect Cloudflare Worker CPU-time limits: avoid long synchronous loops;
prefer streaming responses (
TransformStream,ReadableStream) for large payloads. - Use
ctx.waitUntilfor fire-and-forget side effects (e.g., logging, cache writes) that must complete but can wait until after theResponseis returned. - Use parameterized queries (
?placeholders) to prevent SQL injection. Never interpolate user input into SQL strings. - Use the
Request/ResponseWeb APIs in Worker handlers. Never use Node's built-inhttpmodule.
Worker framework
Services subclass the framework rather than writing a raw
export default { fetch }. The class hierarchy is Handler -> FetchHandler
-> the service handler (e.g. AuthnFetchHandler); ExportedHandler adapts the
class to Cloudflare's module-worker entry.
- Access bindings through
validateBinding(key, guard, default?), never the rawEnv. Services override it to map a missing or invalid binding to a domain error. - Side effects are events, not direct calls: use
emitPublicMetric/emitPrivateMetric,affect(promise), andlogError. The handler subscribes (onMetric,onSideEffect,onError) and owns flushing. UselogError(error)rather thanconsole.*; the console is the emitter's last-resort fallback only. - Every metric must declare accessibility (
emitPublicMetricversusemitPrivateMetric).handle-metric.tsroutes public metrics toPUBLIC_DATASETand private metrics toPRIVATE_DATASET, redacting private fields. A metric emitting without explicit accessibility is dropped and logged.
Error handling
- The
fetchboundary never throws to the runtime:FetchHandlerconverts every thrown value into aResponse(default: internal server error). - Throw
FatalError(code)for expected failures, wherecodeis anErrorCodefrom the service's*-sharedpackage (e.g.@quisido/authn-shared,@quisido/csp-shared). Emit/log at the throw site; the boundary will not re-log aFatalError. - Treat any non-
FatalErroras unknown: normalize withmapToError, emit anUnknownErrormetric, log it, and respond withErrorCode.Unknown. - New error conditions get a new
ErrorCodemember in the*-sharedpackage, not an ad-hoc string. Cross-boundary contracts (error and response codes, their type guards) live in*-sharedbecause they are shared by the worker and its client.
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл cloudflare-workers?
Use these Cloudflare Worker guidelines when editing, reviewing, or executing a Cloudflare Worker; e.g. D1 queries, handlers, Wrangler commands, and Wrangler configurations.
Как установить скилл cloudflare-workers?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cloudflare-workers запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…