Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Bun Pro

ASecurity

Bun runtime guidance — fast installs, built-in bundler and test runner, Bun.serve APIs, and migration from Node.

2 stars
0 votes
0 copies
0 views
Added 9/29/2026
ai-agentsjavascripttypescriptgojavasqlnodegitapidatabasefrontend

Works with

cliapi

Security Analysis

A100/100

Scanned 9/29/2026

$npx -y skills add aicodedecode/awesome-muse-skills --skill bun-pro --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Bun Pro?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Bun Pro
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aicodedecode-bun-pro/badge)](https://www.skillsdirectory.com/skills/aicodedecode-bun-pro)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: bun-pro
description: Bun runtime guidance — fast installs, built-in bundler and test runner, Bun.serve APIs, and migration from Node.
category: development
---

## Overview

Bun is an all-in-one JavaScript and TypeScript runtime built on JavaScriptCore that replaces Node plus npm plus your bundler plus your test runner with a single fast binary. Its headline features are near-instant installs, a native bundler, a Jest-compatible test runner, and a high-performance HTTP server API (`Bun.serve`). Bun also aims for broad Node.js compatibility, so most existing projects run with little or no change. This skill covers using Bun effectively, migrating from Node, and knowing where the edges still are.

## When to use

- Starting a new JS/TS project where install speed and a single toolchain matter.
- Migrating a Node project to reduce toolchain complexity (one binary for runtime, bundler, tests).
- Building high-throughput HTTP services or WebSocket servers on `Bun.serve`.
- Speeding up CI with faster installs and test runs.
- Evaluating runtime tradeoffs between Bun, Node, and Deno.
- Bundling frontend assets without a separate webpack/vite setup.
- Writing CLIs where a single compiled binary simplifies distribution.

## Core concepts

- **One binary, four tools.** `bun run` (runtime), `bun install` (package manager), `bun build` (bundler), `bun test` (test runner). Learn all four before reaching for webpack/vite/jest equivalents — you often do not need them.
- **Node compatibility layer.** Bun implements `node:` builtins and npm package semantics. Most pure-JS packages work; native addons and exotic `node_modules` layouts are where breaks happen — test before switching production.
- **Bun.serve and WebSockets.** The native server API handles HTTP and WebSocket upgrades with far less overhead than framework stacks:
  ```ts
  Bun.serve({
    port: 3000,
    fetch(req) { return new Response("hi"); },
    websocket: { message(ws, msg) { ws.send("echo: " + msg); } },
  });
  ```
- **Built-in SQLite and FFI.** `bun:sqlite` gives a zero-dependency embedded database; `bun:ffi` calls native libraries directly. Both remove whole dependency classes for small services.
- **Transpiler on by default.** Bun runs TypeScript, JSX/TSX, and modern syntax natively — no tsconfig wrangling for runtime behavior (though you still want `tsc` or an editor for type errors).
- **Workspaces and lockfile.** Bun supports npm-style workspaces with its own lockfile (`bun.lockb`, binary by default — text lockfile mode gives readable diffs). Commit it for reproducible installs.
- **npm registry compatibility.** `bun install` reads the npm registry and respects `package.json` semantics, so migration is usually `bun install` plus `bun run` away.
- **Hot reloading.** `--hot` watches and reloads on file changes — fast iteration in dev, never in production.
- **Macros.** Compile-time code execution (`macro()`) for codegen-like patterns without a build plugin — powerful, but keep macros simple and deterministic.
- **Environment and dotenv.** Bun loads `.env` files automatically — convenient, but ensure secrets still come from the environment in production, not committed files.

## Practical workflow

1. **Install and verify.** Use the official install script from the Bun website, then confirm the version your team pins with `bun --version`.
   - Record the version in README/CI; Bun moves fast and behavior changes between minors.
2. **Migrate or scaffold.** In an existing Node project, run `bun install` (npm scripts keep working) or start fresh with `bun init`. Prefer the text lockfile for clean git diffs.
3. **Replace the toolchain.** Swap scripts to `bun run`, tests to `bun test` (Jest-style `describe`/`it`/`expect` mostly works), and builds to `bun build ./src/index.ts --outdir=dist --target=bun`.
   - Run the full test suite under both runtimes during migration; snapshot-test differences are the usual finding.
4. **Build the server.** Use `Bun.serve` for hot paths; keep framework code (Elysia, Hono) for routing structure. Put SQLite behind `bun:sqlite` for local-first persistence.
5. **Handle WebSockets properly.** Define `open`/`message`/`close` handlers, track connections in a Set with metadata, and implement application-level heartbeats — the same reliability rules as any socket server.
   ```ts
   const clients = new Set<ServerWebSocket<unknown>>();
   Bun.serve({
     fetch(req, server) {
       if (server.upgrade(req)) return;
       return new Response("websocket only", { status: 400 });
     },
     websocket: {
       open(ws) { clients.add(ws); },
       close(ws) { clients.delete(ws); },
       message(ws, msg) { /* handle */ },
     },
   });
   ```
6. **Compile for distribution.** `bun build --compile` produces a standalone executable — handy for CLIs and single-binary deploys without a runtime install.
7. **Containerize.** Use the official Bun image, copy `package.json` plus lockfile, run `bun install --frozen-lockfile`, then copy source — same layer-caching discipline as Node images.
8. **Monitor in production.** Track event-loop lag, memory, and request latency like any Node service; Bun's speed doesn't exempt it from observability.

## Common pitfalls

- **Assuming 100% Node parity** — check Bun's compatibility tracker for the APIs you use (streams edge cases, cluster, some `child_process` behaviors) before cutting over.
- **Binary lockfile diffs** — `bun.lockb` is unreadable in PRs; use text lockfile mode if reviewability matters to your team.
- **Native dependencies** built for Node's V8 ABI — some need rebuilds or do not work under JavaScriptCore; test on the target platform.
- **Skipping type checking** — Bun runs TS without checking it; run `tsc --noEmit` in CI or type errors accumulate silently.
- **Overusing watch mode in production** — `--hot` is for development; production needs a process manager and graceful shutdown.
- **Ignoring `--frozen-lockfile` in CI** — without it, CI can install different versions than your machine.
- **Treating Bun APIs as portable** — `Bun.serve`, `bun:sqlite`, and `bun:ffi` do not exist in Node/Deno; isolate them behind adapters if you may switch runtimes.
- **No graceful shutdown** — `Bun.serve` needs explicit signal handling to drain connections on deploy; don't rely on defaults.
- **SQLite concurrency assumptions** — `bun:sqlite` is single-writer; high-write workloads need WAL mode or a client-server DB.
- **Version churn** — pinning matters more with a fast-moving runtime; unpinned CI picks up breaking changes.
- **No `.env` discipline** — auto-loaded `.env` files committed with secrets; keep them gitignored and document required vars.
- **Forgetting `bun outdated`** — dependencies drifting because installs are so fast nobody audits; review updates regularly.

Attribution

aicodedecodeaicodedecode
View sourceSee grades on GitHubMore from aicodedecode →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698621 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →