{"id":"aaac286a-da44-426b-8450-b984d83cd34f","shortId":"XhcrKD","kind":"skill","title":"bun","tagline":"Auto-activate for bun.lockb, bunfig.toml. Usage of Bun as a high-performance JavaScript runtime, bundler, and test runner. Use when: running JS/TS code with Bun, using bun install, configuring Bun workspaces, or fixing low-latency node runtimes. Not for Node.js-specific APIs that","description":"# Bun Skill\n\n<workflow>\n\n## Core Capabilities\n\n### 1. Runtime\n\nBun is a drop-in replacement for Node.js, focused on speed.\n\n- **HTTP Server**: `Bun.serve()` is faster than Node's `http` module.\n- **File I/O**: `Bun.file()` and `Bun.write()` are optimized.\n- **TypeScript**: Native support (no transpilation step needed for dev).\n\n### 2. Task & Test Runner\n\n- **Run Scripts**: `bun run script.ts` replaces `ts-node`.\n- **Test**: `bun test` is a Jest-compatible, ultra-fast test runner.\n\n<example>\n\n    ```bash\n    bun test --watch\n    ```\n\n</example>\n\n- **Package Manager**: `bun install` is significantly faster than npm/yarn.\n\n## High Performance & Integration Patterns (Vertebra)\n\nThis section details how to integrate Bun into high-performance, polyglot systems.\n\n### 1. Inter-Process Communication (IPC)\n\nWhen integrating with Rust/Python backends:\n\n- **Shared Memory (ShmRing)**: For latency < 10us, avoid piping JSON over stdout/stdin. Use shared memory ring buffers.\n  - *Pattern*: Pointers/offsets only passed over socket; data stays in shared memory.\n- **Unix Domain Sockets (UDS)**: Use `Bun.connect()` and `Bun.listen()` with abstract namespaces (Linux) or file paths (macOS) if Shm not available.\n- **Serialization**:\n  - Avoid `JSON.stringify` on hot paths.\n  - Use **Msgspec** (via bindings) or **Apache Arrow** (via `apache-arrow` js package) for zero-copy structure sharing.\n\n### 2. Native Bindings (FFI vs N-API)\n\n- **N-API (`napi-rs`)**: Preferred for stability and complex logic. It maps Rust Structs to JS Classes easily.\n- **Bun FFI (`bun:ffi`)**: faster for simple C function calls but harder to maintain for complex objects.\n  - *Recommendation*: Use `napi-rs` for business logic, `bun:ffi` only for ultra-thin C wrappers.\n\n### 3. Performance Gotchas\n\n- **Buffer Copying**: Be careful with `Buffer` vs `Uint8Array`. Node compatibility layers might copy. Use `Uint8Array` natively where possible.\n- **Streams**: `Bun.serve()` relies on `ReadableStream`. Buffering the entire request body (`await req.text()`) defeats the purpose of streaming; process chunks if possible.\n- **Garbage Collection**: In tight loops, avoid allocating objects. Re-use objects or use typed arrays to keep pressure off the GC.\n\n## Best Practices\n\n- **Linting**: Use **Biome** (`bunx @biomejs/biome`) for instant linting/formatting.\n- **Globals**: Use `Bun.env`, `Bun.sleep`, but generally avoid Node.js globals unless necessary for library compatibility.\n- **Lockfile**: Commit `bun.lockb` for deterministic builds.\n\n</workflow>\n\n## Official References\n\n- <https://bun.sh/docs>\n- <https://bun.sh/docs/test>\n- <https://bun.sh/docs/install/lockfile>\n- <https://bun.sh/docs/runtime/ffi>\n- <https://bun.sh/docs/runtime/node-api>\n- <https://github.com/oven-sh/bun/releases>\n\n## Shared Styleguide Baseline\n\n- Use shared styleguides for generic language/framework rules to reduce duplication in this skill.\n- [General Principles](https://github.com/cofin/flow/blob/main/templates/styleguides/general.md)\n- [TypeScript](https://github.com/cofin/flow/blob/main/templates/styleguides/languages/typescript.md)\n- Keep this skill focused on tool-specific workflows, edge cases, and integration details.\n\n<guardrails>\n## Guardrails\n\nAdd guardrails instructions here.\n</guardrails>\n\n<validation>\n## Validation\n\nAdd validation instructions here.\n</validation>","tags":["bun","flow","cofin","agent-skills","ai-agents","beads","claude-code","codex","cursor","developer-tools","gemini-cli","opencode"],"capabilities":["skill","source-cofin","skill-bun","topic-agent-skills","topic-ai-agents","topic-beads","topic-claude-code","topic-codex","topic-cursor","topic-developer-tools","topic-gemini-cli","topic-opencode","topic-plugin","topic-slash-commands","topic-spec-driven-development"],"categories":["flow"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/cofin/flow/bun","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add cofin/flow","source_repo":"https://github.com/cofin/flow","install_from":"skills.sh"}},"qualityScore":"0.455","qualityRationale":"deterministic score 0.46 from registry signals: · indexed on github topic:agent-skills · 11 github stars · SKILL.md body (3,341 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-24T01:03:25.334Z","embedding":null,"createdAt":"2026-04-23T13:03:57.979Z","updatedAt":"2026-04-24T01:03:25.334Z","lastSeenAt":"2026-04-24T01:03:25.334Z","tsv":"'/cofin/flow/blob/main/templates/styleguides/general.md)':428 '/cofin/flow/blob/main/templates/styleguides/languages/typescript.md)':432 '/docs':392 '/docs/install/lockfile':398 '/docs/runtime/ffi':401 '/docs/runtime/node-api':404 '/docs/test':395 '/oven-sh/bun/releases':407 '1':52,149 '10us':165 '2':92,232 '3':294 'abstract':196 'activ':4 'add':448,453 'alloc':342 'apach':218,222 'apache-arrow':221 'api':46,239,242 'array':351 'arrow':219,223 'auto':3 'auto-activ':2 'avail':206 'avoid':166,208,341,374 'await':325 'backend':159 'baselin':410 'bash':118 'best':358 'bind':216,234 'biom':362 'biomejs/biome':364 'bodi':324 'buffer':175,297,302,320 'build':387 'bun':1,10,28,30,33,48,54,98,106,119,124,142,260,262,285 'bun.connect':192 'bun.env':370 'bun.file':78 'bun.listen':194 'bun.lockb':6,384 'bun.serve':68,316 'bun.sh':391,394,397,400,403 'bun.sh/docs':390 'bun.sh/docs/install/lockfile':396 'bun.sh/docs/runtime/ffi':399 'bun.sh/docs/runtime/node-api':402 'bun.sh/docs/test':393 'bun.sleep':371 'bun.write':80 'bundler':18 'bunfig.toml':7 'bunx':363 'busi':283 'c':267,292 'call':269 'capabl':51 'care':300 'case':443 'chunk':333 'class':258 'code':26 'collect':337 'commit':383 'communic':153 'compat':112,306,381 'complex':250,275 'configur':32 'copi':229,298,309 'core':50 'data':182 'defeat':327 'detail':138,446 'determinist':386 'dev':91 'domain':188 'drop':58 'drop-in':57 'duplic':420 'easili':259 'edg':442 'entir':322 'fast':115 'faster':70,128,264 'ffi':235,261,263,286 'file':76,200 'fix':36 'focus':63,436 'function':268 'garbag':336 'gc':357 'general':373,424 'generic':415 'github.com':406,427,431 'github.com/cofin/flow/blob/main/templates/styleguides/general.md)':426 'github.com/cofin/flow/blob/main/templates/styleguides/languages/typescript.md)':430 'github.com/oven-sh/bun/releases':405 'global':368,376 'gotcha':296 'guardrail':447,449 'harder':271 'high':14,131,145 'high-perform':13,144 'hot':211 'http':66,74 'i/o':77 'instal':31,125 'instant':366 'instruct':450,455 'integr':133,141,156,445 'inter':151 'inter-process':150 'ipc':154 'javascript':16 'jest':111 'jest-compat':110 'js':224,257 'js/ts':25 'json':168 'json.stringify':209 'keep':353,433 'language/framework':416 'latenc':39,164 'layer':307 'librari':380 'lint':360 'linting/formatting':367 'linux':198 'lockfil':382 'logic':251,284 'loop':340 'low':38 'low-lat':37 'maco':202 'maintain':273 'manag':123 'map':253 'memori':161,173,186 'might':308 'modul':75 'msgspec':214 'n':238,241 'n-api':237,240 'namespac':197 'napi':244,280 'napi-r':243,279 'nativ':84,233,312 'necessari':378 'need':89 'node':40,72,104,305 'node.js':44,62,375 'npm/yarn':130 'object':276,343,347 'offici':388 'optim':82 'packag':122,225 'pass':179 'path':201,212 'pattern':134,176 'perform':15,132,146,295 'pipe':167 'pointers/offsets':177 'polyglot':147 'possibl':314,335 'practic':359 'prefer':246 'pressur':354 'principl':425 'process':152,332 'purpos':329 're':345 're-us':344 'readablestream':319 'recommend':277 'reduc':419 'refer':389 'reli':317 'replac':60,101 'req.text':326 'request':323 'ring':174 'rs':245,281 'rule':417 'run':24,96,99 'runner':21,95,117 'runtim':17,41,53 'rust':254 'rust/python':158 'script':97 'script.ts':100 'section':137 'serial':207 'server':67 'share':160,172,185,231,408,412 'shm':204 'shmring':162 'signific':127 'simpl':266 'skill':49,423,435 'skill-bun' 'socket':181,189 'source-cofin' 'specif':45,440 'speed':65 'stabil':248 'stay':183 'stdout/stdin':170 'step':88 'stream':315,331 'struct':255 'structur':230 'styleguid':409,413 'support':85 'system':148 'task':93 'test':20,94,105,107,116,120 'thin':291 'tight':339 'tool':439 'tool-specif':438 'topic-agent-skills' 'topic-ai-agents' 'topic-beads' 'topic-claude-code' 'topic-codex' 'topic-cursor' 'topic-developer-tools' 'topic-gemini-cli' 'topic-opencode' 'topic-plugin' 'topic-slash-commands' 'topic-spec-driven-development' 'transpil':87 'ts':103 'ts-node':102 'type':350 'typescript':83,429 'ud':190 'uint8array':304,311 'ultra':114,290 'ultra-fast':113 'ultra-thin':289 'unix':187 'unless':377 'usag':8 'use':22,29,171,191,213,278,310,346,349,361,369,411 'valid':452,454 'vertebra':135 'via':215,220 'vs':236,303 'watch':121 'workflow':441 'workspac':34 'wrapper':293 'zero':228 'zero-copi':227","prices":[{"id":"0efead61-b671-4c83-9fab-360915c6f351","listingId":"aaac286a-da44-426b-8450-b984d83cd34f","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"cofin","category":"flow","install_from":"skills.sh"},"createdAt":"2026-04-23T13:03:57.979Z"}],"sources":[{"listingId":"aaac286a-da44-426b-8450-b984d83cd34f","source":"github","sourceId":"cofin/flow/bun","sourceUrl":"https://github.com/cofin/flow/tree/main/skills/bun","isPrimary":false,"firstSeenAt":"2026-04-23T13:03:57.979Z","lastSeenAt":"2026-04-24T01:03:25.334Z"}],"details":{"listingId":"aaac286a-da44-426b-8450-b984d83cd34f","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"cofin","slug":"bun","github":{"repo":"cofin/flow","stars":11,"topics":["agent-skills","ai-agents","beads","claude-code","codex","context-driven-development","cursor","developer-tools","gemini-cli","opencode","plugin","slash-commands","spec-driven-development","subagents","tdd","workflow"],"license":"apache-2.0","html_url":"https://github.com/cofin/flow","pushed_at":"2026-04-19T23:22:27Z","description":"Context-Driven Development toolkit for AI agents — spec-first planning, TDD workflow, and Beads integration.","skill_md_sha":"fcde3d340854b71898208478a71dcc30c52b3213","skill_md_path":"skills/bun/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/cofin/flow/tree/main/skills/bun"},"layout":"multi","source":"github","category":"flow","frontmatter":{"name":"bun","description":"Auto-activate for bun.lockb, bunfig.toml. Usage of Bun as a high-performance JavaScript runtime, bundler, and test runner. Use when: running JS/TS code with Bun, using bun install, configuring Bun workspaces, or fixing low-latency node runtimes. Not for Node.js-specific APIs that Bun doesn't support, or Deno."},"skills_sh_url":"https://skills.sh/cofin/flow/bun"},"updatedAt":"2026-04-24T01:03:25.334Z"}}