Skip to content
Agentmart
Submit a tool

bun

Use this skill when building with Bun runtime — Bun APIs, testing, package management, shell scripting, hot reload, SQLite, file I/O.

Skill by j4flmao

IndexedMIT★ 34
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/j4flmao-bun

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Use this skill when building with Bun runtime — Bun APIs, testing, package management, shell scripting, hot reload, SQLite, file I/O. This skill enforces: built-in APIs over npm equivalents, Bun test runner, bun install speed optimization, Bun.shell for scripts. Do NOT use for: Node.js-specific APIs (process.nextTick), Deno-specific features, browser JavaScript.

Use cases: backend, testing

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 26, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/bun

What's inside

Skill name
bun
Description
Use this skill when building with Bun runtime — Bun APIs, testing, package management, shell scripting, hot reload, SQLite, file I/O. This skill enforces: built-in APIs over npm equivalents, Bun test runner, bun install speed optimization, Bun.shell for scripts. Do NOT use for: Node.js-specific APIs (process.nextTick), Deno-specific features, browser JavaScript.
License
MIT
Instructions
587 lines in SKILL.md · view on GitHub

Before installing

  • Instructions call the network

Agent Skills spec issues

  • compatibility: must be text of at most 500 characters
  • body: 587 lines (spec recommends under 500)

Files (7)

  • SKILL.md
  • bun-advanced.md · references/
  • bun-deployment.md · references/
  • bun-ecosystem.md · references/
  • bun-essentials.md · references/
  • bun-fundamentals.md · references/
  • bun-tooling.md · references/

SKILL.md (first lines)

# Bun

## Purpose
Build TypeScript/JavaScript services and tooling on Bun, using its built-in server, SQLite driver, file APIs, shell, test runner and bundler where they simplify the stack, while staying aware of where Node.js compatibility still matters.

## Agent Protocol

### Trigger
Exact user phrases: "bun", "bun runtime", "bun install", "bun test", "bun build", "Bun.serve", "bun:sqlite", "Bun.file", "Bun shell", "bun --compile".

### Input Context
- Target: API server, CLI tool, scripts, or library.
- Framework on top of Bun (none, Elysia, Hono, Express via Node compatibility).
- Database (bun:sqlite, PostgreSQL via `Bun.sql` or `postgres`/`pg`, Redis).
- Deployment target (Docker, single binary, serverless).

### Output Artifact
Project layout, server/test/build code and `package.json` scripts. No files unless requested.

### Response Format
```
Runtime: Bun {version}   Framework: {none|Elysia|Hono|Express}
Server: Bun.serve {routes|fetch}   DB: {bun:sqlite|Bun.sql|other}
Scripts: dev/test/build/compile
Code: {files}
Node-compat risks: {native addons, unsupported node: APIs}
```

## Runtime Choice

| Criterion | Bun | Node.js | Deno |
|---|---|---|---|
| TypeScript | Runs `.ts` directly (transpile only, no type-check) | Type stripping built in since Node 22.18/23.6 for erasable syntax; otherwise tsx/build step | Runs `.ts` directly; `deno check` type-checks |
| npm packages | High compatibility; native addons and some `node:` APIs can still differ | Reference implementation | npm via `npm:` specifiers |
| Built-ins | HTTP server, WebSocket, SQLite, Postgres client, S3 client, password hashing, shell, test runner, bundler | Test runner, `node:sqlite` (newer versions) | HTTP, KV, test runner, formatter, linter |
| Maturity | Youngest; verify critical dependencies | Most mature, widest hosting support | Mature, strong permissions model |

Decision: choose Bun when its built-ins remove dependencies and your dependency set is verified to work; keep Node.js when you rely on native addons, APM agents or hosting that only supports Node. Always type-check separately (`tsc --noEmit`) because Bun does not.

Startup-time and requests-per-second comparisons vary by benchmark and version; measure on your own workload rather than quoting published numbers.

## Workflow

### Step 1: Project Initialization

```bash
bun init -y                 # package.json, tsconfig.json, index.ts
bun add zod                 # dependencies (writes text lockfile bun.lock)
bun add -d @types/bun typescript
```

```
my-app/
  src/
    index.ts          # Bun.serve entry
    routes/users.ts
    db/sqlite.ts
  tests/users.test.ts
  bun.lock
  package.json
  tsconfig.json
```

### Step 2: HTTP Server with Bun.serve

Bun 1.2.3+ supports a `routes` table with path parameters; `fetch` handles everything else.

```ts
// src/index.ts
import { createUser, findUserById, findAllUsers } from './db/sqlite';

const server = Bun.serve({
  port: Number(process.env.PORT ?? 3000),
  routes: {
    '/health': () => Response.json({ status: 'ok' }),
    '/api/v1/users': {
      GET: () => Response.json({ data: findAllUsers() }),
      POST: async (req) => {
        const body = (await req.json()) as { name?: string; email?: string };
        if (!body.name || !body.email) {
          return Response.json({ error: 'name and email required' }, { status: 400 });
        }
        return Response.json({ data: createUser(body.name, body.email) }, { status: 201 });
      },
    },
    '/api/v1/users/:id': (req) => {
      const user = findUserById(req.params.id);
      return user ? Response.json({ data: user }) : Response.json({ error: 'not found' }, { status: 404 });
    },
  },
  fetch() {
    return Response.json({ error: 'not found' }, { status: 404 });
  },
  error(err) {
    console.error('unhandled request error', err);
    return Response.json({ error: 'internal error' }, { status: 500 });
  },
});

console.log(`listening on ${server.url}`);
```

### Step 3: bun:sqlite

```ts
// src/db/sqlite.ts
import { Database } from 'bun:sqlite';

export interface User { id: string; name: string; email: string; created_at: string }

const db = new Database(process.env.DB_PATH ?? './data/app.db', { create: true, strict: true });
db.exec('PRAGMA journal_mode = WAL;');
db.exec('PRAGMA foreign_keys = ON;');
db.exec(`
  CREATE TABLE IF NOT EXISTS users (
    id TEXT PRIMARY KEY,
    name TEXT NOT NULL,
    email TEXT UNIQUE NOT NULL,
    created_at TEXT NOT NULL DEFAULT (datetime('now'))

From j4flmao/agent-skills, MIT.

More from j4flmao/agent-skills

Signals

Stars
34
Forks
4
Open issues
0
Last commit (this folder)
Aug 15, 2026 (2 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from j4flmao

Cite this page

bun skill. Agent Mart. https://agentmart.dev/skills/j4flmao-bun (last updated 2026-10-24)