RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/CLAUDE.md/oven-sh/bun

CLAUDE.md

src/js/CLAUDE.md
CLAUDE.md

Quality

85/100

Scores the file, not the repository.

Length

316 words

8 headings · 5 code blocks

Repository

95k

— · pushed 0 days ago

Last changed

3 days ago

First indexed 3 days ago.
oven-sh/bun/src/js/CLAUDE.mdRawGitHub
1# JavaScript Builtins in Bun
2 
3Write JS builtins for Bun's Node.js compatibility and APIs. Run `bun bd` after changes.
4 
5## Directory Structure
6 
7- `builtins/` - Individual functions (`*CodeGenerator(vm)` in C++)
8- `node/` - Node.js modules (`node:fs`, `node:path`)
9- `bun/` - Bun modules (`bun:ffi`, `bun:sqlite`)
10- `thirdparty/` - NPM replacements (`ws`, `node-fetch`)
11- `internal/` - Internal modules
12 
13## Writing Modules
14 
15Modules are NOT ES modules:
16 
17```typescript
18const EventEmitter = require("node:events"); // String literals only
19const { validateFunction } = require("internal/validators");
20 
21export default {
22 myFunction() {
23 if (!$isCallable(callback)) {
24 throw $ERR_INVALID_ARG_TYPE("cb", "function", callback);
25 }
26 },
27};
28```
29 
30## Writing Builtin Functions
31 
32```typescript
33// Fifo.ts
34export function createFIFO<T>(): Dequeue<T> {
35 const Dequeue = require("internal/fifo");
36 return new Dequeue();
37}
38```
39 
40C++ access:
41 
42```cpp
43object->putDirectBuiltinFunction(vm, globalObject, identifier,
44 fifoCreateFIFOCodeGenerator(vm), 0);
45```
46 
47## $ Globals and Special Syntax
48 
49**CRITICAL**: Use `.$call` and `.$apply`, never `.call` or `.apply`:
50 
51```typescript
52// ✗ WRONG - User can tamper
53callback.call(undefined, arg1);
54fn.apply(undefined, args);
55 
56// ✓ CORRECT - Tamper-proof
57callback.$call(undefined, arg1);
58fn.$apply(undefined, args);
59 
60// $ prefix for private APIs
61const arr = $Array.from(...); // Private globals
62map.$set(key, value); // Private methods
63const newArr = $newArrayWithSize(5); // JSC intrinsics
64$debug("Module loaded:", name); // Debug (stripped in release)
65$assert(condition, "message"); // Assertions (stripped in release)
66```
67 
68**Platform detection**: `process.platform` and `process.arch` are inlined and dead-code eliminated
69 
70## Validation and Errors
71 
72```typescript
73const { validateFunction } = require("internal/validators");
74 
75function myAPI(callback) {
76 if (!$isCallable(callback)) {
77 throw $ERR_INVALID_ARG_TYPE("callback", "function", callback);
78 }
79}
80```
81 
82## Build Process
83 
84`Source TS/JS → Preprocessor → Bundler → C++ Headers`
85 
861. Assign numeric IDs (A-Z sorted)
872. Replace `$` with `__intrinsic__`, `require("x")` with `$requireId(n)`
883. Bundle, convert `export default` to `return`
894. Replace `__intrinsic__` with `@`, inline into C++
90 
91ModuleLoader.rs loads modules by numeric ID via `InternalModuleRegistry.cpp`.
92 
93## Key Rules
94 
95- Use `.$call`/`.$apply` not `.call`/`.apply`
96- String literal `require()` only
97- Export via `export default {}`
98- Use JSC intrinsics for performance
99- Run `bun bd` after changes
100 

Commands it names

  • bun bd
  • node/
  • node:fs
  • node:path
  • bun/
  • bun:ffi
  • bun:sqlite
  • node-fetch

Sections

  • JavaScript Builtins in Bun
  • Directory Structure
  • Writing Modules
  • Writing Builtin Functions
  • $ Globals and Special Syntax
  • Validation and Errors
  • Build Process
  • Key Rules

What it covers

buildarchitecturedo-not

Stack — with the evidence

typescript

(1.00)

javascript

(1.00)

rust

(1.00)

node

(1.00)

bun

(1.00)

react

(1.00)

nextjs

(0.70)

express

(0.70)

drizzle

(0.70)

postgres

(0.70)

tailwind

(0.70)

vitest

(0.70)

jest

(0.70)

biome

(0.70)

prisma

(0.60)

github-actions

(0.60)

Format

CLAUDE.md

Claude Code's memory file. Shaped like AGENTS.md but with two things it lacks: @path imports, so shared rules live in one place, and a user-scope layer that follows the developer across repos rather than shipping with the code.

What the corpus says about it

Repository

Owner
oven-sh
Language
—
License
—
Archived
no

All configs in this repo

Also in oven-sh/bun

Diff this repo’s formats

One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
oven-sh/bun.github/workflows/CLAUDE.md · 95kCLAUDE.mdtypescriptjavascript+14testlint-formatarchgit+281/100today
oven-sh/bunCLAUDE.md · 95kCLAUDE.mdtypescriptjavascript+14buildteststylearch+396/1003 days ago
oven-sh/bunscripts/verify-baseline-static/CLAUDE.md · 95kCLAUDE.mdtypescriptjavascript+14buildtesting-strategy65/1003 days ago
oven-sh/bunsrc/CLAUDE.md · 95kCLAUDE.mdtypescriptjavascript+14setupbuildstyletypes+276/1003 days ago
oven-sh/bunsrc/jsc/bindings/v8/AGENTS.md · 95kAGENTS.mdtypescriptjavascript+14buildtestarchtesting-strategy+481/1003 days ago
oven-sh/bunsrc/jsc/bindings/v8/CLAUDE.md · 95kCLAUDE.mdtypescriptjavascript+14buildtestarchtesting-strategy+481/1003 days ago
oven-sh/buntest/CLAUDE.md · 95kCLAUDE.mdtypescriptjavascript+14teststyletesting-strategydo-not97/1003 days ago
oven-sh/buntest/js/node/test/parallel/CLAUDE.md · 95kCLAUDE.mdtypescriptjavascript+14test43/1003 days ago
Diff against .github/workflows/CLAUDE.md Diff against CLAUDE.md Diff against scripts/verify-baseline-static/CLAUDE.md Diff against src/CLAUDE.md Diff against src/jsc/bindings/v8/AGENTS.md Diff against src/jsc/bindings/v8/CLAUDE.md Diff against test/CLAUDE.md Diff against test/js/node/test/parallel/CLAUDE.md

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
bagisto/bagistoCLAUDE.md · 28kCLAUDE.mdphplaravel+8setupbuildteststyle+5100/1003 days ago
livewire/livewireCLAUDE.md · 24kCLAUDE.mdphpvitest+4setupbuildteststyle+4100/1003 days ago
microsoft/playwrightCLAUDE.md · 94kCLAUDE.mdtypescriptjavascript+10buildtestlint-formatstyle+7100/1003 days ago
dotCMS/corecore-web/CLAUDE.md · 949CLAUDE.mdjavanode+13teststylearchtesting-strategy+3100/1003 days ago
nimbalyst/nimbalystpackages/android/CLAUDE.md · 1.4kCLAUDE.mdtypescriptnode+16setupbuildstylearch+2100/1003 days ago
filamentphp/filamentCLAUDE.md · 32kCLAUDE.mdphplaravel+5buildtestlint-formatstyle+7100/1003 days ago
Adit-Jain-srm/NightmareNetCLAUDE.md · 45CLAUDE.mdtypescriptpython+18buildtestlint-formatstyle+6100/1003 days ago
dotCMS/coreCLAUDE.md · 949CLAUDE.mdjavanode+9setupbuildteststyle+799/100today
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack