Bun Ffi
Reference guide for calling C/C++ native libraries from Bun through the bun:ffi module.
- CCM score
- 52 of 100
- skills.sh installs
- 409
- GitHub stars
- 257
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers dlopen library loading, FFI type mappings, function signatures, and string, pointer, struct, and callback handling
- Includes platform-specific library suffixes, cross-platform path selection, and a worked SQLite example
- Explains memory management, synchronous blocking behavior, and offloading long calls to Web Workers
- Designed for developers integrating existing C or C++ libraries into Bun applications
Install
$ npx -y skills add secondsky/claude-skills --skill bun-ffi -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Bun FFI
Bun's FFI allows calling native C/C++ libraries from JavaScript.
Quick Start
import { dlopen, suffix, FFIType } from "bun:ffi";
// Load library
const lib = dlopen(`libc.${suffix}`, {
printf: {
args: [FFIType.cstring],
returns: FFIType.int,
},
});
// Call function
lib.symbols.printf("Hello from C!\n");
Loading Libraries
Platform-Specific Paths
import { dlopen, suffix } from "bun:ffi";
// suffix is: "dylib" (macOS), "so" (Linux), "dll" (Windows)
// System library
const libc = dlopen(`libc.${suffix}`, { ... });
// Custom library
const myLib = dlopen(`./libmylib.${suffix}`, { ... });
// Absolute path
const sqlite = dlopen("/usr/lib/libsqlite3.so", { ... });
Cross-Platform Loading
function getLibPath(name: string): string {
const platform = process.platform;
const paths = {
darwin: `/usr/local/lib/lib${name}.dylib`,
linux: `/usr/lib/lib${name}.so`,
win32: `C:\\Windows\\System32\\${name}.dll`,
};
return paths[platform] || paths.linux;
}
const lib = dlopen(getLibPath("mylib"), { ... });
FFI Types
import { FFIType } from "bun:ffi";
Details
- Repository
- github.com/secondsky/claude-skills
- Category
- Backend & APIs
- First seen
- Jun 3, 2026
Questions
What does the bun-ffi skill do?
The bun-ffi skill teaches an agent how to call native C and C++ libraries from JavaScript in Bun using bun:ffi. It covers loading libraries with dlopen, mapping FFI types, defining function signatures, passing strings and pointers, structs, callbacks and memory handling.
How do I install the bun-ffi skill?
Run npx -y skills add secondsky/claude-skills --skill bun-ffi -y in your project to install it. After that, bun-ffi lets the agent answer questions about calling native libraries from Bun.
When should I use the bun-ffi skill?
Use bun-ffi when you need to call C or C++ shared libraries from a Bun project, for example through dlopen, a native SQLite library or a custom .so, .dylib or .dll file. The skill is written for prompts about bun:ffi, foreign function interface and native code integration.
Where does bun-ffi stand in the Backend & APIs category?
bun-ffi is listed under Backend & APIs on Claude Marketplaces, next to entra-app-registration, neon, firebase-basics, firebase-auth-basics and workers-best-practices. Its focus is narrower than those skills: it covers only Bun's native library interface rather than hosted backend services.
More from secondsky/claude-skills
All 116- Bun Nuxt409
- Bun Jest Migration408
- Bun Macros407
- Multi Ai Consultant407
- Model Deployment405
- Graphql Implementation403
- Jest Generator402
- Thesys Generative Ui393
- Nuxt Studio391
- Maz Ui390
- Woocommerce Code Review389
- Woocommerce Backend Dev388
- Woocommerce Copy Guidelines384
- Woocommerce Dev Cycle384
- Nuxt Seo345
- Tailwind V4 Shadcn8.4K
- Aceternity Ui1.7K
- Vitest Testing1.3K
- Motion1.2K
- Playwright1.1K
- Api Testing929
- Responsive Web Design731
- Zod677
- Nano Banana Prompts655
Similar to Bun Ffi
More Backend & APIsrust-ffiSkillmohitmishra786/low-level-dev-skills713 installsRust FFI guide covering calling C with bindgen, exporting Rust with cbindgen, and safe wrappers.
bun-sqliteSkillsecondsky/claude-skills543 installsEmbedded SQLite driver guide covering queries, prepared statements, transactions, and error handling for Bun.
dotnet-pinvokeSkilldotnet/skills5.2K installsSource-generated and runtime P/Invoke declarations for calling C and C++ libraries from .NET, with safe marshalling patterns.
bunPluginsecondsky/claude-skills254 starsComprehensive Bun runtime toolkit covering runtime, package manager, bundler, testing, HTTP servers, WebSockets, databases, framework integrations (Hono, Next.j
Unreal Engine API DocumentationMCP servercodeturion101 starsReference for accurate UE5 C++ API signatures, include paths, class references, and deprecation checks for AI agents.
bun-developmentSkillsickn33/agentic-awesome-skills2.9K installsFast JavaScript and TypeScript development guidance for the Bun runtime, including Node.js migration and Bun's built-in tooling.