bun-development

v2026.09.24

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.

GitHub
安装命令
npx skhub add laurigates/bun-development
Markdown
SKILL.md

Bun Development

When to Use This Skill

ScenarioUse this skillAlternative
Running scripts with Bun runtimeYesnodejs-development for Node.js-specific runtime
Running Bun tests with bun testYesbun-test for quick invocable test runs
Bundling/building with BunYesbun-build for quick invocable builds
Initializing a new Bun projectYesnodejs-development for Vite/Vue scaffolding
Compiling to standalone executableYesN/A
Installing or managing dependenciesNo - use bun-package-managerbun-add for quick package additions
Publishing packages to npmNo - use bun-publishingN/A
Debugging TypeScript/JS codeNo - use typescript-debuggingN/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

# Run package.json script
bun run <script>

# Run file directly
bun <file.ts>

# Silent mode (no script echo)
bun run --silent <script>

Watch Mode

# Auto-restart on changes
bun --watch run dev

# Hot reload (preserve state)
bun --hot run dev

Workspace Scripts

# Run in matching workspaces
bun run --filter 'package-*' build

# Run in all workspaces
bun run --workspaces test

# Limit output per workspace
bun run --filter '*' --elide-lines=5 build

Execute Packages (bunx)

# Execute package binary (like npx)
bunx <package>

# Specific version
bunx typescript@5.0 --help

# When binary differs from package
bunx -p @angular/cli ng new app

# Force Bun runtime
bunx --bun vite dev

Testing

Basic Test Execution

# Run all tests
bun test

# Run specific file
bun test tests/auth.test.ts

# Filter by name
bun test -t "login"

Compact Output (Agentic)

# Minimal dots reporter
bun test --dots

# Fail fast
bun test --bail
bun test --bail=3  # Stop after 3 failures

# Combine for quick feedback
bun test --dots --bail=1

CI/CD Output

# JUnit XML (most CI systems)
bun test --reporter=junit --reporter-outfile=junit.xml

# GitHub Actions (auto-detected in CI)
# Produces annotations automatically
bun test

Coverage

# Enable coverage
bun test --coverage

# LCOV format for tools
bun test --coverage --coverage-reporter=lcov

Test Configuration

# Custom timeout
bun test --timeout=10000

# Run concurrently
bun test --concurrent

# Limit concurrency
bun test --max-concurrency=5

# Detect flaky tests
bun test --rerun-each=3

Building

Bundle JavaScript/TypeScript

# Basic bundle
bun build ./src/index.ts --outdir=dist

# Production build
bun build ./src/index.ts --outdir=dist --minify --sourcemap=external

# Watch mode
bun build ./src/index.ts --outdir=dist --watch

Build Targets

# Browser (default)
bun build ./src/index.ts --target=browser

# Bun runtime
bun build ./src/index.ts --target=bun

# Node.js
bun build ./src/index.ts --target=node

Compile to Executable

# Standalone binary
bun build --compile ./app.ts --outfile myapp

# Minified standalone
bun build --compile --minify ./app.ts --outfile myapp

# Cross-compile
bun build --compile --target=bun-linux-x64 ./app.ts

Code Splitting

# Enable splitting
bun build ./src/index.ts --outdir=dist --splitting

Project Initialization

Quick Init

# Interactive blank project
bun init

# With template
bun init --react my-app
bun init --react=tailwind my-app

Create from Template

# From npm/GitHub
bun create vite my-project
bun create hono@latest my-api

# From GitHub repo
bun create <user>/<repo> destination

Agentic Optimizations

ContextCommand
Quick testbun test --dots --bail=1
CI testbun test --reporter=junit --reporter-outfile=junit.xml
Coveragebun test --coverage --coverage-reporter=lcov
Silent runbun run --silent <script>
Watch devbun --watch run dev
Prod buildbun build --minify --sourcemap=external --outdir=dist
Compilebun build --compile --minify ./app.ts
Memory savebun run --smol <script>

Quick Reference

bun run

FlagDescription
--watchAuto-restart on changes
--hotHot reload
--silentSuppress script echo
--filterRun in matching workspaces
--smolReduce memory usage

bun test

FlagDescription
--dotsCompact dot reporter
--bail / --bail=NStop after N failures
--coverageEnable coverage
--timeout=<ms>Per-test timeout
--reporter=junitJUnit XML output
-t <pattern>Filter by test name
--concurrentParallel async tests

bun build

FlagDescription
--outdirOutput directory
--outfileOutput file (single/compile)
--minifyMinify output
--sourcemapnone/inline/external
--targetbrowser/bun/node
--compileStandalone executable
--splittingEnable code splitting
--watchWatch mode

Environment Variables

VariableDescription
BUN_OPTIONSGlobal CLI flags
NODE_ENVEnvironment (production/development)
发现
标签

此技能尚未发布标签。

版本
最新版本元数据

版本

v2026.09.24

发布时间

Sep 24, 2026

分类

未分类

许可证

MIT

源路径

typescript-plugin/skills/bun-development

默认分支

main

最新提交

1668324

Tree SHA

b2d4cc3