implementing-jsc-classes-zig

Generate Zig-backed JavaScriptCore bindings for Bun from .classes.ts interfaces.

Updated Jan 6, 2026
One-click install
npx skills add https://github.com/zhcndoc/bun --skill implementing-jsc-classes-zig
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: implementing-jsc-classes-zig
Source: https://github.com/zhcndoc/bun/tree/main/.claude/skills/implementing-jsc-classes-zig
Command: npx skills add https://github.com/zhcndoc/bun --skill implementing-jsc-classes-zig

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a structured approach to implementing JavaScriptCore bindings for Bun by generating Zig-based bindings and .classes.ts interfaces, enabling seamless exposure of Zig APIs to JavaScript.

Core Features & Use Cases

  • Define interfaces in a .classes.ts file to describe classes, methods, and properties that bridge JS and Zig.
  • Implement the corresponding Zig code to back those interfaces, including constructors, methods, getters, and finalizers.
  • Generate and register the binding glue (C++/Zig interop) so the new API is accessible from Bun's JS runtime.
  • Use cases include adding native Bun APIs in Zig that expose high-performance functionality to JavaScript with type-safe bindings.

Quick Start

Create a .classes.ts that defines the target class; implement its Zig binding in a .zig file; run the binding generator/build to regenerate JS bindings; rebuild Bun to apply changes.

Frequently Asked Questions about implementing-jsc-classes-zig

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I expose Zig functions to JavaScript in Bun?

You can expose Zig functions to JavaScript in Bun by defining class interfaces in a .classes.ts file and implementing the corresponding Zig code to wire constructors, methods, and getters into the binding layer.

What are JavaScriptCore bindings and how do they work with Zig?

JavaScriptCore bindings bridge JavaScript and native code. In Bun, you define interfaces in .classes.ts, implement backing Zig code, and generate interop glue so the JS runtime can access native high-performance APIs.

Do I need the Zig compiler to create native Bun classes?

Yes, creating native Bun classes requires the Zig compiler and Bun's binding generator to parse your .classes.ts definitions, generate the interop glue, and compile the Zig implementations into the runtime.

How do I generate JavaScriptCore interop glue after writing my Zig bindings?

After writing your Zig implementations and .classes.ts interfaces, run Bun's binding generator and build process to regenerate the JavaScript bindings and compile the C++/Zig interop glue into Bun.

Can I add high-performance native APIs to Bun using Zig instead of C++?

Yes, you can add high-performance native APIs to Bun using Zig by defining type-safe class interfaces in .classes.ts and implementing the backing logic in Zig to expose JS-facing wrappers through JavaScriptCore.

Why do I need a .classes.ts file for Zig JavaScriptCore bindings?

The .classes.ts file describes classes, methods, and properties that bridge JavaScript and Zig, allowing Bun's binding generator to parse the interface and create the necessary type-safe interop glue automatically.