bun
Bun JavaScript/TypeScript runtime and all-in-one toolkit. Covers runtime, package manager, bundler, test runner, HTTP server, WebSockets, SQLite, S3, Redis, file I/O, shell scripting, FFI, Markdown parser. Use when running JS/TS with Bun, managing packages, bundling, testing, or using Bun-specific APIs. Keywords: bun, bunx, bun install, bun run, bun test, bun build, Bun.serve, Bun.file, bun:sqlite, Bun.markdown.
What this skill does
# Bun
All-in-one JavaScript/TypeScript toolkit: runtime, package manager, test runner, bundler.
## Quick Navigation
| Topic | Reference |
| ------------------ | ------------------------------------ |
| Package Manager | `references/package-manager.md` |
| Project Setup | `references/project-scaffolding.md` |
| Development | `references/development.md` |
| Module System | `references/module-system.md` |
| TypeScript & JSX | `references/typescript-jsx.md` |
| Configuration | `references/bunfig.md` |
| HTTP Server | `references/http-server.md` |
| Browser Automation | `references/webview.md` |
| WebSockets | `references/websockets.md` |
| File I/O | `references/file-io.md` |
| SQLite | `references/sqlite.md` |
| S3 Storage | `references/s3.md` |
| Redis | `references/redis.md` |
| Low-Level Network | `references/networking-low-level.md` |
| Fetch API | `references/fetch.md` |
| Shell Scripts | `references/shell.md` |
| Spawn Process | `references/spawn.md` |
| Workers | `references/workers.md` |
| Native FFI | `references/native-interop.md` |
| C/C++ Compile | `references/cc.md` |
| Transpiler | `references/transpiler.md` |
| Plugins | `references/plugins.md` |
| FS Router | `references/file-system-router.md` |
| Environment Vars | `references/env.md` |
| Utilities | `references/utilities.md` |
| Node.js Compat | `references/nodejs-compat.md` |
## When to Use Bun
- Running TypeScript/JSX without build step
- Fast HTTP server with native routing
- Headless browser automation with native input events
- SQLite database (embedded, no deps)
- WebSocket server/client
- S3-compatible storage (AWS, R2, MinIO)
- Redis caching/pub-sub
- Cross-platform shell scripts
- In-process cron scheduling
- **Markdown parsing** (v1.3.8+)
- Native library calls via FFI
## Core Advantages
- **4x faster startup** than Node.js
- **Native TypeScript/JSX** — no tsconfig needed
- **ESM + CommonJS** — both work seamlessly
- **Web APIs built-in** — fetch, WebSocket, etc.
- **30x faster installs** than npm
## Quick Start
```bash
# Run TypeScript directly
bun run index.ts
# Install packages
bun install
# Run package.json script
bun run dev
# Execute package binary
bunx cowsay "Hello"
# Run tests
bun test
# Build for production
bun build ./index.ts --outdir ./dist
# Bundle analysis for LLMs (v1.3.8+)
bun build ./index.ts --metafile-md --outdir ./dist
```
## Critical Rules
| Don't | Do |
| ---------------------- | ------------------------ |
| `http.createServer()` | `Bun.serve()` |
| `fs.readFileSync()` | `Bun.file().text()` |
| `better-sqlite3` | `bun:sqlite` |
| `child_process.exec()` | `Bun.$` or `Bun.spawn()` |
| `dotenv` | Built-in `.env` support |
## Release Highlights (1.3.14)
- **`Bun.Image`**: built-in image decoding, transforms, and encoding for common formats with no npm dependency or native addon build step.
- **Test workflow**: the `1.3.13` line improves dependency-aware filtering for changed-file test runs, which matters when you rely on partial local verification.
- **Patch-line runtime work**: `1.3.13`-`1.3.14` continues compatibility and performance work on top of the `1.3.12` WebView/cron/Markdown release line.
## Release Highlights (1.3.12)
- **`Bun.WebView`**: native headless browser automation with WebKit on macOS and Chrome/Chromium via CDP on all platforms.
- **`Bun.cron()` callback mode**: in-process scheduler with no-overlap execution, UTC semantics, hot-reload cleanup, and `Disposable` job handles.
- **Markdown in terminal**: `bun ./file.md` and `Bun.markdown.ansi()` make terminal-native rendering a first-class workflow.
- **Networking/runtime**: UDP error/truncation handling, Node-compatible unix-socket lifecycle, proxy tunnel reuse, and `Bun.serve()` accept/perf improvements.
## Essential Recipes
### HTTP Server
```ts
Bun.serve({
port: 3000,
fetch(req) {
const url = new URL(req.url);
if (url.pathname === "/api/data") {
return Response.json({ ok: true });
}
return new Response("Not Found", { status: 404 });
},
});
```
### File Operations
```ts
// Read
const content = await Bun.file("data.txt").text();
// Write
await Bun.write("output.txt", "Hello World");
// JSON
const config = await Bun.file("config.json").json();
```
### SQLite
```ts
import { Database } from "bun:sqlite";
const db = new Database("app.db");
db.run("CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT)");
const insert = db.prepare("INSERT INTO users (name) VALUES (?)");
insert.run("Alice");
const users = db.query("SELECT * FROM users").all();
```
### WebSocket Server
```ts
Bun.serve({
fetch(req, server) {
if (server.upgrade(req)) return;
return new Response("Upgrade failed", { status: 400 });
},
websocket: {
message(ws, message) {
ws.send(`Echo: ${message}`);
},
},
});
```
### Shell Commands
```ts
import { $ } from "bun";
// Simple command
const files = await $`ls -la`.text();
// With variables (auto-escaped)
const name = "my file.txt";
await $`cat ${name}`;
// Piping
await $`cat data.csv | grep "pattern" | wc -l`;
```
### S3 Storage
```ts
import { s3 } from "bun";
// Upload
await s3.file("uploads/doc.pdf").write(data);
// Download
const content = await s3.file("uploads/doc.pdf").text();
// Presigned URL
const url = s3.presign("uploads/doc.pdf", { expiresIn: 3600 });
```
### Redis
```ts
import { redis } from "bun";
await redis.set("key", "value");
const value = await redis.get("key");
await redis.expire("key", 3600);
```
### Testing
```ts
import { expect, test, describe } from "bun:test";
describe("math", () => {
test("2 + 2 = 4", () => {
expect(2 + 2).toBe(4);
});
});
```
## Configuration (bunfig.toml)
```toml
[run]
watch = true
[install]
registry = "https://registry.npmjs.org"
[test]
coverage = true
```
## Environment Variables
```bash
# .env files loaded automatically
DATABASE_URL=postgres://localhost/mydb
```
```ts
// Access
Bun.env.DATABASE_URL;
process.env.DATABASE_URL;
import.meta.env.DATABASE_URL;
```
## Links
- [Documentation](https://bun.sh/docs)
- [Releases](https://github.com/oven-sh/bun/releases)
- [GitHub](https://github.com/oven-sh/bun)
- [Discord](https://bun.sh/discord)
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.