Skip to content
bun-package-manager logo

Bun Package Manager Expert

bun-package-manager

Use when installing dependencies, managing workspaces, or configuring Bun's package manager (bun install, bun add, bun remove, bun update). Invoke for dependency management, monorepos, lockfile issues, or npm/yarn migration.

mattnigh/skills_collection0installs24stars

SKILL.md

Full skill instructions

Bun Package Manager Expert

Purpose

Expert knowledge of Bun's package manager. Covers dependency installation, workspaces/​monorepos, lockfile management, and npm/​yarn/​pnpm migration. 25x faster than npm, 6x faster than pnpm.

When to Use

Invoke this skill when:

  • Installing packages (bun install, bun add)
  • Managing workspaces/​monorepos
  • Configuring package manager settings
  • Troubleshooting lockfile issues (bun.lockb)
  • Migrating from npm, yarn, or pnpm
  • Setting up private registries
  • Managing global packages
  • Optimizing install performance

Documentation Available

Location: /​Users/​zach/​Documents/​cc-skills/​docs/​bun/​install/

Coverage (23 files):

  • Package installation commands
  • Workspaces and monorepos
  • Lock file (bun.lockb binary format)
  • Package.json configuration
  • npmrc and registry configuration
  • Dependency overrides and patches
  • Global cache management
  • Lifecycle scripts
  • Trusted dependencies

Related Skills

  • bun-runtime: For running installed packages
  • bun-test: For installing test dependencies
  • bun-bundler: For bundling with dependencies

Best Practices

  • Use bun.lockb - Binary lockfile is 10x smaller and faster
  • Enable workspaces - For monorepo management
  • Use --production - Skip devDependencies in production
  • Leverage global cache - Shared across projects
  • Pin versions - Use exact versions in package.json
  • Use bun update --latest - Update to latest versions safely
  • Configure registry - For private packages

Examples

Example 1: Basic Package Management

Question: "How do I install and manage packages?"

Response:

# Install all dependencies from package.json
bun install

# Add a package
bun add react

# Add dev dependency
bun add --dev typescript

# Add specific version
bun add [email protected]

# Add global package
bun add --global typescript

# Remove package
bun remove react

# Update all packages
bun update

# Update to latest (ignoring semver)
bun update --latest

# Install from specific registry
bun install --registry https://registry.example.com

Performance: Bun install is 25x faster than npm!

References:

  • See: docs/​bun/​install/​install.md
  • See: docs/​bun/​install/​add.md

Example 2: Workspaces (Monorepo)

Question: "How do I set up a monorepo with workspaces?"

Response:

Project structure:

my-monorepo/
├── package.json
├── packages/
│   ├── app/
│   │   └── package.json
│   ├── ui/
│   │   └── package.json
│   └── utils/
│       └── package.json

Root package.json:

{
  "name": "my-monorepo",
  "workspaces": ["packages/​*"]
}

packages/​app/​package.json:

{
  "name": "@myorg/​app",
  "dependencies": {
    "@myorg/​ui": "workspace:*",
    "@myorg/​utils": "workspace:*",
    "react": "^18.2.0"
  }
}

Install all workspace dependencies:

bun install

Run commands in workspace:

# Run in specific workspace
bun --filter @myorg/​app run dev

# Run in all workspaces
bun --filter '*' run build

# Install in specific workspace
bun --filter @myorg/​app add lodash

References:

  • See: docs/​bun/​install/​workspaces.md

Example 3: Lockfile Management

Question: "What is bun.lockb and how do I use it?"

Response:

bun.lockb is Bun's binary lockfile:

  • 10x smaller than package-lock.json
  • Faster to read/​write
  • Git-friendly (designed for version control)
  • Deterministic installs

Lockfile operations:

# Generate lockfile
bun install

# Update lockfile
bun install --force

# Print lockfile (human-readable)
bun install --dry-run

# Ignore lockfile (not recommended)
bun install --no-save

# Check lockfile integrity
bun pm ls

Commit lockfile to version control:

git add bun.lockb
git commit -m "Update dependencies"

References:

  • See: docs/​bun/​install/​lockfile.md

Example 4: Private Registry

Question: "How do I use a private npm registry?"

Response:

Method 1: .npmrc file

# .npmrc
registry=https://registry.example.com
//registry.example.com/:_authToken=${NPM_TOKEN}

Method 2: bunfig.toml

# bunfig.toml
[install]
registry = "https://registry.example.com"

[install.registry]
url = "https://registry.example.com"
token = "${NPM_TOKEN}"

Method 3: Command line

bun install --registry https://registry.example.com

Scoped packages:

# .npmrc
@myorg:registry=https://registry.example.com

References:

  • See: docs/​bun/​install/​registry.md

Example 5: Dependency Overrides

Question: "How do I override a transitive dependency?"

Response:

Using overrides in package.json:

{
  "name": "my-app",
  "dependencies": {
    "some-package": "^1.0.0"
  },
  "overrides": {
    "vulnerable-dep": "2.0.0"
  }
}

Using resolutions (Yarn compat):

{
  "name": "my-app",
  "resolutions": {
    "lodash": "4.17.21"
  }
}

Install with overrides:

bun install

References:

  • See: docs/​bun/​install/​overrides.md

Configuration

bunfig.toml

# bunfig.toml
[install]
# Production mode (skip devDependencies)
production = false

# Peer dependencies behavior
peer = true

# Concurrent download limit
concurrent = 10

# Registry configuration
registry = "https://registry.npmjs.org"

# Cache directory
cache = "~/​.bun/​install/​cache"

# Lockfile path
lockfile = "bun.lockb"

# Frozen lockfile (CI mode)
frozenLockfile = false

Global Cache

Bun uses a global cache shared across all projects:

# Cache location
~/​.bun/​install/​cache

# Clear cache
rm -rf ~/​.bun/​install/​cache

# View cache size
du -sh ~/​.bun/​install/​cache

Benefits:

  • Faster installs - Reuse already downloaded packages
  • Save disk space - No duplication across projects
  • Offline installs - Work without network

Lifecycle Scripts

Bun runs npm lifecycle scripts automatically:

{
  "scripts": {
    "preinstall": "echo 'Before install'",
    "install": "echo 'During install'",
    "postinstall": "echo 'After install'",
    "prepare": "echo 'Before publish'"
  }
}

Run scripts:

bun run build       # Run custom script
bun run test        # Run test script
bun install         # Runs pre/​post install scripts

Migration from npm/​yarn

From npm:

# Remove npm artifacts
rm -rf node_modules package-lock.json

# Install with Bun
bun install

# Commit new lockfile
git add bun.lockb

From yarn:

# Remove yarn artifacts
rm -rf node_modules yarn.lock

# Install with Bun
bun install

# Workspaces work the same!

Compatibility:

  • ✅ package.json (100% compatible)
  • ✅ Workspaces (compatible with npm/​yarn/​pnpm)
  • ✅ .npmrc (fully supported)
  • ✅ Lifecycle scripts
  • ⚠️ Lockfile format different (bun.lockb vs package-lock.json)

Search Helpers

# Find install docs
grep -r "install\|add\|remove" docs/​bun/​install/

# Find workspace docs
grep -r "workspace\|monorepo" docs/​bun/​install/

# Find lockfile docs
grep -r "lockfile\|bun.lockb" docs/​bun/​install/

# List all package manager docs
ls docs/​bun/​install/

Common Issues

  • Lockfile conflicts: Different Bun versions generated lockfile

    • Solution: Update Bun, regenerate with bun install --force
  • Peer dependency warnings: Package requires peer deps

    • Solution: Install peer dependencies or use --ignore-peer-dependencies
  • Private registry auth: 401 Unauthorized

    • Solution: Check .npmrc, verify token
  • Slow installs: Network issues or registry problems

    • Solution: Check network, try different registry

Performance Benchmarks

OperationnpmyarnpnpmBun
Cold install30s20s15s1.2s
Warm install20s12s8s0.5s
With lockfile15s10s6s0.3s

Bun is 25x faster than npm!

Notes

  • Documentation covers latest Bun version
  • bun.lockb is a binary format (not human-readable)
  • Bun caches packages globally (~/​.bun/​install/​cache)
  • File paths reference local documentation cache
  • For latest updates, check https://bun.sh/docs/cli/install

More skills from mattnigh

spring-framework-patterns logo
mattnigh/skills_collection

spring-framework-patterns

Comprehensive Spring Framework and Spring Boot best practices including dependency injection patterns, bean lifecycle and scopes, REST API development, Spring Data JPA, service layer design, Spring Security, testing strategies, caching, AOP, async processing, error handling, and common anti-patte...

24 0
View

TypeScript厳格モードによる型安全性設計を専門とするスキル。 📖 参照書籍: - 『Effective TypeScript』(Dan Vanderkam): 型設計 📚 リソース参照: - `resources/Level1_basics.md`: レベル1の基礎ガイド - `resources/Level2_intermediate.md`: レベル2の実務ガイド - `resources/Level3_advanced.md`: レベル3の応用ガイド - `resources/Level4_expert.md`: レベル4の専門ガイド - `resources/di...

24 0
View
deploying-cloud-k8s logo
mattnigh/skills_collection

deploying-cloud-k8s

Deploys applications to cloud Kubernetes (AKS/GKE/DOKS) with CI/CD pipelines. Use when deploying to production, setting up GitHub Actions, troubleshooting deployments. Covers build-time vs runtime vars, architecture matching, and battle-tested debugging.

24 0
View
moai-alfred-agent-guide logo
mattnigh/skills_collection

moai-alfred-agent-guide

19-agent team structure, decision trees for agent selection, Haiku vs Sonnet model selection, and agent collaboration principles. Use when deciding which sub-agent to invoke, understanding team responsibilities, or learning multi-agent orchestration.

24 0
View
mermaid-diagram-generator logo
mattnigh/skills_collection

mermaid-diagram-generator

Converts architecture descriptions, module specs, or workflow docs into Mermaid diagrams. Use when visualizing brick module relationships, workflows (DDD, investigation), or system architecture. Supports: flowcharts, sequence diagrams, class diagrams, state machines, entity relationship diagrams,...

24 0
View
pre-flight-check logo
mattnigh/skills_collection

pre-flight-check

INVOKE FIRST before any code work. Validates git workflow (branch, issue, worklog) and checks approach. Use at START of every task and END before completing. Prevents skipped steps.

24 0
View
browser-dev-tools logo
mattnigh/skills_collection

browser-dev-tools

This skill should be used when working with browser-rendered artifacts (i.e. Bun, React/React Native) to proactively validate that development work on localhost is being built appropriately and to support debugging browser-rendered content. Use this skill after making frontend changes to verify t...

24 0
View
lead-dev logo
mattnigh/skills_collection

lead-dev

Lead Développeur - Coordination technique opérationnelle, code review, mentoring et livraison. Pair de web-dev-process au niveau OPÉRATIONS.

24 0
View
worker-monitor logo
mattnigh/skills_collection

worker-monitor

Monitor Docker workers, RQ queue health, and auto-scale workers (max 4). Use when: checking job progress, monitoring queue depth, scaling workers up/down, diagnosing slow processing, or waiting for jobs to complete. Referenced by data-quality skill during reprocessing.

24 0
View
quality-advisor logo
mattnigh/skills_collection

quality-advisor

Proactive quality guidance system that monitors artifact creation and provides real-time feedback on documentation quality

24 0
View
bump-version logo
mattnigh/skills_collection

bump-version

This skill should be used when the user wants to bump the version number in the workspace. It updates versions across all pyproject.toml files (root, tde, and tda packages) and the CHANGELOG.md to keep them synchronized.

24 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View