| name | bun-development |
| description | Bun runtime workflows for running scripts, testing, building, and initializing projects with agent-optimized flags. Use when running a TS file, watch/hot reload, configuring `bun test`, bundling/compiling, or scaffolding a Bun project. |
| user-invocable | false |
| allowed-tools | Bash, BashOutput, Read, Write, Edit, Grep, Glob, TodoWrite |
| created | "2025-12-20T00:00:00.000Z" |
| modified | "2026-05-09T00:00:00.000Z" |
| reviewed | "2025-12-20T00:00:00.000Z" |
Bun Development
When to Use This Skill
| Scenario | Use this skill | Alternative |
|---|
| Running scripts with Bun runtime | Yes | nodejs-development for Node.js-specific runtime |
Running Bun tests with bun test | Yes | bun-test for quick invocable test runs |
| Bundling/building with Bun | Yes | bun-build for quick invocable builds |
| Initializing a new Bun project | Yes | nodejs-development for Vite/Vue scaffolding |
| Compiling to standalone executable | Yes | N/A |
| Installing or managing dependencies | No - use bun-package-manager | bun-add for quick package additions |
| Publishing packages to npm | No - use bun-publishing | N/A |
| Debugging TypeScript/JS code | No - use typescript-debugging | N/A |
Core Expertise
Bun is an all-in-one JavaScript runtime:
- ~6ms startup vs npm's ~170ms
- Native TypeScript execution
- Built-in test runner
- Fast bundler with compile-to-exe
Running Scripts
Basic Execution
bun run <script>
bun <file.ts>
bun run --silent <script>
Watch Mode
bun --watch run dev
bun --hot run dev
Workspace Scripts
bun run --filter 'package-*' build
bun run --workspaces test
bun run --filter '*' --elide-lines=5 build
Execute Packages (bunx)
bunx <package>
bunx typescript@5.0 --help
bunx -p @angular/cli ng new app
bunx --bun vite dev
Testing
Basic Test Execution
bun test
bun test tests/auth.test.ts
bun test -t "login"
Compact Output (Agentic)
bun test --dots
bun test --bail
bun test --bail=3
bun test --dots --bail=1
CI/CD Output
bun test --reporter=junit --reporter-outfile=junit.xml
bun test
Coverage
bun test --coverage
bun test --coverage --coverage-reporter=lcov
Test Configuration
bun test --timeout=10000
bun test --concurrent
bun test --max-concurrency=5
bun test --rerun-each=3
Building
Bundle JavaScript/TypeScript
bun build ./src/index.ts --outdir=dist
bun build ./src/index.ts --outdir=dist --minify --sourcemap=external
bun build ./src/index.ts --outdir=dist --watch
Build Targets
bun build ./src/index.ts --target=browser
bun build ./src/index.ts --target=bun
bun build ./src/index.ts --target=node
Compile to Executable
bun build --compile ./app.ts --outfile myapp
bun build --compile --minify ./app.ts --outfile myapp
bun build --compile --target=bun-linux-x64 ./app.ts
Code Splitting
bun build ./src/index.ts --outdir=dist --splitting
Project Initialization
Quick Init
bun init
bun init --react my-app
bun init --react=tailwind my-app
Create from Template
bun create vite my-project
bun create hono@latest my-api
bun create <user>/<repo> destination
Agentic Optimizations
| Context | Command |
|---|
| Quick test | bun test --dots --bail=1 |
| CI test | bun test --reporter=junit --reporter-outfile=junit.xml |
| Coverage | bun test --coverage --coverage-reporter=lcov |
| Silent run | bun run --silent <script> |
| Watch dev | bun --watch run dev |
| Prod build | bun build --minify --sourcemap=external --outdir=dist |
| Compile | bun build --compile --minify ./app.ts |
| Memory save | bun run --smol <script> |
Quick Reference
bun run
| Flag | Description |
|---|
--watch | Auto-restart on changes |
--hot | Hot reload |
--silent | Suppress script echo |
--filter | Run in matching workspaces |
--smol | Reduce memory usage |
bun test
| Flag | Description |
|---|
--dots | Compact dot reporter |
--bail / --bail=N | Stop after N failures |
--coverage | Enable coverage |
--timeout=<ms> | Per-test timeout |
--reporter=junit | JUnit XML output |
-t <pattern> | Filter by test name |
--concurrent | Parallel async tests |
bun build
| Flag | Description |
|---|
--outdir | Output directory |
--outfile | Output file (single/compile) |
--minify | Minify output |
--sourcemap | none/inline/external |
--target | browser/bun/node |
--compile | Standalone executable |
--splitting | Enable code splitting |
--watch | Watch mode |
Environment Variables
| Variable | Description |
|---|
BUN_OPTIONS | Global CLI flags |
NODE_ENV | Environment (production/development) |