Skip to content
Back to skills

Cloudflare Workers Knowledge Patch

ASecurity

Cloudflare Workers

  • 25 stars
  • 0 votes
  • 0 copies
  • 15 views
  • Added September 5, 2026
developmentjavascripttypescriptpythongojavasqlnodenodejstestinggit

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill cloudflare-workers-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cloudflare Workers Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Cloudflare Workers Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-cloudflare-workers-knowledge-patch-nevaberry-plugins/badge)](https://www.skillsdirectory.com/skills/nevaberry-cloudflare-workers-knowledge-patch-nevaberry-plugins)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: cloudflare-workers-knowledge-patch
description: Cloudflare Workers
version: null
license: MIT
metadata:
  author: Nevaberry
---



# Cloudflare Workers Knowledge Patch

Load this skill when changing Workers compatibility settings, migrating Wrangler or Pages,
using RPC and WebSockets, or working with Workers tooling, deployments, and bindings.
The references contain the detailed conditions, opt-outs, limits, and examples.

## Reference index

| Reference | Topics |
| --- | --- |
| [Node.js compatibility](references/nodejs-compatibility.md) | Defaults, native coverage, stubs, module loading, environment bindings, timers, API removals |
| [RPC and WebSockets](references/rpc-and-websockets.md) | Stub ownership, pipelining, Python interoperability, close behavior, TCP and public-beta gRPC |
| [Runtime and web platform](references/runtime-and-web-platform.md) | Cancellation, Fetch, caching, streams, encodings, contexts, web APIs, Python, Dynamic Workers |
| [Static assets and Pages migration](references/static-assets-and-pages-migration.md) | Routing, fallbacks, asset prefixes, Functions, bindings, builds, domains, images |
| [Wrangler, Vite, types, and testing](references/wrangler-tooling-and-testing.md) | CLI migrations, authentication, Vite configuration, Artifacts, generated types, test harnesses |
| [Agents and MCP](references/runtime-and-web-platform.md#agents-mcp-and-computer-workspaces) | Protocol negotiation, server migration, elicitation, Code Mode, Workspace preview and replay |
| [Durable Objects and Workflows](references/rpc-and-websockets.md#durable-objects-workflows-queues-and-containers) | Storage, code updates, retries, Workflow jurisdiction and concurrency, Queues, Containers |
| [Observability and tracing](references/wrangler-tooling-and-testing.md#observability-tracing-logs-and-profiling) | Local traces, agent traces, custom spans, logs, Tail Workers, startup and Preview profiles |
| [Deployments and operations](references/wrangler-tooling-and-testing.md#deployments-access-builds-and-usage) | Routes, Access, permissions, Builds, retention, placement, previews, rate limits, spending |

## Breaking changes and deprecations

### Wrangler migration and resource targets

Wrangler v4 KV key and bulk operations and R2 object operations default to local data.
Add `--remote` to scripts targeting deployed resources, such as
`wrangler kv key get --binding MY_KV my-key --remote`.

| Removed or deprecated usage | Migration |
| --- | --- |
| `getBindingsProxy()` | `getPlatformProxy()` with the same arguments |
| `wrangler version` | `wrangler --version` |
| `wrangler publish` / `wrangler pages publish` | `wrangler deploy` / `wrangler pages deploy` |
| `wrangler generate` | `npm create cloudflare@latest` |
| `legacy_assets`, `--legacy-assets`, Workers Sites | Workers Static Assets |
| `node_compat`, `--node-compat` | `nodejs_compat` compatibility flag |
| Service environments enabled through `legacy_env` | Wrangler environments |

Remove `usage_model`. Wrangler v4 supports Node.js Current, Active LTS, and Maintenance LTS
releases; upgrade development and CI environments still pinned to Node.js 16 or 18.
Dynamic imports such as `import('./data/' + kind + '.json')` bundle every matching file.
Wrangler can update esbuild in minor releases.

### Node.js defaults, module loading, and API removals

Starting at compatibility date `2026-08-04`, `nodejs_compat` and `nodejs_compat_v2` behavior
is enabled by default; tooling ignores either explicit enable flag as redundant.
For older dates, opt in with `nodejs_compat`. To disable compatibility entirely, remove
both enable flags and add both `no_nodejs_compat` and `no_nodejs_compat_v2`.

JavaScript Workers use the new module registry from `2026-11-17`; Python Workers use
the legacy registry. Use `new_module_registry` earlier or `legacy_module_registry` to
opt out. With `nodejs_compat`, `require()` can load ES modules whose dependency graph
has no top-level `await`.

`require_returns_default_export` makes `require()` return the default export if present,
or a mutable namespace copy otherwise. `require_returns_namespace` retains the namespace.
The Node.js reference records its date and the separate top-level-await behavior.

`remove_nodejs_compat_eol` rolls up version-specific API removals as their dates take effect.
Use `add_nodejs_compat_eol` or a targeted opt-out when a dependency imports an old API;
restored APIs may still be stubs. A successful polyfill import does not mean its methods
work: mocked methods may do nothing or throw an unimplemented-method error.

### RPC ownership and WebSocket changes

`rpc_params_dup_stubs` duplicates RPC parameter stubs and leaves the sender's stub usable.
The callee's parameter copy is disposed when the call returns; call `stub.dup()` in the
callee to retain it. `rpc_params_transfer_stubs` restores ownership transfer.

`web_socket_auto_reply_to_close` replies to a peer's Close frame and sets `readyState`
to `CLOSED` before the `close` event. Use `web_socket_manual_reply_to_close` for the
previous default, or `accept({ allowHalfOpen: true })` when coordinating a proxy's close.
For outbound half-open sockets, use a Fetch upgrade and accept the returned socket.

`websocket_standard_binary_type` defaults `binaryType` to `"blob"`. Set
`ws.binaryType = "arraybuffer"` before accepting, or use `no_websocket_standard_binary_type`.
Hibernatable Durable Object `webSocketMessage` handlers still receive `ArrayBuffer`.
`websocket_close_reason_byte_limit` rejects reasons longer than 123 UTF-8 bytes.

### Types and Workers tests

`@cloudflare/workers-types` v5 removes dated entrypoints. Its root tracks the latest
stable compatibility settings; `@cloudflare/workers-types/experimental` exposes experimental APIs. For types
matching a Worker's flags and date, run `wrangler types` and add
`./worker-configuration.d.ts` to `compilerOptions.types` in `tsconfig.json`.
Use `wrangler types --check` to verify a committed file in CI.

Workers Vitest v1 moves from `@cloudflare/vitest-pool-workers` to `@cloudflare/vitest-plugin`.
Update dependencies, imports, and test TypeScript `types`, or run:

```sh
npx @cloudflare/codemods vitest:pool-workers-to-vitest-plugin
```

Use Wrangler's `createTestHarness()` in place of `unstable_startWorker()` or `unstable_dev()`
for integration tests against production builds. `server.fetch()` uses configured routes;
`server.reset()` resets storage between tests. Use `@msw/cloudflare` for outbound mocks.

### MCP and CLI migrations

`McpAgent` is feature-frozen. Replace `createMcpHandler(v1Server, options)` before the next
major version with an SDK v2 factory, or temporarily use `createLegacyMcpHandler` for
sessionful features. Keep the legacy route until those features migrate and sessions drain.
The MCP reference includes protocol negotiation, transport changes, and elicitation handlers.

`cf` 1.0.0-rc.1 writes Build Output to `.cloudflare/output/v1/` and rebuilds on first deploy.
Its Vite builds require `@cloudflare/vite-plugin` 2.0.0-rc.0 or later; Wrangler builds require
Wrangler 4.163.0 or later. Replace `cf workers secrets bulk` with `cf workers secrets bulk-edit`.
The tooling reference preserves the early-beta script, account, and state migrations.

## Request and asset behavior

Incoming `request.signal` receives client disconnection events by default from `2026-11-17`.
Use `disable_request_signal` to opt out. Pass `{ signal: request.signal }` to outbound
`fetch()` to explicitly cancel it on disconnection; `request_signal_passthrough` separately
propagates the signal when forwarding with `fetch(request)`.

`fetch_iterable_type_support` streams synchronous and asynchronous iterable bodies.
Explicitly stringify arrays if callers relied on comma-separated text. The runtime reference
preserves the custom-stringification adjustment, its date condition, and both opt-outs.

`redirect: "error"` is supported in `fetch()` and `new Request()` from `2026-12-22`, or earlier
with `fetch_redirect_error`. It rejects 301, 302, 303, 307, and 308 with `TypeError` even
without `Location`; other 3xx responses resolve normally. Use `no_fetch_redirect_error` to opt out.

Workers serves matching static assets before the script by default. Configure
`assets.run_worker_first` for middleware that must run before serving files; an array selects
path patterns and leading `!` excludes paths. Navigation requests can prefer asset handling.
Use `assets_navigation_has_no_effect` for earlier behavior or `assets.run_worker_first = true`
to give the Worker priority.

Set `assets.not_found_handling = "single-page-application"` explicitly for SPA fallback:
an asset miss handled by that fallback serves `index.html` with HTTP 200.
`"404-page"` serves the nearest `404.html` with HTTP 404. Migrated Pages code needs
`assets.binding = "ASSETS"` to preserve `env.ASSETS.fetch(request)` calls.

For asset prefixes, use `assets.base_path` in Wrangler 4.148.0 or later, or
`worker.assets.basePath` in `cf` 1.0.0-beta.13 or later. Use the full public path in
`_headers`, `_redirects`, and `run_worker_first`. For the `/blog` example, set Vite's `base` to `"/blog/"`.

## Durable Objects and Workflows

Accounts without an existing KV-backed namespace must use `new_sqlite_classes` for new
namespaces; `new_classes` fails on those accounts. SQLite objects also support key-value storage.

Active Durable Objects can keep previous code for up to 300 seconds by default during
deployment; deferral is best effort. Hibernation API WebSockets can remain connected if
the object hibernates before adopting the update. The reference gives delay and mode controls.

The runtime retries transient Durable Object `fetch()` and RPC failures up to four times,
starting retries within 10 seconds of the initial call. Object-code exceptions and
`.overloaded` errors are excluded. Uncertain delivery is deduplicated unless an idempotent
method opts into possible repeat execution with `retryable()`.
Wrangler 4.158.0 or later supports marking methods and per-stub retry limits.

Workflow `jurisdiction` is fixed at creation. With Wrangler 4.152.0 or later, `wrangler deploy`
and `wrangler versions upload` stop before upload if the configured jurisdiction differs
from the existing Workflow's. Supported values are `eu`, `us`, and `fedramp`.
With Wrangler 4.127.0 or later, set a positive `concurrency.limit` at or below the account
limit and redeploy. Excess instances queue until a running instance finishes or waits;
lowering the limit lets already running instances continue.

## Observability and local development

`observability.enabled` also enables tracing with `enable_workers_observability_tracing`.
For older compatibility dates, use `{"observability":{"traces":{"enabled":true}}}`.
`wrangler dev` and `vite dev` automatically capture spans and correlated console logs.
Local Explorer's OpenAPI schema is at `/cdn-cgi/local/explorer/api`.

`tracing.startActiveSpan()` keeps its span open after the callback returns; call `span.end()`
when work completes or is canceled. Think and Flue emit agent traces with Workers tracing
enabled. For direct AI SDK v6 or v7 calls, call generation methods through `wrapAISDK(ai)`;
optionally pass `{ storeMessages: true, storeTools: true }` as its second argument to record payloads.

`cf observability tail` streams newline-delimited JSON. Enable Workers Logs for the target
Worker and select events with `--worker`, `--zone`, or `--all`; `--filters` accepts JSON or a file.
Preview profiling accepts a deployment or `latest`; Durable Objects need IDs from that Preview's namespace.

Artifacts bindings default to local repositories in Wrangler dev, the Vite plugin, and Vitest.
Use the latest Wrangler with Git 2.32 or later on `PATH`; `remote = true` selects deployed repositories.

## Deployments, usage, and durable agent work

Worker-level Access policies follow routes, custom domains, `workers.dev`, and preview URLs.
On authenticated requests, read `ctx.access.aud` and await `ctx.access.getIdentity()`.
Configure `access.dev` in `wrangler.jsonc` to inject a local test identity.

Worker versions and Pages deployments expire after 30 days, except for the 100 most recent
and currently deployed Worker versions or the current Pages production deployment.
Expiry removes rollback targets and invalidates their Version URLs, including `--preview-alias`
URLs, or their Pages preview URLs. Worker Preview URLs serve the latest deployment of that Preview.
Workers Builds records and logs expire after 90 days; download logs before expiry to retain them.

A product-specific `usage_block` spend policy blocks new Workers invocations based on recorded
usage in the current subscription billing period. Reporting and blocking can lag, so spend can
exceed the threshold. Rate Limiting bindings accept `delta` to consume multiple units; its default is 1.

From `@cloudflare/computer` v0.7.0, set `onInterrupt: "replay"` on the JavaScript backend or an
individual run to recover from a deploy or crash. Recovery reruns the script from the beginning
with recorded call results and suppresses previously recorded output.
A call may run again if it finished before its result was recorded: use `ctx.callId` as an idempotency
key where supported or `unsafeToRepeat()` for calls that cannot safely repeat.
Recovery starts on the next workspace runtime call; `workspace.runtime.recover()` from a Durable
Object alarm recovers without incoming traffic. See the Agents reference for approval waits.

Files in this skill

  • SKILL.md8.6 KB
  • coverage.json867 B
  • references/nodejs-compatibility.md5.3 KB
  • references/rpc-and-websockets.md6.2 KB
  • references/runtime-and-web-platform.md7.6 KB
  • references/static-assets-and-pages-migration.md5 KB
  • references/wrangler-tooling-and-testing.md6.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.