bun-runtime
БесплатноБез исполняемых скриптовНе проверенBun — fast all-in-one JavaScript runtime, bundler, test runner, and package manager. Use when speeding up Node.js projects, using Bun as a drop-in Node…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Bun Runtime
Overview
Bun is a fast, all-in-one JavaScript toolkit: runtime, package manager, bundler, and test runner. It is Node.js-compatible and dramatically faster at startup, installs, and test runs. Use Bun to speed up existing Node.js projects or build new apps from scratch.
Instructions
Installation
npm install -g bun # any platform with Node.js
brew install oven-sh/bun/bun # macOS / Linux (Homebrew)
scoop install bun # Windows (Scoop)
bun --version # verify
bun upgrade # later: update in place
The project also publishes an install script at bun.sh and release archives on GitHub; if you use an archive, check it against the release's SHASUMS256.txt before running it.
Package Manager
Bun's package manager is a drop-in replacement for npm and pnpm:
bun install # Install all dependencies (reads package.json)
bun add express # Add a package
bun add -d typescript # Add dev dependency
bun remove lodash # Remove a package
bun update # Update dependencies within their ranges
bun outdated # List packages with newer versions
bun audit # Check for known vulnerabilities
bun install --frozen-lockfile # CI: fail if the lockfile would change
bun run dev # Run a package.json script
Lockfile: bun.lock (text, JSONC), the default in current Bun. Older projects may still have the binary bun.lockb; bun install --save-text-lockfile writes the text format. Commit the lockfile.
Runtime
Bun runs .js, .ts, .jsx, .tsx files natively — no compilation step needed:
bun run index.ts # Run TypeScript directly
bun index.ts # Shorthand
bun --hot index.ts # Hot reload on file change
bun --watch index.ts # Restart on file change
Node.js built-ins (fs, path, http, crypto, etc.) are fully supported. Native fetch, WebSocket, and ReadableStream are built in.
HTTP Server with Bun.serve
const server = Bun.serve({
port: 3000,
// Optional: `routes` maps paths to a Response or handler (params via req.params):
routes: {
"/users/:id": (req) => Response.json({ id: req.params.id }),
},
// fetch handles everything the routes do not match
async fetch(req) {
const url = new URL(req.url);
if (url.pathname === "/") {
return new Response("Hello from Bun!", {
headers: { "Content-Type": "text/plain" },
});
}
if (url.pathname === "/json") {
return Response.json({ message: "fast", runtime: "bun" });
}
return new Response("Not Found", { status: 404 });
},
error(err) {
return new Response(`Error: ${err.message}`, { status: 500 });
},
});
console.log(`Listening on http://localhost:${server.port}`);
File I/O with Bun.file
// Read file
const file = Bun.file("data.json");
const text = await file.text();
const json = await file.json();
// Write file
await Bun.write("output.txt", "Hello, Bun!");
await Bun.write("data.json", JSON.stringify({ key: "value" }, null, 2));
SQLite with bun:sqlite
Built-in SQLite — no native bindings needed:
import { Database } from "bun:sqlite";
const db = new Database("mydb.sqlite");
db.run(`CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
email TEXT UNIQUE NOT NULL
)`);
const insert = db.prepare("INSERT INTO users (name, email) VALUES (?, ?)");
insert.run("Alice", "[email protected]");
const getAll = db.prepare("SELECT * FROM users");
const users = getAll.all();
console.log(users);
const getOne = db.prepare("SELECT * FROM users WHERE id = ?");
const user = getOne.get(1);
db.close();
Bundler
# Bundle a TypeScript app for the browser
bun build src/index.ts --outdir dist --target browser
# Bundle for Node.js with minification
bun build src/index.ts --outdir dist --target node --minify
# Bundle as a single executable
bun build src/cli.ts --compile --outfile mycli
Programmatic bundling:
const result = await Bun.build({
entrypoints: ["./src/index.ts"],
outdir: "./dist",
target: "browser",
minify: true,
sourcemap: "external",
});
if (!result.success) {
console.error("Build failed:", result.logs);
process.exit(1);
}
Test Runner
Bun's test runner is Jest-compatible:
// math.test.ts
import { describe, expect, test, beforeEach } from "bun:test";
import { add, multiply } from "./math";
describe("math", () => {
test("adds two numbers", () => {
expect(add(2, 3)).toBe(5);
});
test("multiplies two numbers", () => {
expect(multiply(4, 5)).toBe(20);
});
});
Mocks, spies and test.each are available from bun:test as well.
bun test # Run all tests
bun test --watch # Watch mode
bun test math.test.ts # Run sp
Установить bun-runtime в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл bun-runtime?
Bun — fast all-in-one JavaScript runtime, bundler, test runner, and package manager. Use when speeding up Node.js projects, using Bun as a drop-in Node replacement, bundling with Bun, or running tests faster. Covers runtime APIs, package management, bundling, and Bun-specific features like Bun.serve, Bun.file, and bun:sqlite.
Как установить скилл bun-runtime?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл bun-runtime запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic