agentleFS
G1JoshiG1Joshi/Agent-Skills/skills/frameworks/bun/SKILL.md

bun

Skill15 starsChanged 42 days agoMITView on GitHub

Expert Bun runtime assistance covering high-performance JS/TS execution, built-in bundler, package manager, and test runner. Use when executing TypeScript natively, running fast scripts, or serving HTTP APIs.

15 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use analytics-metrics, aws-account-management and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • hoodiniSkill

    analytics-metrics

    Build data visualization and analytics dashboards. Use when creating charts, KPI displays, metrics dashboards, or data visualization components. Triggers on analytics, dashboard, charts, metrics, KPI, data visualization, Recharts.

    Also in 3 projects that use this

  • hoodiniSkill

    aws-account-management

    Manage AWS accounts, organizations, IAM, and billing. Use when setting up AWS Organizations, managing IAM policies, controlling costs, or implementing multi-account strategies. Triggers on AWS Organizations, AWS IAM, AWS billing, Cost Explorer, SCPs, multi-account, AWS SSO, Identity Center.

    Also in 3 projects that use this

  • kelvincushmanSkill

    gh-commit

    Create well-formatted commits with conventional commit format.

    Also in 3 projects that use this

  • kelvincushmanSkill

    prek

    Use when setting up or running hooks with prek in any repository. prek is a Rust drop-in alternative to pre-commit for running Git hooks that check, format, lint, and validate code and repository files. Prefer it when speed, workspace mode, built-in hooks, shared toolchains, or native TOML configuration matter.

    Also in 3 projects that use this

  • ant-designSkill

    gh-create-pr

    使用 GitHub CLI (gh) 推送当前分支并创建或更新 PR。在用户说「提 PR」「新建 PR」「用 gh 建 PR」「submit PR」「create pull request」时使用。

    Also in 3 projects that use this

  • +6 more from hoodini

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 1 is distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 9 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use Bun's built-in zero-dependency SQLite module:

    line 129
  2. Very specific:

    Use bun run and bunx to avoid npm script execution overhead.

    line 152
  3. Very specific:

    Run TypeScript files directly (bun run index.ts) without requiring tsc or ts-node.

    line 154
  4. Very specific:

    Check Node.js API compatibility flags when porting legacy native C++ addons (node-gyp).

    line 155
  5. Very specific:

    Use npm install in Bun projects.

    line 159
  6. Very specific:

    Use external SQLite packages like better-sqlite3.

    line 160

“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Bun

Bun is a drop-in replacement for Node.js, written in Zig. It is fast. v1.1 brings Windows support.

When to Use

  • All-in-One JavaScript/TypeScript Runtime: Ultra-fast alternative to Node.js for server-side apps, bundlers, and package managers.
  • High-Performance HTTP Services: Building web APIs using Bun.serve() with native WebSocket and TLS support.
  • Rapid Package Management: Executing bun install with 10x-30x speedups over legacy package managers.
  • Built-in SQLite & Testing: Developing microservices with zero-dependency native SQLite (bun:sqlite) and bun:test.

Quick Start

// server.ts
const server = Bun.serve({
  port: 3000,
  fetch(req) {
    const url = new URL(req.url);
    if (url.pathname === "/api/health") {
      return Response.json({ status: "ok", runtime: "bun" });
    }
    return new Response("Hello from Bun!", { status: 200 });
  },
});

console.log(`Listening on http://localhost:${server.port}`);

Core Concepts

High-Throughput HTTP Server with Bun.serve()

Native HTTP/1.1 and HTTP/2 web server with WebSockets:

const server = Bun.serve({
  port: 3000,
  fetch(req, server) {
    const url = new URL(req.url);

    // WebSocket upgrade
    if (url.pathname === "/chat") {
      if (server.upgrade(req)) return;
      return new Response("Upgrade failed", { status: 400 });
    }

    if (url.pathname === "/api/health") {
      return Response.json({ status: "healthy", timestamp: Date.now() });
    }

    return new Response("Not Found", { status: 404 });
  },
  websocket: {
    message(ws, message) {
      ws.send(`Echo: ${message}`);
    },
    open(ws) {
      console.log("WebSocket client connected");
    },
    close(ws) {
      console.log("WebSocket client disconnected");
    },
  },
});

console.log(`Bun server running at http://localhost:${server.port}`);

Native SQLite with bun:sqlite

High-speed zero-dependency embedded database:

import { Database } from "bun:sqlite";

const db = new Database("app.db", { create: true });

// Execute schema creation
db.run(`
  CREATE TABLE IF NOT EXISTS users (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    email TEXT UNIQUE NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
  )
`);

// Prepared statement
const insert = db.prepare("INSERT INTO users (email) VALUES ($email)");
insert.run({ $email: "alice@example.com" });

const query = db.prepare("SELECT * FROM users WHERE email = $email");
const user = query.get({ $email: "alice@example.com" });
console.log("Found user:", user);

Fast Test Runner with bun:test

Jest-compatible testing without compilation overhead:

import { describe, expect, test, beforeAll } from "bun:test";

describe("Math and Array Utilities", () => {
  test("calculates sum correctly", () => {
    const sum = [1, 2, 3, 4].reduce((a, b) => a + b, 0);
    expect(sum).toBe(10);
  });

  test("resolves async promises", async () => {
    const data = await Promise.resolve({ success: true });
    expect(data.success).toBeTrue();
  });
});

Common Patterns

High-Speed SQLite Ingestion with bun:sqlite

Problem: External SQLite packages require native compile toolchains and introduce overhead in Node.js.

Solution: Use Bun's built-in zero-dependency SQLite module:

import { Database } from "bun:sqlite";

const db = new Database("store.db");
db.run(
  "CREATE TABLE IF NOT EXISTS metrics (id INTEGER PRIMARY KEY, value REAL)",
);

const insert = db.prepare("INSERT INTO metrics (value) VALUES (?)");
db.transaction((values: number[]) => {
  for (const v of values) insert.run(v);
})([1.2, 3.4, 5.6]);

const results = db.query("SELECT * FROM metrics LIMIT 5").all();
console.log(results);

Best Practices

Do:

  • Use bun run and bunx to avoid npm script execution overhead.
  • Leverage Bun.file() for high-performance zero-copy file streaming.
  • Run TypeScript files directly (bun run index.ts) without requiring tsc or ts-node.
  • Check Node.js API compatibility flags when porting legacy native C++ addons (node-gyp).

Don't:

  • Use npm install in Bun projects; stick to bun install to preserve bun.lock.
  • Use external SQLite packages like better-sqlite3; use native bun:sqlite.
  • Spawn child processes for simple shell tasks; use Bun.$ shell scripting.

Troubleshooting

ErrorCauseSolution
error: Cannot find package '...'Dependency not installed in current directory.Run bun add <package-name> or verify bun.lockb integrity.
TypeError: Node.js API not supportedEdge-case Node API not yet implemented in Bun.Check compatibility matrix or run with NODE_OPTIONS polyfill.
Port 3000 is already in useAnother server instance already listening on port.Specify custom port via PORT=3001 bun run server.ts.

References

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.