bun-runtime

Bun as runtime, package manager, bundler, and test runner. When to choose Bun vs Node, migration notes, and Vercel support.

144,923 stars
Complexity: easy

About this skill

This skill provides comprehensive information about Bun, the modern all-in-one JavaScript and TypeScript toolkit. It covers Bun's roles as a high-performance runtime, efficient package manager, rapid bundler, and integrated test runner. The skill details when to strategically choose Bun over Node.js for new projects, performance-critical scripts, or specific deployment environments like Vercel. It also provides essential considerations for migrating existing projects from Node.js to Bun and notes on Vercel platform compatibility. This knowledge empowers an AI agent to offer informed recommendations, generate appropriate code, and assist users with adopting, debugging, or configuring Bun in their development workflows.

Best use case

Guiding developers on adopting Bun, assisting with Bun vs. Node.js technology choices, generating Bun-specific commands, troubleshooting Bun setups, and configuring Bun for deployments like Vercel.

Bun as runtime, package manager, bundler, and test runner. When to choose Bun vs Node, migration notes, and Vercel support.

An AI agent that can intelligently discuss Bun, recommend its use cases, explain its benefits and drawbacks compared to Node.js, assist with migration considerations, provide Bun commands, or generate configuration snippets relevant to Bun (e.g., for Vercel).

Practical example

Example input

Explain Bun and when I should consider using it over Node.js for a new project.

Example output

Bun is a fast all-in-one JavaScript and TypeScript toolkit that includes a runtime, package manager, bundler, and test runner. You should prefer Bun for new projects when:

1.  **Speed is Critical:** Bun offers significantly faster startup, install, and execution times, beneficial for development cycles and serverless functions.
2.  **Unified Toolchain:** It simplifies your setup by combining `npm`/`yarn`, `webpack`/`esbuild`, and `jest`/`vitest` into a single tool.
3.  **Vercel Deployments:** Bun is officially supported on Vercel, making it a great choice for deploying high-performance web applications.
4.  **New JS/TS Projects:** If you're starting fresh, Bun provides a modern, performant foundation.

You might prefer Node.js if:
1.  **Ecosystem Compatibility:** You rely heavily on specific legacy Node.js modules or tools that haven't been tested or proven compatible with Bun.
2.  **Mature Tooling:** Your project requires the most mature and widely adopted tools with extensive community support.

To set up a new TypeScript project with Bun for Vercel, you could start with:
`bun init -y`
This will create a `package.json` and a basic `index.ts`. You can then develop your application and deploy it to Vercel, which will automatically detect and use the Bun runtime if specified or implicitly by `bun.lockb`.

When to use this skill

  • When starting new JavaScript/TypeScript projects or scripts where installation and execution speed are critical.
  • When seeking a unified toolchain for running, installing, testing, and building JavaScript/TypeScript applications.
  • For Vercel deployments that leverage Bun's runtime capabilities.
  • When migrating existing projects from Node.js to Bun.

When not to use this skill

  • For projects requiring maximum compatibility with the Node.js ecosystem or legacy tooling that explicitly depends on Node.js specifics.
  • When project dependencies have known or unresolved compatibility issues with Bun.
  • In environments where Node.js's mature ecosystem and extensive module support are non-negotiable.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/bun-runtime/SKILL.md --create-dirs "https://raw.githubusercontent.com/affaan-m/everything-claude-code/main/.agents/skills/bun-runtime/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/bun-runtime/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How bun-runtime Compares

Feature / Agentbun-runtimeStandard Approach
Platform SupportClaudeLimited / Varies
Context Awareness High Baseline
Installation ComplexityeasyN/A

Frequently Asked Questions

What does this skill do?

Bun as runtime, package manager, bundler, and test runner. When to choose Bun vs Node, migration notes, and Vercel support.

Which AI agents support this skill?

This skill is designed for Claude.

How difficult is it to install?

The installation complexity is rated as easy. You can find the installation instructions above.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Bun Runtime

Bun is a fast all-in-one JavaScript runtime and toolkit: runtime, package manager, bundler, and test runner.

## When to Use

- **Prefer Bun** for: new JS/TS projects, scripts where install/run speed matters, Vercel deployments with Bun runtime, and when you want a single toolchain (run + install + test + build).
- **Prefer Node** for: maximum ecosystem compatibility, legacy tooling that assumes Node, or when a dependency has known Bun issues.

Use when: adopting Bun, migrating from Node, writing or debugging Bun scripts/tests, or configuring Bun on Vercel or other platforms.

## How It Works

- **Runtime**: Drop-in Node-compatible runtime (built on JavaScriptCore, implemented in Zig).
- **Package manager**: `bun install` is significantly faster than npm/yarn. Lockfile is `bun.lock` (text) by default in current Bun; older versions used `bun.lockb` (binary).
- **Bundler**: Built-in bundler and transpiler for apps and libraries.
- **Test runner**: Built-in `bun test` with Jest-like API.

**Migration from Node**: Replace `node script.js` with `bun run script.js` or `bun script.js`. Run `bun install` in place of `npm install`; most packages work. Use `bun run` for npm scripts; `bun x` for npx-style one-off runs. Node built-ins are supported; prefer Bun APIs where they exist for better performance.

**Vercel**: Set runtime to Bun in project settings. Build: `bun run build` or `bun build ./src/index.ts --outdir=dist`. Install: `bun install --frozen-lockfile` for reproducible deploys.

## Examples

### Run and install

```bash
# Install dependencies (creates/updates bun.lock or bun.lockb)
bun install

# Run a script or file
bun run dev
bun run src/index.ts
bun src/index.ts
```

### Scripts and env

```bash
bun run --env-file=.env dev
FOO=bar bun run script.ts
```

### Testing

```bash
bun test
bun test --watch
```

```typescript
// test/example.test.ts
import { expect, test } from "bun:test";

test("add", () => {
  expect(1 + 2).toBe(3);
});
```

### Runtime API

```typescript
const file = Bun.file("package.json");
const json = await file.json();

Bun.serve({
  port: 3000,
  fetch(req) {
    return new Response("Hello");
  },
});
```

## Best Practices

- Commit the lockfile (`bun.lock` or `bun.lockb`) for reproducible installs.
- Prefer `bun run` for scripts. For TypeScript, Bun runs `.ts` natively.
- Keep dependencies up to date; Bun and the ecosystem evolve quickly.

Related Skills

workspace-surface-audit

144923
from affaan-m/everything-claude-code

Audit the active repo, MCP servers, plugins, connectors, env surfaces, and harness setup, then recommend the highest-value ECC-native skills, hooks, agents, and operator workflows. Use when the user wants help setting up Claude Code or understanding what capabilities are actually available in their environment.

DevelopmentClaude

safety-guard

144923
from affaan-m/everything-claude-code

Use this skill to prevent destructive operations when working on production systems or running agents autonomously.

DevelopmentClaude

repo-scan

144923
from affaan-m/everything-claude-code

Cross-stack source code asset audit — classifies every file, detects embedded third-party libraries, and delivers actionable four-level verdicts per module with interactive HTML reports.

DevelopmentClaude

project-flow-ops

144923
from affaan-m/everything-claude-code

Operate execution flow across GitHub and Linear by triaging issues and pull requests, linking active work, and keeping GitHub public-facing while Linear remains the internal execution layer. Use when the user wants backlog control, PR triage, or GitHub-to-Linear coordination.

DevelopmentClaude

manim-video

144923
from affaan-m/everything-claude-code

Build reusable Manim explainers for technical concepts, graphs, system diagrams, and product walkthroughs, then hand off to the wider ECC video stack if needed. Use when the user wants a clean animated explainer rather than a generic talking-head script.

DevelopmentClaude

laravel-plugin-discovery

144923
from affaan-m/everything-claude-code

Discover and evaluate Laravel packages via LaraPlugins.io MCP. Use when the user wants to find plugins, check package health, or assess Laravel/PHP compatibility.

DevelopmentClaude

design-system

144923
from affaan-m/everything-claude-code

Use this skill to generate or audit design systems, check visual consistency, and review PRs that touch styling.

DevelopmentClaude

click-path-audit

144923
from affaan-m/everything-claude-code

Trace every user-facing button/touchpoint through its full state change sequence to find bugs where functions individually work but cancel each other out, produce wrong final state, or leave the UI in an inconsistent state. Use when: systematic debugging found no bugs but users report broken buttons, or after any major refactor touching shared state stores.

DevelopmentClaude

ck

144923
from affaan-m/everything-claude-code

Persistent per-project memory for Claude Code. Auto-loads project context on session start, tracks sessions with git activity, and writes to native memory. Commands run deterministic Node.js scripts — behavior is consistent across model versions.

DevelopmentClaude

canary-watch

144923
from affaan-m/everything-claude-code

Use this skill to monitor a deployed URL for regressions after deploys, merges, or dependency upgrades.

DevelopmentClaude

benchmark

144923
from affaan-m/everything-claude-code

Use this skill to measure performance baselines, detect regressions before/after PRs, and compare stack alternatives.

DevelopmentClaude

swiftui-patterns

144923
from affaan-m/everything-claude-code

SwiftUI 架构模式,使用 @Observable 进行状态管理,视图组合,导航,性能优化,以及现代 iOS/macOS UI 最佳实践。

DevelopmentClaude