workerd / build
AGENTS.md8.8k starsChanged 9 months agoApache-2.0View on GitHub
Custom Bazel rules (wd_* macros) for C++, TypeScript, Rust, Cap'n Proto, and test orchestration. Uses bzlmod (MODULE.bazel), not WORKSPACE. This is build system definitions, NOT build output (bazel-bin/). Conventions: //tools/clang-tidy:workerd-lint builds a shared-object clang-tidy plugin that adds workerd-specific static checks: - jsg-visit-for-gc: flags JSG resource types whose visitable fields (jsg::Ref, jsg::JsRef, jsg::V8Ref, jsg::Function, jsg::Promise, jsg::Value, etc., plus kj::Maybe/Array/Vector/ OneOf and jsg::Optional wrappers thereof) are missing from visitForGc(). - workerd-angled-includes - requires includes of workers/capnproto code from different directories to use…
Trending
Quiet since August.thin dataabout the whole repository
Who's talking about cloudflare/workerd
- A Hacker News story“OS Workerd, Cloudflare's JavaScript/WASM Runtime”Hacker News · Sep 27, 2022 · 27 points
- withastro/astro“Cloudflare adapter returning [object Object]”GitHub · Oct 10, 2025 · 18 reactions
- supabase/supabase-js“The 'cache' field on 'RequestInitializerDict' is not implemented - Cloudflare Workers”GitHub · Mar 28, 2024 · 16 reactions
- nodejs/node“src: improve buffer.transcode performance”GitHub · Aug 1, 2024 · 13 reactions
- NixOS/nixpkgs“Package request: workerd”GitHub · Nov 12, 2024 · 12 reactions
The biggest 5 of 12 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 12
Talked about on GitHub, Bluesky and Hacker News (12 times).
On GitHub · 6
- Oct 10, 2025Cloudflare adapter returning [object Object] — withastro/astro18 reactions · 15 comments
- Mar 28, 2024The 'cache' field on 'RequestInitializerDict' is not implemented - Cloudflare Workers — supabase/supabase-js16 reactions · 24 comments
- Aug 1, 2024src: improve buffer.transcode performance — nodejs/node13 reactions · 26 comments
- Nov 12, 2024Package request: workerd — NixOS/nixpkgs12 reactions · 8 comments
- Feb 19, 2024Add Curve25519 — w3c/webcrypto9 reactions · 16 comments
1 more on GitHub
- Nov 3, 2025Optimize TextEncoder::encode — nodejs/performance7 reactions · 33 comments
On Bluesky · 4
- Mar 24, 2026workerd : le runtime JavaScript/Wasm open source de Cloudflare Workers — @news.humancoders.com4 likes and reposts
- Aug 22, 2026Current status: trying to build github.com/cloudflare/w... on various sandbox providers — @jeremymorrell.dev1 likes and repost
- Mar 24, 2026workerd : le runtime JavaScript/Wasm qui propulse Cloudflare Workers est maintenant open source. Basé sur les standards web, il permet… — @humancoders.com1 likes and repost
- Nov 5, 2024Technically workers are open source github.com/cloudflare/w... — @userops.bsky.social1 likes and repost
On Hacker News · 2
- Sep 27, 2022OS Workerd, Cloudflare's JavaScript/WASM Runtime27 points · 2 comments
- Oct 5, 2023Cloudflare workers is adopting Ada URL parser2 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 repository61 other files it gives its agents.
- AGENTS.mdAGENTS.md
- src/cloudflare/AGENTS.mdAGENTS.md
- src/node/AGENTS.mdAGENTS.md
- src/per_isolate/AGENTS.mdAGENTS.md
- src/per_isolate/crypto/AGENTS.mdAGENTS.md
- src/per_isolate/webfs/AGENTS.mdAGENTS.md
- src/per_isolate/webstreams/AGENTS.mdAGENTS.md
- src/pyodide/AGENTS.mdAGENTS.md
- src/rust/AGENTS.mdAGENTS.md
- src/rust/cxx/AGENTS.mdAGENTS.md
- src/tests/node/AGENTS.mdAGENTS.md
- src/tests/node/http-client/AGENTS.mdAGENTS.md
- src/tests/node/http-server/AGENTS.mdAGENTS.md
- src/tests/node/net/AGENTS.mdAGENTS.md
- src/tests/node/stream/AGENTS.mdAGENTS.md
- src/tests/streams/AGENTS.mdAGENTS.md
- src/tests/streams/cache/AGENTS.mdAGENTS.md
- src/tests/streams/compression/AGENTS.mdAGENTS.md
- src/tests/streams/digest/AGENTS.mdAGENTS.md
- src/tests/streams/encoding/AGENTS.mdAGENTS.md
- src/tests/streams/formdata/AGENTS.mdAGENTS.md
- src/tests/streams/htmlrewriter/AGENTS.mdAGENTS.md
- src/tests/streams/identity/AGENTS.mdAGENTS.md
- src/tests/streams/inspect/AGENTS.mdAGENTS.md
- src/tests/streams/iocontext/AGENTS.mdAGENTS.md
- src/tests/streams/piping/AGENTS.mdAGENTS.md
- src/tests/streams/r2-patterns/AGENTS.mdAGENTS.md
- src/tests/streams/readable/AGENTS.mdAGENTS.md
- src/tests/streams/readable-byte/AGENTS.mdAGENTS.md
- src/tests/streams/scaling/AGENTS.mdAGENTS.md
- src/tests/streams/sockets/AGENTS.mdAGENTS.md
- src/tests/streams/strategies/AGENTS.mdAGENTS.md
- src/tests/streams/transform/AGENTS.mdAGENTS.md
- src/tests/streams/writable/AGENTS.mdAGENTS.md
- src/workerd/api/AGENTS.mdAGENTS.md
- src/workerd/api/crypto/AGENTS.mdAGENTS.md
- src/workerd/api/node/AGENTS.mdAGENTS.md
- src/workerd/api/streams/AGENTS.mdAGENTS.md
- src/workerd/io/AGENTS.mdAGENTS.md
- src/workerd/jsg/AGENTS.mdAGENTS.md
- src/workerd/server/AGENTS.mdAGENTS.md
- src/workerd/util/AGENTS.mdAGENTS.md
- types/AGENTS.mdAGENTS.md
- bazel-test-hygieneSkill
- commit-categoriesSkill
- dad-jokesSkill
- find-and-run-testsSkill
- identify-reviewerSkill
- investigation-notesSkill
- kj-styleSkill
- markdown-draftsSkill
- parent-project-skillsSkill
- pr-review-guideSkill
- receiving-code-reviewSkill
- rust-reviewSkill
- ts-styleSkill
- update-v8Skill
- wd-test-formatSkill
- workerd-api-reviewSkill
- workerd-safety-reviewSkill
- The first 60 shown.
The file
We split this AGENTS.md into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 28
Test tags: off-by-default, requires-container-engine, no-asan, no-coverage
- Very specific: line 64
Run via just clang-tidy <target> (e.g., just clang-tidy //src/workerd/api/...).
- Very specific: line 90
Add the check to .clang-tidy Checks list
- Very specific: line 91
Add an entry to CHECK_PATH_FILTERS with an empty list (runs nowhere)
- Distinctive: line 92
Add file paths as they are cleaned up
- Distinctive: line 93
Remove the entry once fully rolled out (runs everywhere)
≈ “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
build/ — Bazel Build Rules
OVERVIEW
Custom Bazel rules (wd_* macros) for C++, TypeScript, Rust, Cap'n Proto, and test orchestration. Uses bzlmod (MODULE.bazel), not WORKSPACE. This is build system definitions, NOT build output (bazel-bin/).
KEY RULES
| Rule | Purpose |
wd_cc_library.bzl | Wraps cc_library; strip_include_prefix="/src", arch-specific CPU flags (CRC32C) |
wd_cc_binary.bzl | Wraps cc_binary; macOS dead-strip linkopts; creates _cross alias for prebuilt arm64 binaries |
wd_cc_embed.bzl | Binary/text data -> C++ via C23 #embed; auto-detects text vs binary by extension |
wd_cc_benchmark.bzl | Google Benchmark wrapper; generates CSV report genrule |
wd_test.bzl | .wd-test config test runner; generates up to 3 variants per test |
kj_test.bzl | C++ unit test wrapper; also generates test variants |
wpt_test.bzl | Web Platform Tests; generates JS runner + .wd-test config from WPT tree; delegates to wd_test |
wd_ts_bundle.bzl | TypeScript compilation + JS bundle generation |
wd_js_bundle.bzl | JS bundle -> Cap'n Proto Modules.Bundle embedding via generated .capnp |
wd_capnp_library.bzl | Cap'n Proto schema compilation |
wd_rust_crate.bzl / wd_rust_binary.bzl | Rust build rules |
lint_test.bzl | ESLint integration |
//tools/clang-tidy:workerd-lint | Custom clang-tidy plugin (source: tools/clang-tidy/workerd-lint.c++); ships several custom checks |
Conventions:
_crossalias pattern: everywd_cc_binarygets aname_crossalias selecting prebuilt arm64 or source build- Test tags:
off-by-default,requires-container-engine,no-asan,no-coverage - Variant generation controllable per-test via
generate_*_variantbooleans BUILD.*files: overlay build files for third-party deps (sqlite3, zlib, simdutf, pyodide, wpt)
CLANG-TIDY PLUGIN
//tools/clang-tidy:workerd-lint builds a shared-object clang-tidy plugin
that adds workerd-specific static checks:
jsg-visit-for-gc: flags JSG resource types whose visitable fields (jsg::Ref,jsg::JsRef,jsg::V8Ref,jsg::Function,jsg::Promise,jsg::Value, etc., pluskj::Maybe/Array/Vector/OneOfandjsg::Optionalwrappers thereof) are missing fromvisitForGc().workerd-angled-includes- requires includes of workers/capnproto code from different directories to use angled bracketsworkerd-consume: flags calls to methods annotated withWD_CONSUMEwhen the call is made directly throughkj::Ptrinstead of throughconsume(kj::mv(ptr))->method(...).workerd-legacy-stream-alloc: flags direct allocation of the legacy C++ReadableStream/WritableStream(js.alloc<ReadableStream>(...),js.allocAccounted<...>,jsg::alloc<...>) anywhere other than insideJsReadableStream::create()/JsWritableStream::create(), the dispatch points that select the stream implementation by thetypescript_implemented_streamscompatibility flag. The legacy implementation's own internals and tests of the legacy implementation suppress it withNOLINT(workerd-legacy-stream-alloc)plus a comment explaining why the allocation has to be legacy.workerd-promise-ignore-result- warns on superfluousignoreResult()calls: on promises that are immediatelyco_awaited, and oncapnp::Request::send()results, which should usesendIgnoringResult()insteadworkerd-unsafe-continuation-capture: flags lambdas passed to async sinks (e.g.kj::Promise::then) that capture bare references, raw pointers, or non-owning views.
Usage:
- Run via
just clang-tidy <target>(e.g.,just clang-tidy //src/workerd/api/...). - Plugin sources live in
tools/clang-tidy/: one.h/.c++pair per check, registered inworkerd-lint.c++, built as acc_shared_librarytarget//tools/clang-tidy:workerd-lint. Each check has a<check>-test.shrunner driving<check>-positive-test.c++/<check>-negative-test.c++fixtures (bazel test //tools/clang-tidy/...). The sources are also exported viaexports_filesso downstream projects can rebuild against their own clang/LLVM headers. - The clang-tidy binary itself is published to
cloudflare/workerd-toolsreleases (seedeps/build_deps.jsonc, entriesclang_tidy_*); the matching*_dev.tar.xzarchive provides the clang/LLVM headers needed to build the plugin out-of-tree. Available for Linux amd64/arm64 and macOS arm64; a single archive (linux-amd64) serves all platforms since the AST-matching plugin doesn't depend on the arch-specific config macros that vary. - Wrapper script
build/tools/clang_tidy/clang_tidy_wrapper.shloads the plugin via--load=. - Suppress an intentional non-visit with
// NOLINT(jsg-visit-for-gc)plus a comment explaining why the field is safe to skip (seesrc/workerd/api/streams/queue.hforByteQueue::Entry::store).
Incremental check rollout
Some checks produce many warnings on existing code and need incremental rollout.
The CHECK_PATH_FILTERS dict in build/tools/clang_tidy/check_path_filters.bzl
supports this:
- Add the check to
.clang-tidyChecks list - Add an entry to
CHECK_PATH_FILTERSwith an empty list (runs nowhere) - Add file paths as they are cleaned up
- Remove the entry once fully rolled out (runs everywhere)
Example:
CHECK_PATH_FILTERS = {
"workerd-unsafe-continuation-capture": [
"src/workerd/io",
"src/workerd/api",
],
}Path prefixes match all files under that directory (src/workerd/io
matches src/workerd/io/foo.c++ and src/workerd/io/subdir/bar.c++).
To run a filtered check everywhere during development:
bazel build --config=clang-tidy-unsafe-continuation-capture //src/...DEPENDENCY MANAGEMENT
Lives in deps/. Uses jsonc manifests + codegen:
deps.jsonc,build_deps.jsonc,shared_deps.jsonc— dependency specificationsupdate-deps.py [dep_name]— fetches latest versions, computes hashes, regeneratesgen/MODULE.bazel fragmentsgen/— autogenerated; do not hand-edit*.MODULE.bazel(e.g.,rust.MODULE.bazel,v8.MODULE.bazel) — included by rootMODULE.bazelworkerd-v8/— separate Bazel module wrapping V8 dependency
Pyodide package metadata lives in build/python_metadata.bzl; the checked-in, pre-filtered
package lock files live in src/pyodide/python-lock/.
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.

