Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Cloudflare Workers Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-cloudflare-workers-knowledge-patch)
---
name: cloudflare-workers-knowledge-patch
description: Cloudflare Workers
version: null
license: MIT
metadata:
author: Nevaberry
---
# Cloudflare Workers compatibility
Load this skill when changing Worker compatibility settings, migrating Wrangler,
Pages, or test tooling, or working with the runtime APIs and services indexed below.
Use the quick references for migration decisions and load the topic file for full
conditions, opt-outs, limits, and examples.
## Reference index
| Reference | Topics |
| --- | --- |
| [Wrangler and deployment](references/wrangler-and-deployment.md) | CLI removals, authentication, routes, builds, deployment controls, retention, preview accounts |
| [Node.js compatibility](references/nodejs-compatibility.md) | Defaults, native APIs and stubs, polyfills, module loading, timers, diagnostics, TLS, Hyperdrive |
| [Runtime compatibility](references/runtime-compatibility.md) | Fetch, cache, streams, encodings, contexts, events, Python, email, queues, Dynamic Workers |
| [RPC and WebSockets](references/rpc-and-websockets.md) | Stub ownership, pipelining, Python interoperability, WebSocket defaults, TCP and gRPC |
| [Static Assets and Pages migration](references/static-assets-and-pages-migration.md) | Routing, fallbacks, Functions, uploads, previews, domains, image transformations |
| [Vite development and testing](references/vite-development-and-testing.md) | Configuration, local state, types, test harness, Vitest migration, Artifacts |
| [Agents, MCP, and Computer Workspace](references/runtime-compatibility.md#agents-mcp-and-computer-workspace) | MCP migration and elicitation, Think, Code Mode, workspace recovery and approvals |
| [Durable Objects and Workflows](references/rpc-and-websockets.md#durable-objects-and-workflows) | Storage, retries, code updates, traffic, jurisdictions, concurrency, Containers |
| [Observability, access, and billing](references/wrangler-and-deployment.md#observability-access-and-billing) | Tracing, logs, profiling, Access, namespace permissions, rate limits, spending |
## CLI removals and migration
Wrangler v4 supports Node.js Current, Active LTS, and Maintenance LTS releases.
Upgrade development and CI environments pinned to Node.js 16 or 18.
| Old usage | Migration |
| --- | --- |
| `wrangler publish` | `wrangler deploy` |
| `wrangler pages publish` | `wrangler pages deploy` |
| `wrangler generate` | `npm create cloudflare@latest` |
| `wrangler version` | `wrangler --version` |
| `getBindingsProxy()` | `getPlatformProxy()` with the same arguments |
| `usage_model` | Remove the setting |
| `legacy_assets`, `--legacy-assets`, Workers Sites | Migrate to Workers Static Assets |
| `node_compat`, `--node-compat` | Use the `nodejs_compat` compatibility flag |
| Service environments enabled through `legacy_env` | Migrate to Wrangler environments |
KV key and bulk operations and R2 object operations default to local data.
Add `--remote` to scripts targeting deployed resources:
```sh
wrangler kv key get --binding MY_KV my-key --remote
```
`cf` 1.0.0-rc.1 writes Build Output to `.cloudflare/output/v1/` and rebuilds on
the 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`.
For scripts from early betas, use `cf previews deploy --preview-name my-preview`,
kebab-case generated command names, and stderr for prompts and progress.
## Types and test-tool migration
`@cloudflare/workers-types` v5 removes dated entrypoints. Its root tracks the
latest stable compatibility settings; `/experimental` exposes experimental APIs.
For types matching the 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. Regenerate module
declarations after changing the configuration's `rules` setting.
Workers Vitest v1 moves from `@cloudflare/vitest-pool-workers` to
`@cloudflare/vitest-plugin`. Update the dependency, imports, and test TypeScript
`types` entries, or run:
```sh
npx @cloudflare/codemods vitest:pool-workers-to-vitest-plugin
```
## Runtime changes that affect existing code
Starting at compatibility date `2026-08-04`, `nodejs_compat` and
`nodejs_compat_v2` behavior is enabled by default; explicit enable flags are
redundant. For older dates, opt in with `nodejs_compat`. To disable compatibility
entirely, remove both enable flags and add `no_nodejs_compat` and
`no_nodejs_compat_v2`. Importable polyfills can still do nothing or throw.
JavaScript Workers use the new module registry from `2026-11-17`; Python Workers
use the legacy registry. Use `new_module_registry` for earlier opt-in or
`legacy_module_registry` to opt out. With `nodejs_compat`, `require()` can load
ES modules whose dependency graph has no top-level `await`.
`fetch_iterable_type_support` (2026-02-19) streams synchronous and asynchronous
iterable request and response bodies. Explicitly stringify arrays if callers
relied on comma-separated text. The companion
`fetch_iterable_type_support_override_adjustment` applies when iterable support
is enabled with a compatibility date after 2026-01-15 and stringifies synchronous
iterables with a custom `toString` or `Symbol.toPrimitive`.
`require_returns_default_export` (2026-01-22) returns the default export if
present, otherwise a mutable copy of the namespace. Use
`require_returns_namespace` for the namespace object.
With `nodejs_compat`, `diagnostics_channel_has_subscribers_getter` (2026-05-19)
changes `channel.hasSubscribers()` to the read-only `channel.hasSubscribers`.
`web_socket_auto_reply_to_close` (2026-03-10) replies to peer Close frames and
sets `readyState` to `CLOSED` before the `close` event. Use
`accept({ allowHalfOpen: true })` when coordinating both sides of a proxy;
outbound half-open sockets need a Fetch upgrade and acceptance of its socket.
`websocket_standard_binary_type` (2026-03-17) defaults `binaryType` to `"blob"`.
Set `ws.binaryType = "arraybuffer"` before accepting to retain array buffers.
Hibernatable Durable Object `webSocketMessage` handlers still receive
`ArrayBuffer` binary messages.
## Asset routing and Pages migration
Workers serves matching static assets before invoking the script by default.
Set `assets.run_worker_first` for migrated Pages middleware or `_routes.json`
checks that must run before serving files. It accepts path patterns and `!`
exclusions, as well as `true` for Worker priority.
```toml
[assets]
directory = "./dist"
run_worker_first = ["/api/*", "!/api/docs/*"]
```
Set `assets.not_found_handling = "single-page-application"` explicitly to preserve
SPA fallback to `index.html` with HTTP 200. Use `"404-page"` to serve the nearest
`404.html` with HTTP 404. Set `assets.binding = "ASSETS"` to preserve migrated
`env.ASSETS.fetch(request)` calls.
Use `assets.base_path` in Wrangler 4.148.0 or later, or `worker.assets.basePath`
in `cf` 1.0.0-beta.13 or later, to mount the asset directory at a prefix.
Use full public paths in `_headers`, `_redirects`, and `run_worker_first`.
For `/blog`, set Vite's `base` to `"/blog/"`.
## Local development and integration tests
The Vite plugin resolves entry configuration from `configPath`, then
`CLOUDFLARE_VITE_WRANGLER_CONFIG_PATH`, then a root `wrangler.jsonc`,
`wrangler.json`, or `wrangler.toml`. Each auxiliary Worker needs an explicit
`configPath`, a programmatic `config`, or both. Deploy each auxiliary Worker
with `wrangler deploy -c dist/<auxiliary-worker>/wrangler.json`.
Use Wrangler's `createTestHarness()` in any Node.js test runner for locally
serving production builds from Wrangler or the Workers Vite plugin, replacing
`unstable_startWorker()` or `unstable_dev()` for integration tests.
Use `server.fetch()` for configured routes and `server.reset()` between tests
to reset storage. Use `@msw/cloudflare` for outbound request mocks under Vitest.
Artifacts bindings default to local repositories in Wrangler dev, the Workers
Vite plugin, and the Workers Vitest integration. Use the latest Wrangler and
Git 2.32 or later on `PATH`; set `remote = true` for deployed repositories.
## Request cancellation, redirects, and RPC ownership
From compatibility date `2026-11-17`, incoming `request.signal` receives client
disconnection events by default. Use `disable_request_signal` to opt out.
Pass `{ signal: request.signal }` to outbound `fetch()` for explicit cancellation;
`request_signal_passthrough` separately controls propagation with `fetch(request)`.
`redirect: "error"` is supported in `fetch()` and `new Request()` from
compatibility date `2026-12-22`, or earlier with `fetch_redirect_error`.
It raises `TypeError` for 301, 302, 303, 307, and 308 even without `Location`;
other 3xx responses resolve normally. Opt out with `no_fetch_redirect_error`.
`rpc_params_dup_stubs` (2026-01-20) keeps the sender's stub usable but disposes
the callee's parameter copy when the call returns. Call `stub.dup()` in the
callee to retain it. `rpc_params_transfer_stubs` restores ownership transfer.
Byte streams and `Request` or `Response` values can stream beyond the serialized
RPC message limit; sending transfers ownership of the stream.
## Durable Object retries and Workflow controls
Durable Object `fetch()` and RPC calls retry transient 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()`.
With Wrangler 4.158.0 or later, mark the method in the class's static block using
`retryable(this.prototype.setQuantity)` from `cloudflare:durable-objects`.
Per-stub `get()` or `getByName()` retry limits accept 0–10 retries and
500–60,000 ms; use `maxRetries: 0` for an existing caller-side retry loop.
With Wrangler 4.152.0 or later, Workflow `jurisdiction` can be `eu`, `us`, or
`fedramp` and is fixed at creation. 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.
## Tracing, Access, and MCP
`tracing.startActiveSpan()` keeps its span open after the callback returns.
Call `span.end()` when work completes or is canceled. Local development captures
handler, outbound Fetch, and binding spans with correlated logs. Local Explorer's
OpenAPI schema is at `/cdn-cgi/local/explorer/api`.
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()` for email, name, and groups. Configure `access.dev`
in `wrangler.jsonc` to inject a test identity in `wrangler dev`.
`McpAgent` is feature-frozen. Replace `createMcpHandler(v1Server, options)` with
`createMcpHandler(factory, options)` using an SDK v2 factory before the next major
version, or use `createLegacyMcpHandler` temporarily for sessionful features.
Keep the legacy route while clients depend on sessions, RPC, pushed requests,
standalone streams, or replay; remove it after migration and session draining.