agentleFS
CloudflareKnown publishercloudflare/workers-nodejs-compat-matrix/AGENTS.md

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

    Use Prettier with project config (.prettierrc)

    line 77
  2. Very specific:

    Use type for simple types, interfaces for React props

    line 99
  3. Distinctive:

    Use Zod for runtime validation

    line 100
  4. Very specific:

    Use try/catch for expected errors

    line 112
  5. Very specific:

    Use shell.set("-e") in shell scripts for fail-fast

    line 113
  6. Distinctive:

    Check for required tools at script start

    line 114
  7. Distinctive:

    Does NOT regenerate API dumps (uses committed data)

    line 173

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

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_DIR env 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:deploy

Working 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-baseline

Project 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 APIs
  • generate-*.mjs - Scripts for generating various data files
  • scan-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 type for 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/catch for expected errors
  • Use shell.set("-e") in shell scripts for fail-fast
  • Check for required tools at script start

Data Flow

  1. Baseline generation: Merges Node 18/20/22 APIs into baseline.json
  2. API scanning: Dumps APIs from each runtime, comparing to baseline
  3. Table generation: Creates table-data.json from JSON dumps
  4. Historical tracking: generate-historical-data.mjs tracks workerd support over time
  5. 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.mjs MUST match App.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 generate

Update only workerd data

node ./scan-apis.mjs --only workerd
pnpm run generate:table

Update historical chart

pnpm run generate:historical

Modifying ignored modules

Edit report/src/ignored-modules.js, then:

pnpm run generate:baseline && pnpm run generate:table

CI/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)

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.