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.
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 verified
- Yes
- SHA-256
- d9c1c744531414228b49e8915b9cf9d652c874f79cb3845e8b2bc2d9d4dac381
- Skill type
- general
- Skill level
- advanced
- Verification
- draft
- Verified at
- 2025-10-23
| Platform | Support | Install path |
|---|---|---|
| claude-code | Native | .claude/skills/<skill-name>/SKILL.md |
| codex | Native | .agents/skills/<skill-name>/SKILL.md |
| windsurf | Native | .windsurf/skills/<skill-name>/SKILL.md |
| gemini | Native | .gemini/skills/<skill-name>/SKILL.md or .agents/skills/<skill-name>/SKILL.md |
| cursor | Adapter | .cursor/rules/<skill-name>.mdc |
| cli | Manual | AGENTS.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.mdcontent as reusable workflow instructions.
Manual Adaptation
- Gemini CLI: native skill usage via
.gemini/skills/<skill-name>/SKILL.mdor.agents/skills/<skill-name>/SKILL.mdwhere supported. - Cursor: use the generated
.cursor/rules/*.mdcadapter 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:
- Use Bun.serve() with fetch handler
- Implement routing with URL patterns
- Add CORS headers
- Serve static files with Bun.file()
- Set up WebSocket upgrade
- Handle errors gracefully
- 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:
- Parse args with Bun.argv
- Use chalk for colors
- Add ora for spinners
- Implement inquirer prompts
- Process files with Bun.file()
- Use Bun.spawn() for parallel
- 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:
- Use bun:sqlite module
- Set up connection pool
- Create prepared statements
- Implement migration system
- Build query builder
- Add transaction support
- 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:
- Write tests with bun:test
- Use expect assertions
- Mock with spyOn
- Configure coverage
- Run tests in parallel
- Add before/after hooks
- Test HTTP endpoints
Tips for Best Results
Use Bun APIs: Prefer
Bun.file()overfs,Bun.serve()over http module. Bun's APIs are optimized and simpler.Native TypeScript: No need for ts-node or build step. Bun runs TypeScript natively. Use .ts extensions directly.
Built-in Bundler: Use
bun buildinstead of webpack/esbuild. Single-command bundling with tree-shaking.Fast Package Manager: Run
bun installinstead of npm/pnpm. Uses global cache and parallel downloads.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
Source citations
Signals
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.