Skillquality 0.46
bun
Use when using bun.lockb, bunfig.toml, bun install, Bun workspaces, Bun test, Bun runtime APIs, JS or TS scripts run with Bun, bundling, or Node compatibility checks for Bun.
What it does
Bun Skill
<workflow>Core Capabilities
1. Runtime
Bun is a drop-in replacement for Node.js, focused on speed.
- HTTP Server:
Bun.serve()is faster than Node'shttpmodule. - File I/O:
Bun.file()andBun.write()are optimized. - TypeScript: Native support (no transpilation step needed for dev).
2. Task & Test Runner
- Run Scripts:
bun run script.tsreplacests-node. - Test:
bun testis a Jest-compatible, ultra-fast test runner.
```bash
bun test --watch
```
</example>
- Package Manager:
bun installis significantly faster than npm/yarn.
High Performance & Integration Patterns (Vertebra)
This section details how to integrate Bun into high-performance, polyglot systems.
1. Inter-Process Communication (IPC)
When integrating with Rust/Python backends:
- Shared Memory (ShmRing): For latency < 10us, avoid piping JSON over stdout/stdin. Use shared memory ring buffers.
- Pattern: Pointers/offsets only passed over socket; data stays in shared memory.
- Unix Domain Sockets (UDS): Use
Bun.connect()andBun.listen()with abstract namespaces (Linux) or file paths (macOS) if Shm not available. - Serialization:
- Avoid
JSON.stringifyon hot paths. - Use Msgspec (via bindings) or Apache Arrow (via
apache-arrowjs package) for zero-copy structure sharing.
- Avoid
2. Native Bindings (FFI vs N-API)
- N-API (
napi-rs): Preferred for stability and complex logic. It maps Rust Structs to JS Classes easily. - Bun FFI (
bun:ffi): faster for simple C function calls but harder to maintain for complex objects.- Recommendation: Use
napi-rsfor business logic,bun:ffionly for ultra-thin C wrappers.
- Recommendation: Use
3. Performance Gotchas
- Buffer Copying: Be careful with
BuffervsUint8Array. Node compatibility layers might copy. UseUint8Arraynatively where possible. - Streams:
Bun.serve()relies onReadableStream. Buffering the entire request body (await req.text()) defeats the purpose of streaming; process chunks if possible. - Garbage Collection: In tight loops, avoid allocating objects. Re-use objects or use typed arrays to keep pressure off the GC.
Best Practices
- Linting: Use Biome (
bunx @biomejs/biome) for instant linting/formatting. - Globals: Use
Bun.env,Bun.sleep, but generally avoid Node.js globals unless necessary for library compatibility. - Lockfile: Commit
bun.lockbfor deterministic builds.
Official References
- https://bun.sh/docs
- https://bun.sh/docs/test
- https://bun.sh/docs/install/lockfile
- https://bun.sh/docs/runtime/ffi
- https://bun.sh/docs/runtime/node-api
- https://github.com/oven-sh/bun/releases
Shared Styleguide Baseline
- Use shared styleguides for generic language/framework rules to reduce duplication in this skill.
- General Principles
- TypeScript
- Keep this skill focused on tool-specific workflows, edge cases, and integration details.
Add guardrails instructions here. </guardrails>
<validation> ## ValidationAdd validation instructions here. </validation>
Capabilities
skillsource-cofinskill-buntopic-agent-skillstopic-ai-agentstopic-beadstopic-claude-codetopic-codextopic-cursortopic-developer-toolstopic-gemini-clitopic-opencodetopic-plugintopic-slash-commandstopic-spec-driven-development
Install
Installnpx skills add cofin/flow
skills.shhttps://skills.sh/cofin/flow/bun
Transportskills-sh
Protocolskill
Quality
0.46/ 1.00
deterministic score 0.46 from registry signals: · indexed on github topic:agent-skills · 11 github stars · SKILL.md body (3,341 chars)
Provenance
Indexed fromgithub
Enriched2026-05-18 19:07:35Z · deterministic:skill-github:v1 · v1
First seen2026-04-23
Last seen2026-05-18