Bun

From InugamiDev/ultrathink-oss · View interactive version

Bun is an AI agent skill from the GitHub repository InugamiDev/ultrathink-oss. > All-in-one JavaScript runtime — bundler, transpiler, package manager, test runner.

How to use this skill

Skill file

Bun

All-in-one JavaScript runtime — bundler, transpiler, package manager, test runner.

When to Use

Core Patterns

Package Management

bun install              # Install deps (faster than npm)
bun add zod hono         # Add packages
bun add -d vitest        # Add dev dependency
bun remove lodash        # Remove package
bun update               # Update all deps
bunx create-next-app     # npx equivalent

Runtime

// Run any .ts/.tsx/.js file directly
// $ bun run server.ts

// Built-in HTTP server (faster than Node http)
Bun.serve({
  port: 3000,
  fetch(req) {
    const url = new URL(req.url);
    if (url.pathname === "/api/health") {
      return Response.json({ status: "ok" });
    }
    return new Response("Not found", { status: 404 });
  },
});

// Built-in SQLite
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 users = db.query("SELECT * FROM users").all();

// File I/O (faster than fs)
const file = Bun.file("data.json");
const data = await file.json();
await Bun.write("output.txt", "hello");

// Shell (bun sh)
import { $ } from "bun";
const result = await $`ls -la`.text();

Testing

// Uses Jest-compatible API
import { test, expect, describe } from "bun:test";

describe("math", () => {
  test("adds", () => {
    expect(1 + 1).toBe(2);
  });
});
// Run: bun test

Key Conventions

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.