From bun-expert
Expert guidance for JavaScript/TypeScript development with the Bun runtime. Covers project setup, package management, HTTP servers, built-in APIs, testing, bundling, and migration from Node.js. Use when starting Bun projects, using Bun APIs (Bun.serve, sql/SQL, s3, redis, Bun.$), migrating from Node.js, or troubleshooting Bun-specific behavior.
How this skill is triggered — by the user, by Claude, or both
Slash command
/bun-expert:bun-expertThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill is intentionally grounded in official Bun documentation. Bun moves
This skill is intentionally grounded in official Bun documentation. Bun moves quickly, so prefer current docs over hard-coded release timelines or benchmark claims.
bun init # Interactive setup (package.json + tsconfig.json)
bun init -y # Accept defaults
bun create <template> <dir> # Scaffold from a template
bun init generates a compatible tsconfig.json.bun install
bun add <pkg>
bun add -d <pkg>
bun add -g <pkg>
bun remove <pkg>
bun update
bunx <pkg>
bun.lock is the default text lockfile format in modern Bun.bun.lockb remains supported for compatibility.bun install --save-text-lockfile
bun why <pkg>
bun audit
bun list
bun pm migrate
Bun supports dependency catalogs in workspace roots:
{
"workspaces": {
"packages": ["packages/*"],
"catalog": {
"react": "^19.0.0",
"typescript": "^5.7.0"
}
}
}
Reference from packages:
{
"dependencies": {
"react": "catalog:"
}
}
bun index.ts
bun run start
bun --watch index.ts
bun --hot index.ts
bun run --parallel script1 script2 # run concurrently
bun run --sequential script1 script2 # run one after another
Bun auto-loads .env files. Order is:
.env.env.{NODE_ENV} (development, production, test).env.localconst apiKey = process.env.API_KEY;
const bunApiKey = Bun.env.API_KEY;
bun --hot index.html
bun --watch index.html
Bun supports route-based servers with Bun.serve().
Bun.serve({
port: 3000,
routes: {
"/": new Response("Hello"),
"/api/users/:id": (req) => Response.json({ id: req.params.id }),
"/api/posts": {
GET: () => Response.json({ posts: [] }),
POST: async (req) => Response.json(await req.json(), { status: 201 }),
},
},
fetch() {
return new Response("Not Found", { status: 404 });
},
});
| Need | Bun API |
|---|---|
| HTTP server + WebSockets | Bun.serve() |
| SQL databases | sql, SQL, Bun.sql, Bun.SQL |
| S3-compatible storage | s3, S3Client |
| Redis | redis, RedisClient |
| Scheduled tasks (cron) | Bun.cron, Bun.cron.parse |
| Shell scripting | Bun.$ / $ |
| Local files | Bun.file, Bun.write |
| SQLite (embedded) | bun:sqlite |
| Password hashing | Bun.password |
bun test)bun test
bun test --watch
bun test --test-name-pattern "auth"
bun test --bail
bun test --coverage
bun test --coverage-reporter text
bun test --path-ignore-patterns "*/fixtures/*"
bun build ./src/index.ts --outdir ./dist
bun build --target=bun ./src/server.ts --outfile ./dist/server.js
bun build --compile ./src/cli.ts --outfile ./dist/my-cli
bun build --compile --target=browser ./src/app.ts # self-contained HTML output
bun install.bun test, bun build, bun run).Bun.serve, sql, redis, s3, Bun.$).| Reference | Contents |
|---|---|
| references/builtin-apis.md | Bun.serve, SQL, S3, Redis, cron, shell, filesystem, crypto/password utilities |
| references/testing-and-bundling.md | bun test usage, mocking patterns, bun build CLI and API |
| references/node-migration.md | Practical Node-to-Bun migration steps and compatibility guidance |
On first use in a session, silently check for a newer version:
https://raw.githubusercontent.com/abpai/skills/main/versions.json.bun-expert against this file's metadata.version.bun-expert update available (local {X.Y} → remote {A.B}). Would you like me to update it for you first? I can run
npx skills update bun-expertfor you.
npx claudepluginhub abpai/skills --plugin bun-expertProvides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.