agentleFS
CloudflareKnown publishercloudflare/workers-sdk/AGENTS.md

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

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 1 mentionJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 1 mentionSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the cloudflare/workers-sdk repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about cloudflare/workers-sdk

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

9 more on GitHub

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
  1. Very specific:

    Use pnpm, not npm or yarn.

    line 9
  2. Very specific:

    Use the Node.js and pnpm versions declared in package.json.

    line 10
  3. Distinctive:

    Run commands from the workspace root unless package documentation says otherwise.

    line 12
  4. Distinctive:

    Before changing a package, read its AGENTS.md if it has one.

    line 14
  5. Distinctive:

    Do not edit generated files directly.

    line 15
  6. Distinctive:

    Prefer the narrowest relevant test while developing, then run the broader package checks appropriate to the change.

    line 32
  7. Distinctive:

    When adding or changing development functionality:

    line 70
  8. Distinctive:

    update shared configuration types, validation, and runtime behavior where applicable.

    line 74
  9. Distinctive:

    add coverage at the shared implementation layer.

    line 76
  10. Distinctive:

    document intentional differences or unsupported consumers in the change and pull request.

    line 78
  11. Very specific:

    Keep TypeScript strictly typed.

    line 86
  12. Very specific:

    Use type-only imports where appropriate and node: prefixes for Node.js built-ins.

    line 88
  13. Distinctive:

    Prefer function declarations for named or exported functions.

    line 90
  14. Very specific:

    Add well-formatted JSDoc to exported or public functions and to functions whose purpose is not evident, including useful tags such as …

    line 91
  15. Very specific:

    Import ci-info through its default export.

    line 103
  16. Very specific:

    Do not reproduce those rules manually.

    line 106
  17. Very specific:

    After changing dependencies, run pnpm install so that the lockfile is updated.

    line 114
  18. Very specific:

    Do not build shell commands with interpolated or concatenated untrusted input.

    line 116
  19. Distinctive:

    Use Vitest for unit and integration tests.

    line 122
  20. Distinctive:

    Use fixtures for filesystem and Worker scenarios.

    line 123
  21. Distinctive:

    Use the Vitest plugin when behavior must be tested in workerd.

    line 125
  22. Very specific:

    Prefer runInTempDir() and real filesystem operations over filesystem mocks.

    line 129
  23. Very specific:

    Use mockConsoleMethods() to capture output and assert against its out, err, and warn properties.

    line 130
  24. Distinctive:

    Update relevant snapshots when changing user-facing output.

    line 132
  25. Very specific:

    Read .changeset/README.md to determine whether a changeset is required and how to write it.

    line 142
  26. Very specific:

    Use .github/PULL_REQUEST_TEMPLATE.md when preparing a pull request.

    line 144
  27. Very specific:

    Use the repository's established [package] description PR-title style.

    line 148
  28. Distinctive:

    Run the relevant tests and checks locally before pushing.

    line 149

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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.md if 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

TaskLocationNotes
Add or modify a Wrangler commandpackages/wrangler/src/Commands are registered from src/index.ts.
Change local development behaviorpackages/miniflare/src/src/index.ts contains the main Miniflare class.
Modify embedded runtime workerspackages/miniflare/src/workers/Worker scripts use worker: virtual imports.
Change project scaffoldingpackages/create-cloudflare/Templates and framework support live here.
Change the Vite integrationpackages/vite-plugin-cloudflare/Includes package-specific playgrounds.
Change the Vitest integrationpackages/vitest-plugin/Vitest integration for tests running in workerd.
Change shared config handlingpackages/workers-utils/src/config/Shared types, normalization, and validation.
Use shared test helperspackages/workers-utils/src/test-helpers/Includes temporary-directory and console helpers.
Change deploy or versions-upload validationpackages/deploy-helpers/src/deploy/helpers/validate-worker-props.tsKeep deploy and versions-upload behavior aligned.
Add a fixturefixtures/Fixtures are workspace members with their own package.json.
Change CI.github/workflows/test-and-check.yml is the main test workflow.
Change deployment toolingtools/deployments/Scripts run directly through esbuild-register.
Create a changeset.changeset/README.mdRead 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 @param and @returns where 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, and fetchPagedListResult. Reuse or inject these helpers in shared packages rather than adding the cloudflare package solely for a simple request. Use the Cloudflare TypeScript SDK when its generated API surface or behavior is materially useful.
  • Import ci-info through 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.ts is authoritative.
  • A package that must leave a dependency external declares it in that package's scripts/deps.ts as part of EXTERNAL_DEPENDENCIES, with an explanation.
  • After changing dependencies, run pnpm install so that the lockfile is updated.
  • Do not build shell commands with interpolated or concatenated untrusted input. The custom workers-sdk/no-unsafe-command-execution oxlint 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 expect from the test context rather than importing it from vitest. Pass ExpectStatic to helpers that need it; use node:assert where test context is unavailable.
  • Prefer runInTempDir() and real filesystem operations over filesystem mocks.
  • Use mockConsoleMethods() to capture output and assert against its out, err, and warn properties.
  • Update relevant snapshots when changing user-facing output.
  • New examples under fixtures/vitest-plugin-examples/ need a tsconfig.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.md to 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.md when 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] description PR-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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.