terminalskills/skills/bun
- community
Checking that the SKILL.md file is still in the repository.
Assists with using Bun as an all-in-one JavaScript/TypeScript runtime, package manager, bundler, and test runner. Use when building HTTP servers, managing packages, running tests, or migrating from Node.js. Trigger words: bun, bun serve, bun install, bun test, bun build, javascript runtime, bun runtime.
Install
npx vskill@latest install terminalskills/skills/bunSKILL.md
Bun
Overview
Bun is a single binary that is a JavaScript/TypeScript runtime, a package manager, a bundler and a Jest-compatible test runner. It runs .ts and .tsx files directly, reads .env files, and ships built-ins such as Bun.serve(), bun:sqlite and Bun.password. It targets Node.js compatibility, so most npm packages work, but not every Node API behaves identically. Checked against Bun 1.4.4.
Instructions
Install and start a project
Bun also publishes an install script at https://bun.com/install; if you use it, download it, read it, then run it, rather than piping it into a shell. A package manager is simpler. On Windows use scoop install bun or npm install -g bun.
Packages
Bun does not run postinstall and similar lifecycle scripts of dependencies, except for a built-in allow list of popular packages. If a package needs one (native builds), list it in "trustedDependencies" in package.json and reinstall. To hold back brand-new releases, set install.minimumReleaseAge (seconds) in bunfig.toml. A project still on the old binary bun.lockb migrates with bun install --save-text-lockfile --frozen-lockfile --lockfile-only, then delete bun.lockb.
HTTP server
Bun.serve() takes a routes map with :param segments and per-method handlers; fetch handles everything else.
WebSockets: call server.upgrade(req) inside fetch and add a websocket: { message(ws, msg) { ws.send(...) } } handler to the same Bun.serve() options. Bun.password.verify(password, hash) checks a hash.
Tests
bun test finds *.test.ts files and supports describe, it, expect, snapshots and --coverage.
Bundle and compile
CLI equivalent: bun build ./src/index.tsx --outdir dist --minify. bun build ./server.ts --compile --outfile dist/api produces a single self-contained executable.
Files and environment
Bun.file("data.json").json() reads and await Bun.write("out.txt", text) writes. new Bun.Glob("src/**/*.ts").scan(".") lists files. .env, .env.local and .env.<NODE_ENV> load automatically into Bun.env and process.env, so dotenv is not needed.
Examples
Example 1: Build an API server with only built-ins
User prompt: "Create a small REST API with Bun: POST /api/users stores an email and a hashed password, GET /api/users/:id returns a user."
The agent runs bun init -y, writes server.ts with Bun.serve() routes, bun:sqlite for storage and Bun.password.hash() for passwords, and starts it with bun run server.ts. It checks the result with curl -X POST -H 'content-type: application/json' -d '{"email":"mara@acme-corp.net","password":"correct-horse-9271"}' http://127.0.0.1:3000/api/users, which returns {"email":"mara@acme-corp.net"} with status 201, and shows that an unknown path returns 404.
Example 2: Move an Express project from Node.js to Bun
User prompt: "Switch my Express project from Node.js to Bun and make CI faster."
The agent deletes package-lock.json, runs bun install to create bun.lock, changes the scripts to bun run src/index.ts and bun test, and removes dotenv and ts-node. It runs the existing Jest tests under bun test, fixes the few that rely on Jest-only APIs, then sets the CI install step to bun install --frozen-lockfile. If a dependency fails on a missing Node API, it keeps that service on Node and reports the package name.
Guidelines
- Commit
bun.lock; usebun install --frozen-lockfilein CI - Dependency lifecycle scripts are blocked by default; add only packages you trust to
trustedDependencies Bun.serve()listens on all interfaces unlesshostnameis set; bind to127.0.0.1behind a reverse proxy- Prefer
Bun.passwordover adding bcrypt packages, and do not store plain passwords bun:sqliteis for embedded, single-process storage; use a server database for multi-instance deployments- Node compatibility is high but incomplete: test native addons and unusual
node:APIs before switching production - Do not benchmark-claim from marketing numbers; measure your own workload
- Use
bunxinstead ofnpx, andbun run <script>instead ofnpm run <script>
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/bun/SKILL.md
Popularity
- Repository stars
- 157
- Repository forks
- 21
- 7-day trend score
- 25
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/terminalskills/skills/bun)