Bun's JavaScriptCore Class Bindings Generator

Creates JavaScript classes using Bun's Zig bindings generator (.classes.ts).

You say
Install this skill Read the source first Free Written by oven-sh · unverified publisher
Context cost
1.3k tokensestimated from the bundle, loaded when it triggers
Bundle
1 file · 5.3 kBtext throughout, nothing executable
Licence
MITfree to use
Last change
no release on file
Servers it uses
Noneruns standalone

What it does

Creates JavaScript classes using Bun's Zig bindings generator (.classes.ts). Use when implementing new JS APIs in Zig with JSC integration.

Installed, it changes the agent in these ways.

What this skill changes about the agent is not written down here yet. The listing was collected from its source, and the description is in its own SKILL.md.

Workflow

Runs a procedure end to end.

apijavascriptbun

The skill itself

This is the whole product. A skill is instructions the model reads, so there is nothing behind the listing you cannot see first — the front matter loads with every session, and the body below it loads when the skill triggers.

SKILL.md5.3 kB · 207 lines
--- name: implementing-jsc-classes-zig description: Creates JavaScript classes using Bun's Zig bindings generator (.classes.ts). Use when implementing new JS APIs in Zig with JSC integration. ---
6# Bun's JavaScriptCore Class Bindings Generator
7
8Bridge JavaScript and Zig through .classes.ts definitions and Zig implementations.
9
10## Architecture
11
121. **Zig Implementation** (.zig files)
132. **JavaScript Interface Definition** (.classes.ts files)
143. **Generated Code** (C++/Zig files connecting them)
15
16## Class Definition (.classes.ts)
17
18```typescript
19define({
20 name: "TextDecoder",
21 constructor: true,
22 JSType: "object",
23 finalize: true,
24 proto: {
25 decode: { args: 1 },
26 encoding: { getter: true, cache: true },
27 fatal: { getter: true },
28 },
29});
30```
31
32Options:
33
34- name: Class name
35- constructor: Has public constructor
36- JSType: "object", "function", etc.
37- finalize: Needs cleanup
38- proto: Properties/methods
39- cache: Cache property values via WriteBarrier
40
41## Zig Implementation
42
43```zig
44pub const TextDecoder = struct {
45 pub const js = JSC.Codegen.JSTextDecoder;
46 pub const toJS = js.toJS;
47 pub const fromJS = js.fromJS;
48 pub const fromJSDirect = js.fromJSDirect;
49
50 encoding: []const u8,
51 fatal: bool,
52
53 pub fn constructor(
54 globalObject: *JSGlobalObject,
55 callFrame: *JSC.CallFrame,
56 ) bun.JSError!*TextDecoder {
57 return bun.new(TextDecoder, .{ .encoding = "utf-8", .fatal = false });
58 }
59
60 pub fn decode(
61 this: *TextDecoder,
62 globalObject: *JSGlobalObject,
63 callFrame: *JSC.CallFrame,
64 ) bun.JSError!JSC.JSValue {
65 const args = callFrame.arguments();
66 if (args.len < 1 or args.ptr[0].isUndefinedOrNull()) {
67 return globalObject.throw("Input cannot be null", .{});
68 }
69 return JSC.JSValue.jsString(globalObject, "result");
70 }
71
72 pub fn getEncoding(this: *TextDecoder, globalObject: *JSGlobalObject) JSC.JSValue {
73 return JSC.JSValue.createStringFromUTF8(globalObject, this.encoding);
74 }
75
76 fn deinit(this: *TextDecoder) void {
77 // Release resources
78 }
79
80 pub fn finalize(this: *TextDecoder) void {
81 this.deinit();
82 bun.destroy(this);
83 }
84};
85```
86
87**Key patterns:**
88
89- Use bun.JSError!JSValue return type for error handling
90- Use globalObject not ctx
91- deinit() for cleanup, finalize() called by GC
92- Update src/bun.js/bindings/generated_classes_list.zig
93
94## CallFrame Access
95
96```zig
97const args = callFrame.arguments();
98const first_arg = args.ptr[0]; // Access as slice
99const argCount = args.len;
100const thisValue = callFrame.thisValue();
101```
102
103## Property Caching
104
105For cache: true properties, generated accessors:
106
107```zig
108// Get cached value
109pub fn encodingGetCached(thisValue: JSC.JSValue) ?JSC.JSValue {
110 const result = TextDecoderPrototype__encodingGetCachedValue(thisValue);
111 if (result == .zero) return null;
112 return result;
113}
114
115// Set cached value
116pub fn encodingSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void {
117 TextDecoderPrototype__encodingSetCachedValue(thisValue, globalObject, value);
118}
119```
120
121## Error Handling
122
123```zig
124pub fn method(this: *MyClass, globalObject: *JSGlobalObject, callFrame: *JSC.CallFrame) bun.JSError!JSC.JSValue {
125 const args = callFrame.arguments();
126 if (args.len < 1) {
127 return globalObject.throw("Missing required argument", .{});
128 }
129 return JSC.JSValue.jsString(globalObject, "Success!");
130}
131```
132
133## Memory Management
134
135```zig
136pub fn deinit(this: *TextDecoder) void {
137 this._encoding.deref();
138 if (this.buffer) |buffer| {
139 bun.default_allocator.free(buffer);
140 }
141}
142
143pub fn finalize(this: *TextDecoder) void {
144 JSC.markBinding(@src());
145 this.deinit();
146 bun.default_allocator.destroy(this);
147}
148```
149
150## Creating a New Binding
151
1521. Define interface in .classes.ts:
153
154```typescript
155define({
156 name: "MyClass",
157 constructor: true,
158 finalize: true,
159 proto: {
160 myMethod: { args: 1 },
161 myProperty: { getter: true, cache: true },
162 },
163});
164```
165
1662. Implement in .zig:
167
168```zig
169pub const MyClass = struct {
170 pub const js = JSC.Codegen.JSMyClass;
171 pub const toJS = js.toJS;
172 pub const fromJS = js.fromJS;
173
174 value: []const u8,
175
176 pub const new = bun.TrivialNew(@This());
177
178 pub fn constructor(globalObject: *JSGlobalObject, callFrame: *JSC.CallFrame) bun.JSError!*MyClass {
179 return MyClass.new(.{ .value = "" });
180 }
181
182 pub fn myMethod(this: *MyClass, globalObject: *JSGlobalObject, callFrame: *JSC.CallFrame) bun.JSError!JSC.JSValue {
183 return JSC.JSValue.jsUndefined();
184 }
185
186 pub fn getMyProperty(this: *MyClass, globalObject: *JSGlobalObject) JSC.JSValue {
187 return JSC.JSValue.jsString(globalObject, this.value);
188 }
189
190 pub fn deinit(this: *MyClass) void {}
191
192 pub fn finalize(this: *MyClass) void {
193 this.deinit();
194 bun.destroy(this);
195 }
196};
197```
198
1993. Add to src/bun.js/bindings/generated_classes_list.zig
200
201## Generated Components
202
203- **C++ Classes**: JSMyClass, JSMyClassPrototype, JSMyClassConstructor
204- **Method Bindings**: MyClassPrototype__myMethodCallback
205- **Property Accessors**: MyClassPrototype__myPropertyGetterWrap
206- **Zig Bindings**: External function declarations, cached value accessors
207
In the file
SKILL.md570 words
Files1
LicenceMIT
Why you can read it

Nothing in a skill executes. The client loads the text and the model follows it, so a skill can be audited the way a runbook is — by reading it.

What it costs in context

Skills are not billed by the call. They are paid for in context: every token the instructions occupy is a token your code, your diff and your conversation cannot use. Here is what this one takes and when it takes it.

≈50
always loaded
The name and description, so the model knows the skill exists and when to reach for it.
1,275
on trigger
The instruction body, read only when the skill fires.
0.66%
of a 200k window
Ten skills this size would take about 7% of the window before you open a file.
050k100k150k200k context window

1.3k tokens, estimated from the bundle at four bytes to the token, held for the rest of the session once it triggers. Middling. Fine to keep on in a project where you use it weekly, worth unloading in one where you never do.

Servers bill, skills cost

A server charges by the month. A skill charges once per session, in context, and then keeps charging it for as long as the session lives.

Before and after

The same question, put to the same model twice: once as it comes, and once with these instructions loaded.

No worked example has been published for this skill yet.

Adoption
Installsnone yet
Ratingno reviews yet

The procedure it runs

The procedure has not been published here. It is in the skill’s own SKILL.md, which its author has not sent to the marketplace yet.

Prose, not code

These steps are written for a model to follow, not executed by a runtime. It can still be told to skip one, and it will say so when it does.

Servers it uses

None. This skill calls no MCP servers at all.

Everything it needs is in the instructions, so it works in a project with nothing connected — the model reads the file and changes how it works with what it can already reach.

It writes no files and reaches no network. All it changes is how the model reasons and writes.

What it asks for
Writes filesno
Network accessno

Read from the allowed-tools line of this skill’s own SKILL.md. A skill grants no permissions of its own — it can only ask for tools your client already has.

What it will not do

Every skill is narrow, and the useful ones say where they stop. These are the jobs this one is the wrong tool for.

What this skill is not for has not been published here. Nothing is implied by that: it is a section the author has not filled in.

What is in the bundle

1 file, 5.3 kB on disk. A bundle is text throughout: the instructions the model reads, plus the templates it fills in.

  • SKILL.md5.3 kB
What is not in it

No dependencies and nothing executable: a skill is text the agent reads, so the bundle is 1 file you can review in full before installing. The MIT licence covers the templates and examples as well as the instructions.

Install

Installing copies the bundle into your project. Nothing runs at install time — the files sit on disk until the model reads them.

# Bun's JavaScriptCore Class Bindings Generator · 1.3k tokens when loaded npx mcprush@latest skill add oven-sh/bun-s-javascriptcore-class-bindings-generator

Writes to .claude/skills/bun-s-javascriptcore-class-bindings-generator/ in the current project. Add --global to put it in your home directory instead, for every project.

Which clients pick it up on their own

A skill is a folder of text. A client with a skills folder reads it without being told; everywhere else the same text works, it is just handed to the model rather than found.

Claude Code.claude/skills/
Claude Desktop
ChatGPT
Cursor.cursor/skills/
VS Code.github/skills/
Codex CLI.agents/skills/
Gemini CLI.gemini/skills/
Grok.grok/skills/
Zed.agents/skills/
Windsurf.windsurf/skills/
Agent SDK.claude/skills/
HTTP / API
This release
Versionnot versioned
Publishedno release date on file
PriceFree
Referenceoven-sh/bun-s-javascriptcore-class-bindings-generator

Versions

Its author publishes no version number, so there is nothing here to pin to: what you install is the folder as it stands today. Instructions change more often than APIs do — a skill can be rewritten entirely without anything it depends on moving.

v
  • No earlier releases have been published to the marketplace.
Pinning

Nothing to pin to: this skill carries no version number of its own. What you install is what the folder holds on the day you install it.

Reviews

no reviews yet · no installs yet

Nobody has reviewed this skill yet. The rating is the mean of the reviews written here, so there is none until somebody writes the first.

Who can post

Only accounts that have had the skill installed for fourteen days, so a review is written after living with it rather than after reading it. Publishers may reply once.

Who wrote it

OV
oven-sh

Publishes on mcprush.

0 servers listed2 skills listednot claimed
Profile
Publisher
Servers0
Claim this skill