workers-nodejs-compat-matrix
AGENTS.md16 starsChanged 8 months agoMITView on GitHub
This document provides guidelines for AI coding agents working in this repository. This project audits Node.js API compatibility across different runtimes (Node.js, Bun, Deno, Cloudflare Workers/workerd). It generates JSON dumps of runtime APIs and displays compatibility in a React-based report at https://workers-nodejs-compat-matrix.pages.dev Node built-ins first (with node: protocol), then third-party, then local:
- Installs packages
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.
The file
We split this AGENTS.md into the rules it gives an agent
7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
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 77
Use Prettier with project config (.prettierrc)
- Very specific: line 99
Use type for simple types, interfaces for React props
- Distinctive: line 100
Use Zod for runtime validation
- Very specific: line 112
Use try/catch for expected errors
- Very specific: line 113
Use shell.set("-e") in shell scripts for fail-fast
- Distinctive: line 114
Check for required tools at script start
- Distinctive: line 173
Does NOT regenerate API dumps (uses committed data)
≈ “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
Agent Guidelines for Workers Node.js Compat Matrix
This document provides guidelines for AI coding agents working in this repository.
Project Overview
This project audits Node.js API compatibility across different runtimes (Node.js, Bun, Deno, Cloudflare Workers/workerd). It generates JSON dumps of runtime APIs and displays compatibility in a React-based report at https://workers-nodejs-compat-matrix.pages.dev
Build & Development Commands
Prerequisites
- Node.js v22 (required for generation scripts)
- fnm (for Node version management) - set
FNM_DIRenv var to fnm binary location - Deno and Bun installed
- pnpm 10.0.0
Main Commands
# Install dependencies
pnpm install
# Generate full compatibility report (requires Node 18, 20, 22 via fnm)
pnpm run generate
# Scan APIs for specific runtimes only
node ./scan-apis.mjs --only workerd
node ./scan-apis.mjs --only bun,deno
# Generate table data for UI (after scanning)
pnpm run generate:table
# Generate historical trend data (scans multiple workerd versions)
pnpm run generate:historical
# Serve React report locally
pnpm run report:dev
# Build report for production
pnpm run --filter report build
# Deploy to Cloudflare Pages
pnpm run report:deployWorking with Individual Runtimes
# Workerd (with compatibility date)
node workerd/dump.mjs 2025-01-01
# Bun
bun run bun/dump.js
# Deno
deno run --allow-all deno/dump.js
# Node.js (requires fnm)
fnm exec --using=22 node node/dump.mjs --compare-to-baselineProject Structure
/data/- Generated JSON dumps (baseline.json, workerd.json, bun.json, deno.json, node-*.json)/node/,/bun/,/deno/,/workerd/- Runtime-specific dump scripts/report/- React app for visualizing compatibility/report/src/data/- Data files consumed by React app (table-data.json, historical-support.json)dump-utils.mjs- Shared utilities for traversing and comparing APIsgenerate-*.mjs- Scripts for generating various data filesscan-apis.mjs- Orchestrates scanning across all runtimes
Code Style Guidelines
Formatting
- Use Prettier with project config (
.prettierrc) - Semicolons: required
- Quotes: double quotes
- Print width: 80
- Trailing commas: ES5 style
Imports
Node built-ins first (with node: protocol), then third-party, then local:
import fs from "node:fs/promises";
import path from "node:path";
import shell from "shelljs";
import { visit } from "../dump-utils.mjs";TypeScript (React App)
- Strict mode enabled
- Use
typefor simple types, interfaces for React props - Use Zod for runtime validation
- JSON imports:
import data from "./file.json" with { type: "json" };
Naming Conventions
- Variables/functions: camelCase
- Constants: SCREAMING_SNAKE_CASE
- React components: PascalCase
- Files: kebab-case for scripts, PascalCase for React components
Error Handling
- Use
try/catchfor expected errors - Use
shell.set("-e")in shell scripts for fail-fast - Check for required tools at script start
Data Flow
- Baseline generation: Merges Node 18/20/22 APIs into
baseline.json - API scanning: Dumps APIs from each runtime, comparing to baseline
- Table generation: Creates
table-data.jsonfrom JSON dumps - Historical tracking:
generate-historical-data.mjstracks workerd support over time - React app: Renders interactive table and trend chart
Key Constants
- Support states:
supported,unsupported,mismatch(no stubs counted) - Display icons: ✅ (matching), ❌ (missing), 🩹 (mismatch)
- Target runtimes: Order in
generate-table-data.mjsMUST matchApp.tsx
Important Notes
- No unenv/stubs: Stubs are treated as missing/unsupported, not counted toward support
- Workerd data only: The Cloudflare Workers column uses raw workerd data
- Historical data: Uses workerd directly with different compatibility dates
- API dumps are committed to git (not gitignored)
- Node v22 features required for generation scripts
Common Tasks
Regenerate all data (if you have fnm with Node 18/20/22)
pnpm run generateUpdate only workerd data
node ./scan-apis.mjs --only workerd
pnpm run generate:tableUpdate historical chart
pnpm run generate:historicalModifying ignored modules
Edit report/src/ignored-modules.js, then:
pnpm run generate:baseline && pnpm run generate:tableCI/CD
GitHub Actions (.github/workflows/deploy-report.yml):
- Triggers: push to main, daily at 1:15am, manual dispatch
- Builds and deploys report to Cloudflare Pages
- Does NOT regenerate API dumps (uses committed data)
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.

