Engineering
crane avatar

crane

Expert assistant for writing high-quality, modern, and memory-safe C++ code for V8 FFI wrappers and native integrations.

Introduction

The Crane C++ skill provides specialized guidance for engineers building high-performance native integrations between C++ and V8. It enforces strict adherence to modern C++17 and C++20 standards, prioritizing memory safety, RAII (Resource Acquisition Is Initialization), and zero-cost abstractions. This skill is specifically optimized for developers working within the Crane browser architecture or similar JavaScript runtime environments, ensuring that FFI boundaries are type-safe, handle lifetimes are managed correctly, and native performance is maximized.

This skill is highly recommended for developers implementing WebIDL bindings, managing V8 isolates and contexts, or interfacing C++ modules with Zig-based host systems. By automating best practices for V8 handle management, it minimizes the risk of segmentation faults, memory leaks, and undefined behaviors commonly associated with cross-language native extensions.

  • Advanced V8 handle management using HandleScope and Global handles to prevent memory leaks.

  • Modern C++ best practices, including smart pointers (unique_ptr, shared_ptr), explicit ownership, and const correctness.

  • Type-safe FFI boundary design, emphasizing enum classes and avoiding unsafe C-style casts.

  • Idiomatic code generation for V8 wrapper functions and native integrations.

  • RAII-based scope management for V8 contexts, isolates, and persistent objects.

  • Best suited for systems programming in contexts like Chromium-based engines, V8 integration, or native node.js-style extensions.

  • Expects inputs related to V8 API structures or C++ binding definitions; outputs will include refactored code snippets, design patterns for FFI, and performance-tuned C++ implementation details.

  • Constraints: Focuses exclusively on modern C++ patterns; legacy C++98/C++03 code will be refactored to conform to contemporary memory safety standards.

  • Integration: Complements the Zig skill by ensuring the C++ side of the FFI correctly satisfies the requirements of the host environment, facilitating seamless native interoperation.

Repository Stats

Stars
9
Forks
0
Open Issues
0
Language
Zig
Default Branch
main
Sync Status
Idle
Last Synced
May 4, 2026, 01:28 AM
View on GitHub