implementing-jsc-classes-cpp

Official

Expose C++ classes to JavaScript via JSC.

Authorzhcndoc
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This skill provides a structured approach to exposing native C++ classes to JavaScript in Bun's JavaScriptCore (JSC) runtime, enabling JS code to instantiate and interact with high-performance native objects.

Core Features & Use Cases

  • Bind C++ classes to JS by defining a FooPrototype and a FooConstructor, with a public Foo class and optional internal fields.
  • Create robust prototypes and constructors that integrate with Bun's memory spaces and subspaces to ensure proper lifecycle and performance.
  • Use cases include building native bindings for graphics, data processing, or system-level APIs that require JS-facing wrappers.

Quick Start

Define your C++ class, implement FooPrototype and FooConstructor following the pattern in the example, hook into Bun's Zig registration, and compile Bun to expose the new JS type.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: implementing-jsc-classes-cpp
Download link: https://github.com/zhcndoc/bun/archive/main.zip#implementing-jsc-classes-cpp

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.