Skip to main content
skillsFirst-partyReview first Safety · Privacy ·

Bun JavaScript Runtime Development Skill

Build high-performance JavaScript and TypeScript applications with Bun, the all-in-one runtime that's 3x faster than Node.js. Includes native TypeScript execution, built-in bundler, test runner, and package manager in a single binary.

by JSONbored·added 2025-10-23·
Claude CodeCodexWindsurfGeminiCursorCLI
HarnessClaude CodeCodexWindsurfGeminiCursorCLI
Level:advancedType:generalVerified:draft
Review first review before installing

Open the source and read safety notes before installing.

Prerequisites

  • Bun 1.0+
  • macOS/Linux/WSL
  • curl or wget for installation
  • Basic JavaScript/TypeScript knowledge
  • Bun runtime installed (curl -fsSL https://bun.sh/install | bash or npm install -g bun)
  • Node.js-compatible project structure with package.json for dependency management and module resolution

Schema details

Install type
package
Reading time
4 min
Difficulty score
100
Troubleshooting
Yes
Breaking changes
No
Package metadata
Package verified
Yes
SHA-256
d9c1c744531414228b49e8915b9cf9d652c874f79cb3845e8b2bc2d9d4dac381
Skill and platform metadata
Skill type
general
Skill level
advanced
Verification
draft
Verified at
2025-10-23
Retrieval sources
https://bun.sh/docs
Tested platforms
ClaudeCodexOpenClawCursorWindsurfGemini
PlatformSupportInstall path
claude-codeNative.claude/skills/<skill-name>/SKILL.md
codexNative.agents/skills/<skill-name>/SKILL.md
windsurfNative.windsurf/skills/<skill-name>/SKILL.md
geminiNative.gemini/skills/<skill-name>/SKILL.md or .agents/skills/<skill-name>/SKILL.md
cursorAdapter.cursor/rules/<skill-name>.mdc
cliManualAGENTS.md or tool-specific context file
Full copyable content
const server = Bun.serve({
  port: 3000,
  async fetch(req) {
    const url = new URL(req.url);
    
    // Route handling
    if (url.pathname === '/') {
      return new Response('Hello from Bun!');
    }
    
    if (url.pathname === '/api/users') {
      const users = await getUsers();
      return Response.json(users);
    }
    
    // Static file serving
    if (url.pathname.startsWith('/static/')) {
      const file = Bun.file(`.${url.pathname}`);
      return new Response(file);
    }
    
    return new Response('Not Found', { status: 404 });
  },
});

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

About this resource

What This Skill Enables

Claude can build and deploy JavaScript/TypeScript applications using Bun, the all-in-one JavaScript runtime that's 3x faster than Node.js for package installs and startup time. Bun includes a native bundler, test runner, package manager, and TypeScript transpiler in a single binary. From APIs to CLIs to build tools, Bun provides drop-in Node.js compatibility with modern performance.

Compatibility

Native

  • Claude Code / Claude: native skill usage via SKILL.md.
  • Codex/OpenAI workflows: compatible with Agent Skills-style SKILL.md content as reusable workflow instructions.

Manual Adaptation

  • Gemini CLI: native skill usage via .gemini/skills/<skill-name>/SKILL.md or .agents/skills/<skill-name>/SKILL.md where supported.
  • Cursor: use the generated .cursor/rules/*.mdc adapter for project rules.
  • OpenClaw and similar agents: use the same skill content as a reusable prompt/workflow file when native skill import is unavailable.

Prerequisites

Required:

  • Claude Pro subscription or Claude Code CLI
  • macOS, Linux, or WSL (Windows support in beta)
  • curl or wget for installation
  • Basic JavaScript/TypeScript knowledge

What Claude handles automatically:

  • Writing Bun-optimized server code
  • Configuring bun:test for testing
  • Setting up Bun.serve() for HTTP servers
  • Using Bun.build() for bundling
  • Implementing file operations with Bun.file()
  • Adding WebSocket support
  • Configuring environment variables
  • Optimizing for Bun's performance characteristics

How to Use This Skill

High-Performance HTTP Server

Prompt: "Create Bun HTTP server with: REST API routes, JSON parsing, CORS middleware, static file serving, WebSocket support, and error handling. Optimize for maximum req/sec."

Claude will:

  1. Use Bun.serve() with fetch handler
  2. Implement routing with URL patterns
  3. Add CORS headers
  4. Serve static files with Bun.file()
  5. Set up WebSocket upgrade
  6. Handle errors gracefully
  7. Benchmark with wrk/autocannon

CLI Tool Development

Prompt: "Build CLI tool with Bun for: file processing, progress bars, colored output, interactive prompts, and parallel operations. Package as standalone binary."

Claude will:

  1. Parse args with Bun.argv
  2. Use chalk for colors
  3. Add ora for spinners
  4. Implement inquirer prompts
  5. Process files with Bun.file()
  6. Use Bun.spawn() for parallel
  7. Build executable with bun build

Database Operations

Prompt: "Create Bun app with SQLite using bun:sqlite. Include: connection pooling, prepared statements, migrations, and query builder pattern."

Claude will:

  1. Use bun:sqlite module
  2. Set up connection pool
  3. Create prepared statements
  4. Implement migration system
  5. Build query builder
  6. Add transaction support
  7. Handle errors and cleanup

Testing with Bun

Prompt: "Set up Bun testing for API with: unit tests, integration tests, mocking, coverage reporting, and parallel execution."

Claude will:

  1. Write tests with bun:test
  2. Use expect assertions
  3. Mock with spyOn
  4. Configure coverage
  5. Run tests in parallel
  6. Add before/after hooks
  7. Test HTTP endpoints

Tips for Best Results

  1. Use Bun APIs: Prefer Bun.file() over fs, Bun.serve() over http module. Bun's APIs are optimized and simpler.

  2. Native TypeScript: No need for ts-node or build step. Bun runs TypeScript natively. Use .ts extensions directly.

  3. Built-in Bundler: Use bun build instead of webpack/esbuild. Single-command bundling with tree-shaking.

  4. Fast Package Manager: Run bun install instead of npm/pnpm. Uses global cache and parallel downloads.

  5. WebSocket Native: Bun.serve() includes WebSocket upgrade. No need for ws or socket.io for simple cases.

Common Workflows

REST API Backend

"Build production REST API with Bun:
1. HTTP server with Bun.serve() and routing
2. JWT authentication middleware
3. Database with bun:sqlite or Postgres
4. Request validation with Zod
5. Rate limiting with in-memory store
6. File uploads with Bun.file()
7. WebSocket for real-time updates
8. Docker deployment with bun:alpine"

Build Tool Development

"Create build tool with Bun:
1. File watching with Bun.watch()
2. Bundling with Bun.build()
3. TypeScript transpilation (automatic)
4. Minification and tree-shaking
5. Source maps generation
6. Plugin system for transforms
7. Parallel file processing
8. Cache invalidation"

Microservices Infrastructure

"Build microservices with Bun:
1. Service discovery with etcd
2. gRPC communication
3. Health checks endpoint
4. Metrics collection
5. Structured logging
6. Graceful shutdown
7. Docker containers
8. Kubernetes deployment"

Troubleshooting

Issue: "Node.js package not working in Bun" Solution: Check Bun compatibility at bun.sh/docs. Most npm packages work. For native modules, ensure Bun version supports Node-API. Use --bun flag or check package.json engines field.

Issue: "Performance not better than Node.js" Solution: Ensure using Bun APIs (Bun.serve not http). Check CPU-bound vs I/O-bound. Bun excels at I/O. Profile with bun:jsc. Verify using latest Bun version.

Issue: "TypeScript types not working" Solution: Install @types packages with bun add -d. Check bunfig.toml has correct compilerOptions. Use bun-types for Bun APIs. Restart editor/LSP.

Learn More

Features

  • 3x faster package installs with global cache
  • Native TypeScript support without transpilation
  • Built-in bundler, test runner, and package manager
  • Drop-in Node.js compatibility for most packages
  • Built-in SQLite database support via bun:sqlite
  • WebSocket support integrated in Bun.serve()
  • Security scanner API for supply chain protection
  • Built-in package manager and bundler with npm-compatible package.json support, fast dependency resolution, and zero-config bundling for modern JavaScript applications

Use Cases

  • High-performance HTTP servers with Bun.serve()
  • CLI tools with fast startup times
  • Build tools with native bundling
  • Microservices with fast startup and low memory footprint
  • Real-time applications with WebSocket support
  • Database-driven applications with built-in SQLite
#bun#runtime#javascript#typescript#performance

Source citations

Signals

Loading live community signals…

More like this, weekly

A short, calm digest of reviewed Claude resources. Unsubscribe any time.