Bun: All-in-One JavaScript Runtime

VerifiedSafe

Guide to using Bun as an all-in-one JavaScript/TypeScript runtime, package manager, bundler, and test runner. Covers HTTP servers, package installs, tests, and Node.js migration.

Sby Skills Guide Bot
DevelopmentIntermediate
11/3/2026
Claude CodeCursorCodex
#bun#javascript-runtime#package-manager#bundler#typescript

Recommended for

Automated summary

Guides the use of Bun as an all-in-one JavaScript/TypeScript runtime, package manager, bundler, and test runner.

Strengths

  • Covers the whole Bun toolchain: HTTP server, packages, bundling, tests, and file I/O
  • Gives concrete guidance on built-in APIs (Bun.serve, Bun.file, Bun.password, bun:sqlite) to avoid npm dependencies
  • Includes a Node.js migration path with specific substitutions for scripts, dotenv, and Jest

Limitations

  • Compatibility lists macOS, Linux, and WSL only; native Windows is not addressed
  • Performance claims (100K+ req/s, 10-30x faster) are stated without benchmarks or sources
  • Does not cover advanced bundler configuration or npm packages that fail on Bun
When to use it

Use it when starting or migrating a JavaScript/TypeScript project to Bun and wanting to lean on its built-in APIs.

When not to use it

Skip it if the project must stay on Node.js or if the runtime target is native Windows without WSL.

Security analysis

Safe
Quality score70/100

The skill is pure documentation-style guidance for using Bun (installing packages, running bun test, Bun.serve, bun:sqlite, etc.). It declares no tools, contains no shell commands to execute verbatim, no network exfiltration, no obfuscation, no destructive filesystem operations, and no attempts to override agent instructions or safety behavior. The only inherent risk is that an agent following it would run package installs and build/test commands, which is normal, expected development activity.

No concerns found

How this analysis is made

Examples

Bun HTTP API
Create a REST API in a single file using Bun.serve() with JSON body parsing, a WebSocket route for live updates, and bun:sqlite for storage.
Node to Bun migration
Migrate my Express project from Node.js to Bun: update package.json scripts, swap npm for bun install, replace dotenv, and move Jest tests to bun test.
Bundle for the browser
Use Bun.build() to bundle my TypeScript frontend for the browser with code splitting and tree shaking enabled.

name: bun description: >- 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. license: Apache-2.0 compatibility: "Requires Bun installed (macOS, Linux, WSL)" metadata: author: terminal-skills version: "1.0.0" category: development tags: ["bun", "javascript-runtime", "package-manager", "bundler", "typescript"]

Bun

Overview

Bun is an all-in-one JavaScript/TypeScript runtime that replaces Node.js, npm, webpack, and Jest with a single binary. It provides native TypeScript support, a high-performance HTTP server (Bun.serve()), a fast package manager, a bundler, and a Jest-compatible test runner with dramatically faster performance.

Instructions

  • When creating HTTP servers, use Bun.serve() which handles 100K+ req/s with built-in WebSocket support, TLS, and streaming responses.
  • When managing packages, use bun install (10-30x faster than npm), bun add, bun remove, and prefer bun.lock (text format) for readable git diffs.
  • When bundling, use Bun.build() with appropriate target ("browser", "bun", "node"), enable code splitting with splitting: true, and configure tree shaking.
  • When writing tests, use bun test with Jest-compatible API (describe, it, expect), snapshot testing, mocking with mock.module(), and --coverage for code coverage.
  • When doing file I/O, prefer Bun.file() and Bun.write() over Node.js fs for significantly faster file operations, and use Bun.Glob for pattern matching.
  • When handling authentication, use Bun.password.hash() and Bun.password.verify() for bcrypt/argon2 instead of npm packages.
  • When migrating from Node.js, replace node with bun in scripts, keep package.json unchanged, and note that most npm packages work without modifications. Use bun:sqlite for embedded databases instead of SQLite npm packages.

Examples

Example 1: Build a high-performance API server

User request: "Create a REST API using Bun's built-in HTTP server"

Actions:

  1. Create server with Bun.serve() and route handler
  2. Parse JSON bodies with request.json() and return Response objects
  3. Add WebSocket upgrade for real-time features
  4. Use Bun.password for auth and bun:sqlite for data storage

Output: A fast API server using only Bun built-ins with no external dependencies.

Example 2: Migrate a Node.js project to Bun

User request: "Switch my Express project from Node.js to Bun"

Actions:

  1. Replace npm install with bun install in CI and local setup
  2. Update package.json scripts to use bun run instead of node
  3. Replace dotenv with Bun's built-in .env loading
  4. Switch test runner from Jest to bun test with same test files

Output: A Bun-powered project with faster installs, startup, and test execution.

Guidelines

  • Use Bun.serve() for new HTTP servers; it is significantly faster than Express on Bun.
  • Prefer Bun.file() and Bun.write() over Node.js fs for file operations.
  • Use bun:sqlite for local data instead of adding SQLite npm packages.
  • Use Bun.password for auth instead of bcrypt/argon2 npm packages for zero native dependencies.
  • Keep bun.lock (text format) in git for readable diffs.
  • Test with bun test instead of Jest for the same API with dramatically faster execution.
  • When targeting browsers, use Bun.build() with target: "browser".

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/bun-all-in-one-javascript-runtime-mvg6txn8/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/bun-all-in-one-javascript-runtime-mvg6txn8' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/bun-all-in-one-javascript-runtime-mvg6txn8/download' --output '.skill-downloads/bun-all-in-one-javascript-runtime-mvg6txn8/SKILL.md.part' && mv '.skill-downloads/bun-all-in-one-javascript-runtime-mvg6txn8/SKILL.md.part' '.skill-downloads/bun-all-in-one-javascript-runtime-mvg6txn8/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Environment declared by the author: Requires Bun installed (macOS, Linux, WSL)

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/bun-all-in-one-javascript-runtime-mvg6txn8/SKILL.md' && test -s '.skill-downloads/bun-all-in-one-javascript-runtime-mvg6txn8/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/bun' && cp -R '.skill-downloads/bun-all-in-one-javascript-runtime-mvg6txn8' '.claude/skills/bun'

Cursor
test -f '.skill-downloads/bun-all-in-one-javascript-runtime-mvg6txn8/SKILL.md' && test -s '.skill-downloads/bun-all-in-one-javascript-runtime-mvg6txn8/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/bun' && cp -R '.skill-downloads/bun-all-in-one-javascript-runtime-mvg6txn8' '.cursor/skills/bun'

Codex
test -f '.skill-downloads/bun-all-in-one-javascript-runtime-mvg6txn8/SKILL.md' && test -s '.skill-downloads/bun-all-in-one-javascript-runtime-mvg6txn8/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/bun' && cp -R '.skill-downloads/bun-all-in-one-javascript-runtime-mvg6txn8' '.agents/skills/bun'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/bun-all-in-one-javascript-runtime-mvg6txn8'

openskills read 'bun-all-in-one-javascript-runtime-mvg6txn8'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/bun-all-in-one-javascript-runtime-mvg6txn8/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills