workers-sdk
AGENTS.md4.6k starsChanged 6 months agoApache-2.0View on GitHub
This file helps AI coding agents work effectively in the Cloudflare Workers SDK monorepo. Prefer authoritative configuration and documentation over copying details into this file: copied versions, rule lists, and counts become stale. - Use pnpm, not npm or yarn. - Use the Node.js and pnpm versions declared in package.json. - Install dependencies with pnpm install. - Run commands from the workspace root unless package documentation says otherwise. - Before changing a package, read its AGENTS.md if it has one.…
Trending
Quiet since August.about the whole repository
Who's talking about cloudflare/workers-sdk
- cloudflare/workerd“🐛 BUG: The cache field on RequestInitializerDict is not implemented in fetch”GitHub · Apr 7, 2023 · 85 reactions
- sveltejs/kit“feat: Vite environment API”GitHub · Jul 17, 2025 · 31 reactions
- remix-run/remix“Cloudflare support for Vite”GitHub · Jan 16, 2024 · 25 reactions
- cloudflare/workerd“🐛 BUG: Workers TTFB slows down based on unused dynamic imports (additional modules)”GitHub · Mar 27, 2024 · 22 reactions
- withastro/astro“Cloudflare adapter returning [object Object]”GitHub · Oct 10, 2025 · 18 reactions
The biggest 5 of 17 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 17
Talked about on GitHub, Bluesky and Hacker News (17 times).
On GitHub · 14
- Apr 7, 2023🐛 BUG: The cache field on RequestInitializerDict is not implemented in fetch — cloudflare/workerd85 reactions · 61 comments
- Jul 17, 2025feat: Vite environment API — sveltejs/kit31 reactions · 16 comments
- Jan 16, 2024Cloudflare support for Vite — remix-run/remix25 reactions · 21 comments
- Mar 27, 2024🐛 BUG: Workers TTFB slows down based on unused dynamic imports (additional modules) — cloudflare/workerd22 reactions · 6 comments
- Oct 10, 2025Cloudflare adapter returning [object Object] — withastro/astro18 reactions · 15 comments
9 more on GitHub
- May 24, 2023Support Node Compat in Cloudflare Adaptor — sveltejs/kit17 reactions · 2 comments
- Oct 17, 2024Support Wrangler, the CLI for Cloudflare Workers — denoland/deno15 reactions · 8 comments
- Aug 10, 2026feat: `@cloudflare/vite-plugin` integration, take 2 — sveltejs/kit11 reactions · 5 comments
- Jul 22, 2023Feature Request — Runtime APIs: Superfluous throws — cloudflare/workerd11 reactions
- Oct 29, 2025Add --target=cloudflare support to bundler — oven-sh/bun8 reactions · 10 comments
- Nov 6, 2025placement just got better (finally) — cloudflare/cloudflare-docs7 reactions · 6 comments
- Oct 28, 2025vitest 4.0 fails with "TypeError: filename.replace is not a function" — withastro/astro7 reactions · 3 comments
- May 23, 2025'scopes' for Secret Store's secrets not retained in local development — cloudflare/developer-platform7 reactions · 7 comments
- Jul 23, 2024bun fetch to wrangler dev server crashes server and fails with "socket connection was closed unexpectedly" — oven-sh/bun7 reactions · 20 comments
On Bluesky · 2
- Oct 20, 2023📦 cloudflare / workers-sdk ⭐ 1,781 (+48) 🗒 TypeScript ⛅️ Home to Wrangler, the CLI for Cloudflare Workers® — @github-trending-js.bsky.social1 likes and repost
- Oct 20, 2023📦 cloudflare / workers-sdk ⭐ 1,734 (+4) 🗒 TypeScript ⛅️ Home to Wrangler, the CLI for Cloudflare Workers® — @github-trending.bsky.social1 likes and repost
On Hacker News · 1
- May 2, 2026Cloudflare Workers let you deploy serverless code instantly across the globe3 points
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository10 other files it gives its agents.
- packages/auto-triage-bot/AGENTS.mdAGENTS.md
- packages/create-cloudflare/AGENTS.mdAGENTS.md
- packages/miniflare/AGENTS.mdAGENTS.md
- packages/vite-plugin-cloudflare/AGENTS.mdAGENTS.md
- packages/vitest-plugin/AGENTS.mdAGENTS.md
- packages/workers-auth/AGENTS.mdAGENTS.md
- packages/workers-utils/AGENTS.mdAGENTS.md
- packages/wrangler/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- local-explorerSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
28 rules. About 0 are common, 14 are distinctive, and 14 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈14
Distinctive · estimate
This author's own choices. Worth a look.
14
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 9
Use pnpm, not npm or yarn.
- Very specific: line 10
Use the Node.js and pnpm versions declared in package.json.
- Distinctive: line 12
Run commands from the workspace root unless package documentation says otherwise.
- Distinctive: line 14
Before changing a package, read its AGENTS.md if it has one.
- Distinctive: line 15
Do not edit generated files directly.
- Distinctive: line 32
Prefer the narrowest relevant test while developing, then run the broader package checks appropriate to the change.
- Distinctive: line 70
When adding or changing development functionality:
- Distinctive: line 74
update shared configuration types, validation, and runtime behavior where applicable.
- Distinctive: line 76
add coverage at the shared implementation layer.
- Distinctive: line 78
document intentional differences or unsupported consumers in the change and pull request.
- Very specific: line 86
Keep TypeScript strictly typed.
- Very specific: line 88
Use type-only imports where appropriate and node: prefixes for Node.js built-ins.
- Distinctive: line 90
Prefer function declarations for named or exported functions.
- Very specific: line 91
Add well-formatted JSDoc to exported or public functions and to functions whose purpose is not evident, including useful tags such as …
- Very specific: line 103
Import ci-info through its default export.
- Very specific: line 106
Do not reproduce those rules manually.
- Very specific: line 114
After changing dependencies, run pnpm install so that the lockfile is updated.
- Very specific: line 116
Do not build shell commands with interpolated or concatenated untrusted input.
- Distinctive: line 122
Use Vitest for unit and integration tests.
- Distinctive: line 123
Use fixtures for filesystem and Worker scenarios.
- Distinctive: line 125
Use the Vitest plugin when behavior must be tested in workerd.
- Very specific: line 129
Prefer runInTempDir() and real filesystem operations over filesystem mocks.
- Very specific: line 130
Use mockConsoleMethods() to capture output and assert against its out, err, and warn properties.
- Distinctive: line 132
Update relevant snapshots when changing user-facing output.
- Very specific: line 142
Read .changeset/README.md to determine whether a changeset is required and how to write it.
- Very specific: line 144
Use .github/PULL_REQUEST_TEMPLATE.md when preparing a pull request.
- Very specific: line 148
Use the repository's established [package] description PR-title style.
- Distinctive: line 149
Run the relevant tests and checks locally before pushing.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
This file helps AI coding agents work effectively in the Cloudflare Workers SDK monorepo. Prefer authoritative configuration and documentation over copying details into this file: copied versions, rule lists, and counts become stale.
Start Here
- Use
pnpm, not npm or yarn. - Use the Node.js and pnpm versions declared in
package.json. - Install dependencies with
pnpm install. - Run commands from the workspace root unless package documentation says otherwise.
- Before changing a package, read its
AGENTS.mdif it has one. - Do not edit generated files directly. Change their source or generator and regenerate them.
Common Commands
The root package.json is authoritative for available scripts.
pnpm build— build the workspace with Turbo.pnpm test:ci— run tests in CI mode.pnpm test:e2e— run end-to-end tests; many require Cloudflare credentials.pnpm check— run the repository's validation, lint, type, and format checks.pnpm fix— apply supported lint and formatting fixes.pnpm prettify— format files with oxfmt.pnpm run <script> --filter <package>— run a Turbo task for one package.pnpm -w test:ci -F <package> -- <test-file>— run a package's specific test file when its test configuration supports it.
Prefer the narrowest relevant test while developing, then run the broader package checks appropriate to the change. Do not run credentialed E2E tests unless the task and environment support them.
Repository Map
| Task | Location | Notes |
| Add or modify a Wrangler command | packages/wrangler/src/ | Commands are registered from src/index.ts. |
| Change local development behavior | packages/miniflare/src/ | src/index.ts contains the main Miniflare class. |
| Modify embedded runtime workers | packages/miniflare/src/workers/ | Worker scripts use worker: virtual imports. |
| Change project scaffolding | packages/create-cloudflare/ | Templates and framework support live here. |
| Change the Vite integration | packages/vite-plugin-cloudflare/ | Includes package-specific playgrounds. |
| Change the Vitest integration | packages/vitest-plugin/ | Vitest integration for tests running in workerd. |
| Change shared config handling | packages/workers-utils/src/config/ | Shared types, normalization, and validation. |
| Use shared test helpers | packages/workers-utils/src/test-helpers/ | Includes temporary-directory and console helpers. |
| Change deploy or versions-upload validation | packages/deploy-helpers/src/deploy/helpers/validate-worker-props.ts | Keep deploy and versions-upload behavior aligned. |
| Add a fixture | fixtures/ | Fixtures are workspace members with their own package.json. |
| Change CI | .github/workflows/ | test-and-check.yml is the main test workflow. |
| Change deployment tooling | tools/deployments/ | Scripts run directly through esbuild-register. |
| Create a changeset | .changeset/README.md | Read this file before deciding whether one is required. |
Turbo orchestrates workspace tasks. Shared TypeScript configuration lives in
packages/workers-tsconfig/; lint and formatting behavior is defined by
.oxlintrc.jsonc, .oxfmtrc.jsonc, and packages/lint-config-shared/.
Cross-Tool Development Features
Wrangler, the Vite plugin, and the Vitest plugin are all consumers of the Workers development platform. A development feature is not complete merely because it works through one of them.
Implement development features in Miniflare wherever possible so that every consumer benefits from the same behavior. Keep the integration layers in Wrangler, the Vite plugin, and the Vitest plugin thin instead of implementing equivalent behavior independently in each tool. If Miniflare is not the appropriate layer, put shared behavior in the lowest suitable shared package.
When adding or changing development functionality:
- assess its impact on Miniflare, Wrangler, the Vite plugin, and the Vitest plugin;
- update shared configuration types, validation, and runtime behavior where applicable;
- add coverage at the shared implementation layer; add consumer-specific tests when the consumer's integration or behavior is affected;
- document intentional differences or unsupported consumers in the change and pull request.
Implementation Conventions
The checked-in configuration is authoritative. Run pnpm check rather than
relying on a duplicated list of every enforced rule. In particular:
- Keep TypeScript strictly typed. Avoid
any, non-null assertions, and floating promises. - Use type-only imports where appropriate and
node:prefixes for Node.js built-ins. - Prefer function declarations for named or exported functions.
- Add well-formatted JSDoc to exported or public functions and to functions whose
purpose is not evident, including useful tags such as
@paramand@returnswhere appropriate. - Comments should explain why; do not add comments that merely restate code.
- Lint-disable comments require a reason after
--. - In Wrangler, use the logger rather than calling
console.*directly, except inside the logger implementation. - For Cloudflare v4 API calls, prefer the existing request helpers such as
fetchResult,fetchListResult, andfetchPagedListResult. Reuse or inject these helpers in shared packages rather than adding thecloudflarepackage solely for a simple request. Use the Cloudflare TypeScript SDK when its generated API surface or behavior is materially useful. - Import
ci-infothrough its default export.
oxfmt determines whitespace, quoting, import order, and package.json sorting.
Do not reproduce those rules manually; run pnpm prettify.
Dependencies and Security
- Packages normally bundle their dependencies. The repository validator in
tools/deployments/validate-package-dependencies.tsis authoritative. - A package that must leave a dependency external declares it in that package's
scripts/deps.tsas part ofEXTERNAL_DEPENDENCIES, with an explanation. - After changing dependencies, run
pnpm installso that the lockfile is updated. - Do not build shell commands with interpolated or concatenated untrusted input.
The custom
workers-sdk/no-unsafe-command-executionoxlint rule enforces the repository's command-execution constraints.
Testing Conventions
- Use Vitest for unit and integration tests.
- Use fixtures for filesystem and Worker scenarios; treat fixtures as user-facing examples and keep them clear and realistic.
- Use the Vitest plugin when behavior must be tested in workerd.
- In Vitest tests, obtain
expectfrom the test context rather than importing it fromvitest. PassExpectStaticto helpers that need it; usenode:assertwhere test context is unavailable. - Prefer
runInTempDir()and real filesystem operations over filesystem mocks. - Use
mockConsoleMethods()to capture output and assert against itsout,err, andwarnproperties. - Update relevant snapshots when changing user-facing output.
- New examples under
fixtures/vitest-plugin-examples/need atsconfig.json.
The shared defaults are defined in vitest.shared.ts; package configurations
may override them.
Changes and Pull Requests
- Work on a branch rather than committing directly to
main. - Read
.changeset/README.mdto determine whether a changeset is required and how to write it. Do not assume every package-code change needs one. - Use
.github/PULL_REQUEST_TEMPLATE.mdwhen preparing a pull request. - The PR description requirements are enforced by
tools/deployments/validate-pr-description.ts; treat that validator and the template as authoritative. - Use the repository's established
[package] descriptionPR-title style. - Run the relevant tests and checks locally before pushing.
Package-Specific Guidance
Many packages provide their own AGENTS.md. Locate and read the closest
applicable file before making changes. When a change makes guidance inaccurate,
update that file in the same change. Put package-specific knowledge in the
package's file; keep this root file focused on repository-wide workflow and
navigation.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

