bun-toolkit
Skill0 starsChanged 7 months agoMITView on GitHub
Execute JavaScript/TypeScript with Bun runtime. Use when user needs fast JS execution, package management, or cross-platform shell scripting. Keywords: bun, javascript, typescript, runtime, fast, npm alternative, package manager, shell script.
- Pipes a download into a shell
- Deletes or force-pushes
- Installs packages
In this repository3 other files it gives its agents.
- bun-builderSkill
- bun-shellSkill
- bun-testingSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 251
Use bun --hot run not bun run --hot
- Distinctive: line 252
Ensure no syntax errors in code
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Bun Toolkit
Bun is an all-in-one JavaScript runtime and toolkit designed for speed. This skill enables fast script execution, package management, and cross-platform shell scripting.
Variables
- BUN_INSTALL_SCRIPT_WINDOWS:
powershell -c "irm bun.sh/install.ps1|iex" - BUN_INSTALL_SCRIPT_UNIX:
curl -fsSL https://bun.sh/install | bash - BUN_PATH_WINDOWS:
$env:USERPROFILE\.bun\bin - BUN_PATH_UNIX:
~/.bun/bin
Prerequisites
Check Installation
# Check if Bun is installed
bun --versionInstall Bun
Windows (PowerShell):
powershell -c "irm bun.sh/install.ps1|iex"
# Add to PATH if needed
$env:Path += ";$env:USERPROFILE\.bun\bin"macOS/Linux:
curl -fsSL https://bun.sh/install | bash
source ~/.bashrc # or ~/.zshrcVia npm (cross-platform):
npm install -g bunCore Capabilities
1. Run Scripts (Fastest JS Runtime)
# Run TypeScript directly (no config needed)
bun run script.ts
# Run with hot reloading
bun --hot run server.ts
# Run with watch mode
bun --watch run script.ts2. Package Management (25x faster than npm)
# Install dependencies
bun install
# Add package
bun add package-name
bun add -d dev-package # dev dependency
bun add -g global-pkg # global
# Remove package
bun remove package-name
# Update packages
bun update3. Shell Scripting (Cross-platform)
// Cross-platform shell with Bun.$
import { $ } from "bun";
// Template literal syntax
await $`echo "Hello from Bun shell!"`;
// Piping
const result = await $`cat file.txt | grep pattern`.text();
// Variable interpolation
const dir = "./src";
await $`ls -la ${dir}`;
// Error handling
const { exitCode, stdout, stderr } = await $`command`.quiet();4. HTTP Server
Bun.serve({
port: 3000,
fetch(req) {
return new Response("Hello from Bun!");
},
});5. File I/O
// Read file
const file = Bun.file("./data.json");
const content = await file.text();
const json = await file.json();
// Write file
await Bun.write("output.txt", "Hello World");
await Bun.write("data.json", JSON.stringify({ key: "value" }));6. SQLite (Built-in)
import { Database } from "bun:sqlite";
const db = new Database("mydb.sqlite");
db.run("CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT)");
db.run("INSERT INTO users (name) VALUES (?)", ["Alice"]);
const users = db.query("SELECT * FROM users").all();Quick Commands Reference
| Task | Command |
| Run script | bun run script.ts |
| Install deps | bun install |
| Add package | bun add <pkg> |
| Dev server | bun --hot run server.ts |
| Run tests | bun test |
| Bundle | bun build ./src/index.ts --outdir ./dist |
| Create executable | bun build --compile ./app.ts --outfile app |
| Init project | bun init |
| Create from template | bun create react-app my-app |
Cookbook
Extended documentation for specific features.
| Feature | When to Read | Documentation |
| Installation | Setting up Bun on any platform | cookbook/installation.md |
| Runtime APIs | Using Bun-specific APIs | cookbook/runtime-apis.md |
| Package Management | Advanced package operations | cookbook/package-management.md |
| Shell Scripting | Cross-platform automation | cookbook/shell-scripting.md |
Examples
Example 1: Run TypeScript Directly
# No tsconfig or compilation needed
echo 'console.log("Hello, TypeScript!")' > hello.ts
bun run hello.tsExample 2: Quick HTTP Server
echo 'Bun.serve({ fetch: () => new Response("Hello!"), port: 3000 })' > server.ts
bun run server.ts
# Server running at http://localhost:3000Example 3: Process JSON Files
// process.ts
const data = await Bun.file("./input.json").json();
data.processed = true;
data.timestamp = new Date().toISOString();
await Bun.write("./output.json", JSON.stringify(data, null, 2));
console.log("Processed!");Workflow
Starting a New Project
- Initialize project:
mkdir my-project && cd my-project bun init - Add dependencies:
bun add express zod bun add -d typescript @types/node - Create entry point:
// index.ts console.log("Hello, Bun!"); - Run:
bun run index.ts
Converting npm Project to Bun
- Delete node_modules and lockfile:
rm -rf node_modules package-lock.json yarn.lock pnpm-lock.yaml - Install with Bun:
bun install - Run scripts:
bun run dev bun run build
Node.js Compatibility
Bun is designed for Node.js compatibility:
- Fully Supported: fs, path, crypto, http, https, net, url, stream, buffer, events
- Mostly Supported: child_process, worker_threads, cluster
- Not Supported: vm (use Workers), domain (deprecated)
Troubleshooting
"bun: command not found"
- Windows: Add
$env:USERPROFILE\.bun\binto PATH - Unix: Run
source ~/.bashrcor restart terminal
Package installation fails:
# Clear cache and reinstall
bun pm cache rm
rm -rf node_modules bun.lockb
bun installTypeScript errors:
- Bun uses its own TS transpiler - no
tscneeded - For type-checking:
bun x tsc --noEmit
Hot reload not working:
- Use
bun --hot runnotbun run --hot - Ensure no syntax errors in code
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

