[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6BV99584B7J2VCCX0A4P6J4":3,"skill-same:01M6BV99584B7J2VCCX0A4P6J4":130},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":45,"linkOnly":46,"markdownContent":47,"markdownBody":48,"frontMatter":49,"refName":50,"commitSha":51,"skillDirectory":52,"forksCount":15,"repositoryHtmlUrl":53,"repositoryHomepageUrl":17,"ownerHtmlUrl":54,"ownerBlogUrl":17,"ownerDescription":17,"updatedAt":55,"install":56,"resources":69},"01M6BV99584B7J2VCCX0A4P6J4","zig-interop","Zig FFI 与跨语言互操作","Zig FFI and cross-language interop from Bun, Ghostty, and TigerBeetle. Use when wrapping C libraries, binding C++, exporting Zig as C, or configuring build.zig for C compilation.","源自 Bun、Ghostty 和 TigerBeetle 的 Zig FFI 与跨语言互操作经验。适用于封装 C 库、绑定 C++、将 Zig 导出为 C 接口，或配置 build.zig 以进行 C 编译。","bnferguson\u002Fdotfiles","bnferguson","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F47749?v=4","01M6BV4H2TJKK8P14W86V1ZCPP","Brandon Ferguson","01M6BV4H7GJWTZJ1BVHQ1TX11Y",0,"MIT",null,"https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzig-interop\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8CA7Z1VJ51NY37VK2NF2DCF","Zig 开发","SCENARIO","使用场景",[31,32,33,34,35,36,37,38,39,40,41,42,43,44],"zig interop","zig","libraries","ffi","ghostty","use","bun","build","language","c++","as","binding","for","when","2026-11-10 10:12:30",false,"---\nname: zig-interop\ndescription: \"Zig FFI and cross-language interop from Bun, Ghostty, and TigerBeetle. Use when wrapping C libraries, binding C++, exporting Zig as C, or configuring build.zig for C compilation.\"\n---\n\n# Zig Interop Skill\n\nPatterns for bridging Zig with C, C++, Rust, Swift, and Objective-C, drawn from production projects that ship real FFI boundaries. This skill covers the mechanics of crossing language borders -- type mapping, memory ownership transfer, ABI compliance, build integration, and comptime code generation.\n\n## Table of Contents\n\n- [How to Use This Skill](#how-to-use-this-skill)\n- [Bundled Resources](#bundled-resources)\n- [@cImport Direct Binding](#cimport-direct-binding)\n- [C Shim Layer for C++](#c-shim-layer-for-cpp)\n- [Exporting Zig as a C Library](#exporting-zig-as-a-c-library)\n- [Cross-Language via C ABI](#cross-language-via-c-abi)\n- [Zig Build System C Compilation](#zig-build-system-c-compilation)\n- [Comptime Metaprogramming for FFI](#comptime-metaprogramming-for-ffi)\n- [Memory Ownership Across Boundaries](#memory-ownership-across-boundaries)\n- [Sources](#sources)\n\n## How to Use This Skill\n\nPick the section that matches your task:\n\n- **Wrapping a C library** -- Start with [@cImport Direct Binding](#cimport-direct-binding) and the `cimport_wrapping.zig` example\n- **Binding C++ code** -- Read [C Shim Layer for C++](#c-shim-layer-for-cpp), then the shim pipeline in `cpp_shim_binding.zig`\n- **Exposing Zig to other languages** -- [Exporting Zig as a C Library](#exporting-zig-as-a-c-library) and `export_c_library.zig`\n- **Zig talking to Rust, Swift, ObjC, Go, or Ruby** -- [Cross-Language via C ABI](#cross-language-via-c-abi) and `cross_language_abi.zig`\n- **Building a multi-language client library** -- [Exporting Zig as a C Library](#exporting-zig-as-a-c-library) and `cross_language_consumers.zig`\n- **Compiling C sources with zig build** -- [Zig Build System C Compilation](#zig-build-system-c-compilation) and `build_c_sources.zig`\n- **Generating type-safe wrappers at comptime** -- [Comptime Metaprogramming for FFI](#comptime-metaprogramming-for-ffi) and `comptime_ffi_wrapper.zig`\n- **Ownership rules at FFI boundaries** -- [Memory Ownership Across Boundaries](#memory-ownership-across-boundaries) and `memory_ownership_boundary.zig`\n\n## Bundled Resources\n\n### References\n\nLoad on demand when working on a specific interop pattern:\n\n| Reference | Description | Search hint |\n|-----------|-------------|-------------|\n| `references\u002Fcimport-and-type-mapping.md` | @cImport mechanics, Ghostty's c.zig pattern, Bun's pre-translation approach, opaque vs handle wrapping | `@cImport`, `translate-c` |\n| `references\u002Fcpp-shim-patterns.md` | Bun's codegen pipeline, `[[ZIG_EXPORT]]` annotations, ExternTraits, Errorable(T), flat C API alternatives | `C++ shim`, `extern \"C\"` |\n| `references\u002Fexporting-zig-as-c.md` | libxev's fixed-size byte arrays, Ghostty's CAPI struct, @fieldParentPtr smuggling, module.modulemap | `export fn`, `callconv` |\n| `references\u002Fcross-language-abi.md` | Zig-ObjC (zig-objc), Zig-Swift (module.modulemap), Zig-Rust, Zig-Go (cgo\u002Fruntime.Pinner), Zig-Ruby (zig.rb\u002FRubyAllocator) | `ABI`, `Rust FFI`, `cgo`, `Ruby` |\n| `references\u002Fbuild-system-c-integration.md` | `addCSourceFiles`, `addTranslateC`, framework linking, allyourcodebase vendoring patterns, cross-compilation | `addCSourceFiles`, `linkSystemLibrary`, `addTranslateC` |\n| `references\u002Fcomptime-ffi-metaprogramming.md` | zig-objc @Type synthesis, ziglua field walking, TigerBeetle foreign code gen, zig-gobject GIR pipeline | `comptime`, `@typeInfo`, `@Type` |\n\n### Examples\n\nComplete, annotated code demonstrating each pattern:\n\n| Example | Description |\n|---------|-------------|\n| `examples\u002Fcimport_wrapping.zig` | @cImport, type aliases, sentinel pointer conversion |\n| `examples\u002Fcpp_shim_binding.zig` | Zig side of a C++ shim: extern decls, init\u002Fdeinit lifecycle |\n| `examples\u002Fexport_c_library.zig` | Exporting Zig functions with opaque handles and error codes |\n| `examples\u002Fcross_language_abi.zig` | extern struct layout, callbacks, context pointer passing |\n| `examples\u002Fbuild_c_sources.zig` | build.zig template for compiling C alongside Zig |\n| `examples\u002Fcomptime_ffi_wrapper.zig` | Comptime type reflection for type-safe C wrappers |\n| `examples\u002Fmemory_ownership_boundary.zig` | Ownership transfer patterns across FFI boundaries |\n| `examples\u002Fcross_language_consumers.zig` | Comptime binding generator emitting Go\u002FRust\u002FC types (TigerBeetle pattern) |\n\n## @cImport Direct Binding\n\nZig's `@cImport` translates C headers at compile time, giving direct access to C types and functions without writing bindings by hand. Production projects take different approaches depending on header complexity:\n\n- **Dedicated c.zig files** -- Ghostty isolates each C library's `@cImport` into a per-package `c.zig` file (e.g., `pkg\u002Ffreetype\u002Fc.zig`, `pkg\u002Ffontconfig\u002Fc.zig`). This prevents duplicate translation units and keeps import paths clean.\n- **Pre-translated bindings** -- Bun does NOT use `@cImport` for BoringSSL. Instead it ships a 19K-line pre-translated and manually enriched Zig file, giving tighter control over types and avoiding translate-c limitations.\n- **addTranslateC in build.zig** -- ziglua uses `addTranslateC` as a middle ground: build-time header translation without embedding `@cImport` in source.\n- **C ABI workaround files** -- When Zig's C ABI has platform-specific issues, Ghostty uses small ext.c files compiled alongside the Zig code as shims.\n\nSee `references\u002Fcimport-and-type-mapping.md` for the full type mapping table and `examples\u002Fcimport_wrapping.zig` for a worked example wrapping a C library.\n\n## C Shim Layer for C++\n\nC++ cannot be imported directly. Production projects use different strategies depending on the C++ codebase's size and complexity:\n\n- **Codegen pipeline** -- Bun wraps JavaScriptCore through a three-layer system: C++ `bindings.cpp` files annotated with `[[ZIG_EXPORT(tag)]]`, a TypeScript code generator (`cppbind.ts`) that parses annotations and emits Zig bindings, and Zig opaque types that consume the generated declarations. Exception handling uses three tags: `nothrow`, `zero_is_throw`, `check_slow`.\n- **Flat C API alternative** -- Lightpanda does NOT wrap V8 C++ directly. It uses zig-v8-fork, which provides a pre-existing flat C API. When a maintained C API exists for your C++ dependency, prefer it over writing custom shims.\n- **ABI-compatible types** -- Bun's JSValue is `enum(i64)`, directly matching JSC's NaN-boxed EncodedJSValue. Errorable(T) is an ABI-safe tagged union for error propagation across the boundary. ExternTraits\u003CT> in C++ define conversion rules (e.g., WTF::String uses `leakRef()` to transfer ownership).\n- **Opaque handle wrapping for STL types** -- zpp wraps `std::string` behind opaque `intptr_t` handles with three ownership modes (read-only, fixed write, growable write). C++ side uses `new`\u002F`delete` behind `extern \"C\"` functions; Zig caches data pointer and length to avoid FFI calls on reads. Build requires `-fno-exceptions -fno-rtti` on the C++ side.\n- **Separate build systems** -- Bun's C++ is NOT compiled by build.zig. It uses a separate Ninja\u002FTypeScript build system; Zig produces one .o file that links against the C++ artifacts.\n\nSee `references\u002Fcpp-shim-patterns.md` and `examples\u002Fcpp_shim_binding.zig`.\n\n## Exporting Zig as a C Library\n\nZig can produce shared or static libraries consumable by any C-compatible language. Production projects demonstrate two distinct approaches:\n\n- **Fixed-size byte array handles** -- libxev exposes opaque types as stack-allocatable C structs containing a fixed-size byte array (`uint8_t data[XEV_SIZEOF_LOOP - sizeof(XEV_ALIGN_T)]`). No heap allocation needed on the C side. Size validation tests prevent drift.\n- **CAPI struct pattern** -- Ghostty collects all `export fn` declarations into a single CAPI struct in `embedded.zig`. The C consumer receives one struct with all function pointers, rather than linking against individual symbols.\n- **Callback pointer smuggling** -- libxev extends its Completion struct with extra fields, then uses `@fieldParentPtr` to recover context inside callbacks -- avoiding a separate userdata pointer.\n- **Multi-language client pattern** -- TigerBeetle compiles one Zig core into platform-specific static libraries consumed by Go, Rust, Python, and other language clients through the C ABI. Comptime binding generators emit idiomatic types per target language. Gotcha: `u128` is passed as `[16]u8` because u128-by-value is broken across compilers.\n- **Swift consumption path** -- Ghostty exports through a hand-written `ghostty.h` header with a `module.modulemap`, allowing Swift to import the Zig library as `GhosttyKit`. XCFramework generation handles macOS\u002FiOS targets.\n\nSee `references\u002Fexporting-zig-as-c.md` and `examples\u002Fexport_c_library.zig`.\n\n## Cross-Language via C ABI\n\nThe C ABI is the lingua franca for cross-language calls. Production projects demonstrate several paths:\n\n- **Zig-ObjC via zig-objc** -- Ghostty uses mitchellh\u002Fzig-objc, NOT raw `objc_msgSend`. Pattern: `objc.getClass(\"NSFileManager\").?.msgSend(objc.Object, objc.sel(\"defaultManager\"), .{})`. Metal rendering is the heaviest ObjC consumer, with AutoreleasePool manually managed per frame.\n- **Zig-Swift via C API** -- Ghostty has no direct Zig-Swift bridge. Architecture: Zig export fn -> hand-written ghostty.h -> module.modulemap -> Swift imports as GhosttyKit. Swift passes userdata via `Unmanaged.passUnretained(self).toOpaque()`.\n- **Zig-Rust via extern \"C\"** -- Lightpanda bridges to html5ever: Rust exposes `extern \"C\"` functions, Zig declares matching extern prototypes. Callback-driven memory: Zig passes function pointers into Rust, Rust calls back for DOM mutations. No shared heap.\n- **Zig-Go via cgo** -- TigerBeetle's Go client links a pre-built Zig static library through cgo. Go objects accessed from Zig callback threads are pinned with `runtime.Pinner` for GC safety. Async bridge: Zig event loop fires a C completion callback that writes to a Go buffered channel. Achieves 94% of native Zig speed.\n- **Zig-Ruby via zig.rb** -- zig.rb implements `std.mem.Allocator` backed by Ruby's `xmalloc`\u002F`xrealloc`\u002F`xfree`, keeping Zig allocations visible to Ruby's GC. Comptime method binding validates signatures and generates per-arity C trampolines (0-15 args), avoiding varargs entirely. TypedDataClass wraps Zig structs as GC-tracked Ruby objects.\n- **Callback + userdata pattern** -- Ghostty's Options extern struct carries function pointers plus `?*anyopaque` userdata for each callback, letting the other language smuggle its own context through the C boundary.\n\nSee `references\u002Fcross-language-abi.md` and `examples\u002Fcross_language_abi.zig`.\n\n## Zig Build System C Compilation\n\n`zig build` can compile C and C++ sources alongside Zig, replacing Make\u002FCMake for many projects:\n\n- **Per-package build.zig** -- Ghostty isolates each C library in `pkg\u002F\u003Cname>\u002F` with its own `build.zig` and dedicated `c.zig` for `@cImport`. This keeps dependency boundaries clean and makes each library independently buildable.\n- **addTranslateC for headers** -- ziglua compiles upstream Lua C source via `addCSourceFiles` and uses `addTranslateC` for headers, supporting Lua 5.1-5.5, LuaJIT, and Luau from a single codebase via comptime version dispatch.\n- **Cross-compilation** -- Pass target triple; Zig's bundled libc headers handle sysroot concerns.\n- **Separate C++ build** -- Bun does NOT compile C++ through build.zig. When the C++ dependency has its own complex build system, link against pre-built artifacts rather than trying to replicate the build in Zig.\n\nSee `references\u002Fbuild-system-c-integration.md` and `examples\u002Fbuild_c_sources.zig` (a build.zig template).\n\n## Comptime Metaprogramming for FFI\n\nZig's comptime can generate type-safe wrappers from type information, eliminating boilerplate. But the approach depends on API surface size:\n\n- **Comptime function synthesis** -- zig-objc's core trick: `@Type(.{ .@\"fn\" = ... })` synthesizes `objc_msgSend` call signatures at comptime, selecting `_stret`\u002F`_fpret` variants based on `builtin.target.cpu.arch` and return type. The MsgSend(T) mixin gives both Object and Class the same dispatch interface.\n- **Build-time code generation** -- vulkan-zig does NOT use comptime for the Vulkan API (too large). A generator executable runs during `zig build`, producing `vk.zig` with dispatch tables. Consumers use `inline for (std.meta.fields(Dispatch))` to load nullable function pointers from an opaque loader.\n- **Comptime version dispatch** -- ziglua's define.zig walks `@typeInfo(T).@\"struct\".fields` at comptime to generate Lua type definitions. A single codebase supports multiple Lua versions via `switch (lang)`.\n- **Comptime-generates-foreign-code** -- TigerBeetle's `rust_bindings.zig` and `go_bindings.zig` use Zig comptime to emit source code in other languages -- `#[repr(C)]` Rust structs and layout-compatible Go structs. The Zig build system runs the generator, and each language client consumes the output as checked-in generated code.\n- **Build-time XML-to-Zig pipeline** -- zig-gobject translates GIR XML into a complete Zig package with `build.zig`. Generated `extern fn` declarations are aliased to `pub const` (zero-cost). Comptime type hierarchy enables `isAssignableFrom()` that walks parent chains and interfaces at compile time, with `as()` for safe upcast and `cast()` returning `?*T` for downcast.\n- **Comptime bridge mapping** -- Lightpanda's bridge.zig uses `Builder(comptime T: type)` to map Zig types to JavaScript concepts at compile time.\n\nSee `references\u002Fcomptime-ffi-metaprogramming.md` and `examples\u002Fcomptime_ffi_wrapper.zig`.\n\n## Memory Ownership Across Boundaries\n\nMemory ownership is the hardest part of FFI. Production projects use these strategies:\n\n- **Tagged pointer encoding** -- Bun's ZigString is an extern struct with UTF-16\u002FLatin1 encoding packed into the high bits of the pointer, avoiding a separate encoding field.\n- **Callback-driven allocation** -- Lightpanda's Rust bridge passes function pointers into Rust; Rust calls back into Zig for DOM mutations. No shared heap means no cross-language allocator coordination.\n- **Custom allocator routing** -- Bun routes BoringSSL memory through mimalloc by exporting `OPENSSL_memory_alloc`\u002F`OPENSSL_memory_free` hooks. The C library calls these instead of system malloc.\n- **Sentinel tracking** -- Ghostty's `ghostty_string_s` tracks a sentinel flag so the receiving side knows whether to scan for a null terminator or use a length field for deallocation.\n- **Ownership transfer via leakRef** -- Bun's ExternTraits\u003CWTF::String> uses `leakRef()` to hand a reference-counted string across the boundary without the C++ side releasing it.\n\nSee `examples\u002Fmemory_ownership_boundary.zig` for a comprehensive example combining these patterns.\n\n## Sources\n\n### Tier 1 -- Production codebases with extensive FFI\n\n- **Bun** -- JavaScript runtime; C++ interop with JavaScriptCore via codegen pipeline, BoringSSL via pre-translated bindings, custom allocator routing through mimalloc\n- **Ghostty** -- Terminal emulator; Zig-ObjC via zig-objc, Zig-Swift via C API + module.modulemap, per-package C library isolation, CAPI struct pattern\n- **libxev** -- Cross-platform event loop; fixed-size byte array opaque handles, @fieldParentPtr callback smuggling, hand-written C header + pkg-config\n- **Lightpanda** -- Headless browser; flat C API via zig-v8-fork, Rust-Zig via callback-driven extern \"C\", comptime bridge mapping\n- **TigerBeetle** -- Financial transactions database; one Zig core with Go\u002FRust\u002FPython\u002Fetc. clients via C ABI, comptime binding generators emit foreign-language source, u128-as-[16]u8 ABI workaround, runtime.Pinner for Go GC safety\n\n### Tier 2 -- Libraries and binding generators\n\n- **vulkan-zig** -- Build-time generated Vulkan bindings from XML spec, dispatch table pattern\n- **ziglua** -- Lua binding using addTranslateC + comptime version dispatch across Lua 5.1-5.5\u002FLuaJIT\u002FLuau\n- **zig-objc** -- Objective-C runtime bindings via comptime @Type function synthesis, architecture-aware dispatch\n- **zig-gobject** -- GIR XML-to-Zig pipeline with comptime-safe type hierarchy, zero-cost extern fn aliasing, typed signal connection\n- **zpp** -- C++ STL bridging via opaque handles; wraps std::string with three ownership modes, bidirectional data flow via function pointers\n- **zig.rb** -- Ruby extension framework; RubyAllocator (std.mem.Allocator backed by xmalloc), comptime per-arity trampoline generation, TypedDataClass for GC-tracked Zig structs\n- **allyourcodebase** -- Community collection of 115+ C library build.zig packages; vendoring patterns, config headers, platform dispatch without pkg-config\n","# Zig Interop Skill\n\nPatterns for bridging Zig with C, C++, Rust, Swift, and Objective-C, drawn from production projects that ship real FFI boundaries. This skill covers the mechanics of crossing language borders -- type mapping, memory ownership transfer, ABI compliance, build integration, and comptime code generation.\n\n## Table of Contents\n\n- [How to Use This Skill](#how-to-use-this-skill)\n- [Bundled Resources](#bundled-resources)\n- [@cImport Direct Binding](#cimport-direct-binding)\n- [C Shim Layer for C++](#c-shim-layer-for-cpp)\n- [Exporting Zig as a C Library](#exporting-zig-as-a-c-library)\n- [Cross-Language via C ABI](#cross-language-via-c-abi)\n- [Zig Build System C Compilation](#zig-build-system-c-compilation)\n- [Comptime Metaprogramming for FFI](#comptime-metaprogramming-for-ffi)\n- [Memory Ownership Across Boundaries](#memory-ownership-across-boundaries)\n- [Sources](#sources)\n\n## How to Use This Skill\n\nPick the section that matches your task:\n\n- **Wrapping a C library** -- Start with [@cImport Direct Binding](#cimport-direct-binding) and the `cimport_wrapping.zig` example\n- **Binding C++ code** -- Read [C Shim Layer for C++](#c-shim-layer-for-cpp), then the shim pipeline in `cpp_shim_binding.zig`\n- **Exposing Zig to other languages** -- [Exporting Zig as a C Library](#exporting-zig-as-a-c-library) and `export_c_library.zig`\n- **Zig talking to Rust, Swift, ObjC, Go, or Ruby** -- [Cross-Language via C ABI](#cross-language-via-c-abi) and `cross_language_abi.zig`\n- **Building a multi-language client library** -- [Exporting Zig as a C Library](#exporting-zig-as-a-c-library) and `cross_language_consumers.zig`\n- **Compiling C sources with zig build** -- [Zig Build System C Compilation](#zig-build-system-c-compilation) and `build_c_sources.zig`\n- **Generating type-safe wrappers at comptime** -- [Comptime Metaprogramming for FFI](#comptime-metaprogramming-for-ffi) and `comptime_ffi_wrapper.zig`\n- **Ownership rules at FFI boundaries** -- [Memory Ownership Across Boundaries](#memory-ownership-across-boundaries) and `memory_ownership_boundary.zig`\n\n## Bundled Resources\n\n### References\n\nLoad on demand when working on a specific interop pattern:\n\n| Reference | Description | Search hint |\n|-----------|-------------|-------------|\n| `references\u002Fcimport-and-type-mapping.md` | @cImport mechanics, Ghostty's c.zig pattern, Bun's pre-translation approach, opaque vs handle wrapping | `@cImport`, `translate-c` |\n| `references\u002Fcpp-shim-patterns.md` | Bun's codegen pipeline, `[[ZIG_EXPORT]]` annotations, ExternTraits, Errorable(T), flat C API alternatives | `C++ shim`, `extern \"C\"` |\n| `references\u002Fexporting-zig-as-c.md` | libxev's fixed-size byte arrays, Ghostty's CAPI struct, @fieldParentPtr smuggling, module.modulemap | `export fn`, `callconv` |\n| `references\u002Fcross-language-abi.md` | Zig-ObjC (zig-objc), Zig-Swift (module.modulemap), Zig-Rust, Zig-Go (cgo\u002Fruntime.Pinner), Zig-Ruby (zig.rb\u002FRubyAllocator) | `ABI`, `Rust FFI`, `cgo`, `Ruby` |\n| `references\u002Fbuild-system-c-integration.md` | `addCSourceFiles`, `addTranslateC`, framework linking, allyourcodebase vendoring patterns, cross-compilation | `addCSourceFiles`, `linkSystemLibrary`, `addTranslateC` |\n| `references\u002Fcomptime-ffi-metaprogramming.md` | zig-objc @Type synthesis, ziglua field walking, TigerBeetle foreign code gen, zig-gobject GIR pipeline | `comptime`, `@typeInfo`, `@Type` |\n\n### Examples\n\nComplete, annotated code demonstrating each pattern:\n\n| Example | Description |\n|---------|-------------|\n| `examples\u002Fcimport_wrapping.zig` | @cImport, type aliases, sentinel pointer conversion |\n| `examples\u002Fcpp_shim_binding.zig` | Zig side of a C++ shim: extern decls, init\u002Fdeinit lifecycle |\n| `examples\u002Fexport_c_library.zig` | Exporting Zig functions with opaque handles and error codes |\n| `examples\u002Fcross_language_abi.zig` | extern struct layout, callbacks, context pointer passing |\n| `examples\u002Fbuild_c_sources.zig` | build.zig template for compiling C alongside Zig |\n| `examples\u002Fcomptime_ffi_wrapper.zig` | Comptime type reflection for type-safe C wrappers |\n| `examples\u002Fmemory_ownership_boundary.zig` | Ownership transfer patterns across FFI boundaries |\n| `examples\u002Fcross_language_consumers.zig` | Comptime binding generator emitting Go\u002FRust\u002FC types (TigerBeetle pattern) |\n\n## @cImport Direct Binding\n\nZig's `@cImport` translates C headers at compile time, giving direct access to C types and functions without writing bindings by hand. Production projects take different approaches depending on header complexity:\n\n- **Dedicated c.zig files** -- Ghostty isolates each C library's `@cImport` into a per-package `c.zig` file (e.g., `pkg\u002Ffreetype\u002Fc.zig`, `pkg\u002Ffontconfig\u002Fc.zig`). This prevents duplicate translation units and keeps import paths clean.\n- **Pre-translated bindings** -- Bun does NOT use `@cImport` for BoringSSL. Instead it ships a 19K-line pre-translated and manually enriched Zig file, giving tighter control over types and avoiding translate-c limitations.\n- **addTranslateC in build.zig** -- ziglua uses `addTranslateC` as a middle ground: build-time header translation without embedding `@cImport` in source.\n- **C ABI workaround files** -- When Zig's C ABI has platform-specific issues, Ghostty uses small ext.c files compiled alongside the Zig code as shims.\n\nSee `references\u002Fcimport-and-type-mapping.md` for the full type mapping table and `examples\u002Fcimport_wrapping.zig` for a worked example wrapping a C library.\n\n## C Shim Layer for C++\n\nC++ cannot be imported directly. Production projects use different strategies depending on the C++ codebase's size and complexity:\n\n- **Codegen pipeline** -- Bun wraps JavaScriptCore through a three-layer system: C++ `bindings.cpp` files annotated with `[[ZIG_EXPORT(tag)]]`, a TypeScript code generator (`cppbind.ts`) that parses annotations and emits Zig bindings, and Zig opaque types that consume the generated declarations. Exception handling uses three tags: `nothrow`, `zero_is_throw`, `check_slow`.\n- **Flat C API alternative** -- Lightpanda does NOT wrap V8 C++ directly. It uses zig-v8-fork, which provides a pre-existing flat C API. When a maintained C API exists for your C++ dependency, prefer it over writing custom shims.\n- **ABI-compatible types** -- Bun's JSValue is `enum(i64)`, directly matching JSC's NaN-boxed EncodedJSValue. Errorable(T) is an ABI-safe tagged union for error propagation across the boundary. ExternTraits\u003CT> in C++ define conversion rules (e.g., WTF::String uses `leakRef()` to transfer ownership).\n- **Opaque handle wrapping for STL types** -- zpp wraps `std::string` behind opaque `intptr_t` handles with three ownership modes (read-only, fixed write, growable write). C++ side uses `new`\u002F`delete` behind `extern \"C\"` functions; Zig caches data pointer and length to avoid FFI calls on reads. Build requires `-fno-exceptions -fno-rtti` on the C++ side.\n- **Separate build systems** -- Bun's C++ is NOT compiled by build.zig. It uses a separate Ninja\u002FTypeScript build system; Zig produces one .o file that links against the C++ artifacts.\n\nSee `references\u002Fcpp-shim-patterns.md` and `examples\u002Fcpp_shim_binding.zig`.\n\n## Exporting Zig as a C Library\n\nZig can produce shared or static libraries consumable by any C-compatible language. Production projects demonstrate two distinct approaches:\n\n- **Fixed-size byte array handles** -- libxev exposes opaque types as stack-allocatable C structs containing a fixed-size byte array (`uint8_t data[XEV_SIZEOF_LOOP - sizeof(XEV_ALIGN_T)]`). No heap allocation needed on the C side. Size validation tests prevent drift.\n- **CAPI struct pattern** -- Ghostty collects all `export fn` declarations into a single CAPI struct in `embedded.zig`. The C consumer receives one struct with all function pointers, rather than linking against individual symbols.\n- **Callback pointer smuggling** -- libxev extends its Completion struct with extra fields, then uses `@fieldParentPtr` to recover context inside callbacks -- avoiding a separate userdata pointer.\n- **Multi-language client pattern** -- TigerBeetle compiles one Zig core into platform-specific static libraries consumed by Go, Rust, Python, and other language clients through the C ABI. Comptime binding generators emit idiomatic types per target language. Gotcha: `u128` is passed as `[16]u8` because u128-by-value is broken across compilers.\n- **Swift consumption path** -- Ghostty exports through a hand-written `ghostty.h` header with a `module.modulemap`, allowing Swift to import the Zig library as `GhosttyKit`. XCFramework generation handles macOS\u002FiOS targets.\n\nSee `references\u002Fexporting-zig-as-c.md` and `examples\u002Fexport_c_library.zig`.\n\n## Cross-Language via C ABI\n\nThe C ABI is the lingua franca for cross-language calls. Production projects demonstrate several paths:\n\n- **Zig-ObjC via zig-objc** -- Ghostty uses mitchellh\u002Fzig-objc, NOT raw `objc_msgSend`. Pattern: `objc.getClass(\"NSFileManager\").?.msgSend(objc.Object, objc.sel(\"defaultManager\"), .{})`. Metal rendering is the heaviest ObjC consumer, with AutoreleasePool manually managed per frame.\n- **Zig-Swift via C API** -- Ghostty has no direct Zig-Swift bridge. Architecture: Zig export fn -> hand-written ghostty.h -> module.modulemap -> Swift imports as GhosttyKit. Swift passes userdata via `Unmanaged.passUnretained(self).toOpaque()`.\n- **Zig-Rust via extern \"C\"** -- Lightpanda bridges to html5ever: Rust exposes `extern \"C\"` functions, Zig declares matching extern prototypes. Callback-driven memory: Zig passes function pointers into Rust, Rust calls back for DOM mutations. No shared heap.\n- **Zig-Go via cgo** -- TigerBeetle's Go client links a pre-built Zig static library through cgo. Go objects accessed from Zig callback threads are pinned with `runtime.Pinner` for GC safety. Async bridge: Zig event loop fires a C completion callback that writes to a Go buffered channel. Achieves 94% of native Zig speed.\n- **Zig-Ruby via zig.rb** -- zig.rb implements `std.mem.Allocator` backed by Ruby's `xmalloc`\u002F`xrealloc`\u002F`xfree`, keeping Zig allocations visible to Ruby's GC. Comptime method binding validates signatures and generates per-arity C trampolines (0-15 args), avoiding varargs entirely. TypedDataClass wraps Zig structs as GC-tracked Ruby objects.\n- **Callback + userdata pattern** -- Ghostty's Options extern struct carries function pointers plus `?*anyopaque` userdata for each callback, letting the other language smuggle its own context through the C boundary.\n\nSee `references\u002Fcross-language-abi.md` and `examples\u002Fcross_language_abi.zig`.\n\n## Zig Build System C Compilation\n\n`zig build` can compile C and C++ sources alongside Zig, replacing Make\u002FCMake for many projects:\n\n- **Per-package build.zig** -- Ghostty isolates each C library in `pkg\u002F\u003Cname>\u002F` with its own `build.zig` and dedicated `c.zig` for `@cImport`. This keeps dependency boundaries clean and makes each library independently buildable.\n- **addTranslateC for headers** -- ziglua compiles upstream Lua C source via `addCSourceFiles` and uses `addTranslateC` for headers, supporting Lua 5.1-5.5, LuaJIT, and Luau from a single codebase via comptime version dispatch.\n- **Cross-compilation** -- Pass target triple; Zig's bundled libc headers handle sysroot concerns.\n- **Separate C++ build** -- Bun does NOT compile C++ through build.zig. When the C++ dependency has its own complex build system, link against pre-built artifacts rather than trying to replicate the build in Zig.\n\nSee `references\u002Fbuild-system-c-integration.md` and `examples\u002Fbuild_c_sources.zig` (a build.zig template).\n\n## Comptime Metaprogramming for FFI\n\nZig's comptime can generate type-safe wrappers from type information, eliminating boilerplate. But the approach depends on API surface size:\n\n- **Comptime function synthesis** -- zig-objc's core trick: `@Type(.{ .@\"fn\" = ... })` synthesizes `objc_msgSend` call signatures at comptime, selecting `_stret`\u002F`_fpret` variants based on `builtin.target.cpu.arch` and return type. The MsgSend(T) mixin gives both Object and Class the same dispatch interface.\n- **Build-time code generation** -- vulkan-zig does NOT use comptime for the Vulkan API (too large). A generator executable runs during `zig build`, producing `vk.zig` with dispatch tables. Consumers use `inline for (std.meta.fields(Dispatch))` to load nullable function pointers from an opaque loader.\n- **Comptime version dispatch** -- ziglua's define.zig walks `@typeInfo(T).@\"struct\".fields` at comptime to generate Lua type definitions. A single codebase supports multiple Lua versions via `switch (lang)`.\n- **Comptime-generates-foreign-code** -- TigerBeetle's `rust_bindings.zig` and `go_bindings.zig` use Zig comptime to emit source code in other languages -- `#[repr(C)]` Rust structs and layout-compatible Go structs. The Zig build system runs the generator, and each language client consumes the output as checked-in generated code.\n- **Build-time XML-to-Zig pipeline** -- zig-gobject translates GIR XML into a complete Zig package with `build.zig`. Generated `extern fn` declarations are aliased to `pub const` (zero-cost). Comptime type hierarchy enables `isAssignableFrom()` that walks parent chains and interfaces at compile time, with `as()` for safe upcast and `cast()` returning `?*T` for downcast.\n- **Comptime bridge mapping** -- Lightpanda's bridge.zig uses `Builder(comptime T: type)` to map Zig types to JavaScript concepts at compile time.\n\nSee `references\u002Fcomptime-ffi-metaprogramming.md` and `examples\u002Fcomptime_ffi_wrapper.zig`.\n\n## Memory Ownership Across Boundaries\n\nMemory ownership is the hardest part of FFI. Production projects use these strategies:\n\n- **Tagged pointer encoding** -- Bun's ZigString is an extern struct with UTF-16\u002FLatin1 encoding packed into the high bits of the pointer, avoiding a separate encoding field.\n- **Callback-driven allocation** -- Lightpanda's Rust bridge passes function pointers into Rust; Rust calls back into Zig for DOM mutations. No shared heap means no cross-language allocator coordination.\n- **Custom allocator routing** -- Bun routes BoringSSL memory through mimalloc by exporting `OPENSSL_memory_alloc`\u002F`OPENSSL_memory_free` hooks. The C library calls these instead of system malloc.\n- **Sentinel tracking** -- Ghostty's `ghostty_string_s` tracks a sentinel flag so the receiving side knows whether to scan for a null terminator or use a length field for deallocation.\n- **Ownership transfer via leakRef** -- Bun's ExternTraits\u003CWTF::String> uses `leakRef()` to hand a reference-counted string across the boundary without the C++ side releasing it.\n\nSee `examples\u002Fmemory_ownership_boundary.zig` for a comprehensive example combining these patterns.\n\n## Sources\n\n### Tier 1 -- Production codebases with extensive FFI\n\n- **Bun** -- JavaScript runtime; C++ interop with JavaScriptCore via codegen pipeline, BoringSSL via pre-translated bindings, custom allocator routing through mimalloc\n- **Ghostty** -- Terminal emulator; Zig-ObjC via zig-objc, Zig-Swift via C API + module.modulemap, per-package C library isolation, CAPI struct pattern\n- **libxev** -- Cross-platform event loop; fixed-size byte array opaque handles, @fieldParentPtr callback smuggling, hand-written C header + pkg-config\n- **Lightpanda** -- Headless browser; flat C API via zig-v8-fork, Rust-Zig via callback-driven extern \"C\", comptime bridge mapping\n- **TigerBeetle** -- Financial transactions database; one Zig core with Go\u002FRust\u002FPython\u002Fetc. clients via C ABI, comptime binding generators emit foreign-language source, u128-as-[16]u8 ABI workaround, runtime.Pinner for Go GC safety\n\n### Tier 2 -- Libraries and binding generators\n\n- **vulkan-zig** -- Build-time generated Vulkan bindings from XML spec, dispatch table pattern\n- **ziglua** -- Lua binding using addTranslateC + comptime version dispatch across Lua 5.1-5.5\u002FLuaJIT\u002FLuau\n- **zig-objc** -- Objective-C runtime bindings via comptime @Type function synthesis, architecture-aware dispatch\n- **zig-gobject** -- GIR XML-to-Zig pipeline with comptime-safe type hierarchy, zero-cost extern fn aliasing, typed signal connection\n- **zpp** -- C++ STL bridging via opaque handles; wraps std::string with three ownership modes, bidirectional data flow via function pointers\n- **zig.rb** -- Ruby extension framework; RubyAllocator (std.mem.Allocator backed by xmalloc), comptime per-arity trampoline generation, TypedDataClass for GC-tracked Zig structs\n- **allyourcodebase** -- Community collection of 115+ C library build.zig packages; vendoring patterns, config headers, platform dispatch without pkg-config\n",{"name":5,"description":7},"main","e63965e4644984470d4cc8b3014a8b001f0c2666",".agents\u002Fskills\u002Fzig-interop","https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles","https:\u002F\u002Fgithub.com\u002Fbnferguson","2026-11-11 03:04:59",{"source":9,"skillName":5,"commands":57,"prompt":67,"zipAvailable":68},[58,61,64],{"tool":59,"command":60},"npx","npx skills add bnferguson\u002Fdotfiles --skill zig-interop",{"tool":62,"command":63},"bunx","bunx skills add bnferguson\u002Fdotfiles --skill zig-interop",{"tool":65,"command":66},"pnpm","pnpm dlx skills add bnferguson\u002Fdotfiles --skill zig-interop","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzig-interop\u002FSKILL.md",true,[70,76,80,84,88,92,96,100,104,110,114,118,122,126],{"path":71,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":74,"sourceHtmlUrl":75},"examples\u002Fbuild_c_sources.zig","OTHER","其他",4378,"https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzig-interop\u002Fexamples\u002Fbuild_c_sources.zig",{"path":77,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":78,"sourceHtmlUrl":79},"examples\u002Fcimport_wrapping.zig",2930,"https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzig-interop\u002Fexamples\u002Fcimport_wrapping.zig",{"path":81,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":82,"sourceHtmlUrl":83},"examples\u002Fcomptime_ffi_wrapper.zig",5268,"https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzig-interop\u002Fexamples\u002Fcomptime_ffi_wrapper.zig",{"path":85,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":86,"sourceHtmlUrl":87},"examples\u002Fcpp_shim_binding.zig",4074,"https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzig-interop\u002Fexamples\u002Fcpp_shim_binding.zig",{"path":89,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":90,"sourceHtmlUrl":91},"examples\u002Fcross_language_abi.zig",3907,"https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzig-interop\u002Fexamples\u002Fcross_language_abi.zig",{"path":93,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":94,"sourceHtmlUrl":95},"examples\u002Fcross_language_consumers.zig",8625,"https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzig-interop\u002Fexamples\u002Fcross_language_consumers.zig",{"path":97,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":98,"sourceHtmlUrl":99},"examples\u002Fexport_c_library.zig",4581,"https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzig-interop\u002Fexamples\u002Fexport_c_library.zig",{"path":101,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":102,"sourceHtmlUrl":103},"examples\u002Fmemory_ownership_boundary.zig",4870,"https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzig-interop\u002Fexamples\u002Fmemory_ownership_boundary.zig",{"path":105,"resourceType":106,"resourceTypeDesc":107,"sizeBytes":108,"sourceHtmlUrl":109},"references\u002Fbuild-system-c-integration.md","REFERENCE","参考文档",11870,"https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzig-interop\u002Freferences\u002Fbuild-system-c-integration.md",{"path":111,"resourceType":106,"resourceTypeDesc":107,"sizeBytes":112,"sourceHtmlUrl":113},"references\u002Fcimport-and-type-mapping.md",8256,"https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzig-interop\u002Freferences\u002Fcimport-and-type-mapping.md",{"path":115,"resourceType":106,"resourceTypeDesc":107,"sizeBytes":116,"sourceHtmlUrl":117},"references\u002Fcomptime-ffi-metaprogramming.md",14374,"https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzig-interop\u002Freferences\u002Fcomptime-ffi-metaprogramming.md",{"path":119,"resourceType":106,"resourceTypeDesc":107,"sizeBytes":120,"sourceHtmlUrl":121},"references\u002Fcpp-shim-patterns.md",10367,"https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzig-interop\u002Freferences\u002Fcpp-shim-patterns.md",{"path":123,"resourceType":106,"resourceTypeDesc":107,"sizeBytes":124,"sourceHtmlUrl":125},"references\u002Fcross-language-abi.md",11545,"https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzig-interop\u002Freferences\u002Fcross-language-abi.md",{"path":127,"resourceType":106,"resourceTypeDesc":107,"sizeBytes":128,"sourceHtmlUrl":129},"references\u002Fexporting-zig-as-c.md",10839,"https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzig-interop\u002Freferences\u002Fexporting-zig-as-c.md",[131,165,182,214,231,247],{"skillNo":132,"name":133,"nameZh":134,"description":135,"descriptionZh":136,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":137,"licenseFileUrl":138,"sourceHtmlUrl":139,"categories":140,"keywords":147,"publishedAt":45},"01M6BVA3RS3M016FANZ6792F9H","skill-creator","Claude 技能创建指南","Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.","创建有效技能的指南。当用户想要创建新技能（或更新现有技能），以通过专业知识、工作流或工具集成来扩展 Claude 的能力时，应使用此技能。","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002Fclaude\u002Fconfig\u002Fskills\u002Fskill-creator\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002Fclaude\u002Fconfig\u002Fskills\u002Fskill-creator\u002FSKILL.md",[141,144],{"categoryNo":142,"categoryName":143,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BRN0CV1NMDZ5TEJX1GVM29","插件与技能管理",{"categoryNo":145,"categoryName":146,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BRZZF9D7PVFN5MXSPWWD61","AI 工程师",[148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,43,163,44,164],"creator","skill creator","specialized","workflows","create","update","capabilities","knowledge","tool","integrations","guide","new skill","existing skill","users","with","Existing","new",{"skillNo":166,"name":167,"nameZh":168,"description":169,"descriptionZh":170,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":171,"categories":172,"keywords":179,"publishedAt":45},"01M6BV94WN2RPYM8N6PN8TBNT8","writing-shape","素材成文逐段撰写","Writing, exploit: shape raw material into an article, paragraph by paragraph.","写作，利用（exploit）：将原始素材逐段塑造成一篇文章。","https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwriting-shape\u002FSKILL.md",[173,176],{"categoryNo":174,"categoryName":175,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8C55A3R2M9C8CAKG3W16HTA","内容创作者",{"categoryNo":177,"categoryName":178,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8CA3WT74BY17JY9YCJY42FJ","创意写作与内容编排",[180,181],"writing shape","writing",{"skillNo":183,"name":184,"nameZh":185,"description":186,"descriptionZh":187,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":137,"licenseFileUrl":188,"sourceHtmlUrl":189,"categories":190,"keywords":197,"publishedAt":45},"01M6BV8QDFJ6PXBVK5NFBZT5M7","webapp-testing","Playwright 网页应用测试","Test local web applications using Playwright. Use when verifying frontend functionality, debugging UI behavior, capturing browser screenshots, or viewing browser logs.","使用 Playwright 测试本地 Web 应用。适用于验证前端功能、调试 UI 行为、截取浏览器截图或查看浏览器日志。","https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwebapp-testing\u002FSKILL.md",[191,194],{"categoryNo":192,"categoryName":193,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQGD5WG86P4AQ5GPSSKBFR","测试工程师",{"categoryNo":195,"categoryName":196,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQJH394GT47X57A9Q8G7HX","测试与质量保障",[198,199,200,201,202,203,204,205,206,207,208,209,210,211,36,212,213,44],"webapp","webapp testing","testing","browser","frontend","screenshots","playwright","test","web","debugging","ui","logs","applications","behavior","local","test local",{"skillNo":215,"name":216,"nameZh":217,"description":218,"descriptionZh":219,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":220,"categories":221,"keywords":228,"publishedAt":45},"01M6BV8MDXKXNVHKS3QF3YDFTF","wait-what","消息重述","Stop. That last message did not land: re-pitch it.","停。上一条消息没有被理解（没说清楚）：换一种方式重新表述。","https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwait-what\u002FSKILL.md",[222,225],{"categoryNo":223,"categoryName":224,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BS5011KJDVSRXG1DC4P666","普通用户",{"categoryNo":226,"categoryName":227,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C1YEW2680C003GGBD6QCKB","回复风格与输出控制",[229,230],"wait what","land",{"skillNo":232,"name":233,"nameZh":234,"description":235,"descriptionZh":236,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":237,"categories":238,"keywords":243,"publishedAt":45},"01M6BV756DJHT5BDA1HVRVHJJ7","prototype","快速原型构建","Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.","构建一个一次性原型来回答设计问题。当用户想要验证某个状态模型或逻辑是否合理，或探索 UI 应该是什么样子时使用。","https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fprototype\u002FSKILL.md",[239,240],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":241,"categoryName":242,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BT7QTSZKB08EAW9P9ZCDNQ","设计评审与架构优化",[233,244,245,208,246],"design","explore","state",{"skillNo":248,"name":249,"nameZh":250,"description":251,"descriptionZh":252,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":253,"categories":254,"keywords":259,"publishedAt":45},"01M6BV6SBW166685KVBPWM2K4N","improve-codebase-architecture","代码库架构优化分析","Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.","扫描代码库以发现可深化改进的机会，将其以可视化 HTML 报告的形式呈现，然后对你选中的某一项进行深入质询。","https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fimprove-codebase-architecture\u002FSKILL.md",[255,256],{"categoryNo":241,"categoryName":242,"taxonomyType":28,"taxonomyTypeDesc":29},{"categoryNo":257,"categoryName":258,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8C4ZVS0ZJKF2T2G58PW5VR2","系统架构师",[260,261,262,263],"architecture","improve","improve codebase architecture","report"]