Agent skill

Bun Build

by involvex in involvex/youtube-music-cli

Create optimized production bundles with Bun's native bundler.

MITAuto-check: notesFrontend & Design

Install Bun Build

skills CLI
$ npx skills add involvex/youtube-music-cli --skill bun-build -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install involvex/youtube-music-cli bun-build --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/involvex/youtube-music-cli.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/bun-build .claude/skills/bun-build && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
bun-build
GitHub stars
456
Token cost
~2.1k tokens
SKILL.md length
342 words
Files
4 (incl. references)
Skills in repo
6
Repo updated
First seen
Licence
MIT

At a glance

Create optimized production bundles with Bun's native bundler.

  • Works in 8 steps: Check Prerequisites → Determine Build Requirements → Create Basic Build Script → …
  • Building applications for production
  • SKILL.md covers Quick Reference, Core Workflow, Build Options Reference and Verification, plus 4 more sections
  • Calls bun

What it does

Bun Build is an agent skill from involvex/youtube-music-cli. Create optimized production bundles with Bun's native bundler. Use when building applications for production, optimizing bundle sizes, setting up multi-environment builds, or replacing webpack/esbuild/rollup.

Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/optimization.md`, `references/plugins.md` and `references/targets.md`). Compatibility notes: Requires Bun 1.0+

It sits in Frontend & Design, covering Web performance. It works with webpack, Node.js and YouTube. The repository describes itself as: A powerful Terminal User Interface (TUI) music player for YouTube Music. The licence is MIT.

When your agent uses it

  • Building applications for production
  • Optimizing bundle sizes
  • Setting up multi-environment builds
  • Replacing webpack/esbuild/rollup

Example prompts

  • “/bun-build”

Requirements

  • Node.js
  • Compatibility (from SKILL.md): Requires Bun 1.0+
  • Pre-approved tools (allowed-tools): Bash, Write, Read

Workflow steps

8 steps, taken from the step headings in SKILL.md.

  1. Check Prerequisites
  2. Determine Build Requirements
  3. Create Basic Build Script
  4. Configure for Target Platform
  5. Add Production Optimizations
  6. Environment-Specific Builds
  7. Update package.json
  8. Generate Type Declarations (Libraries)

What it can do on your machine

Read from SKILL.md and the folder at commit a0d4e49. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash
    • Write
    • Read

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • bun

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Requires Bun 1.0+

    From compatibility in the SKILL.md frontmatter.

Context cost

Bun Build loads about 2.1k tokens when it runs, and up to ~6.3k if it reads all its reference files. Until then it costs about 55 tokens; SKILL.md has 342 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~55
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~6.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Bash, Write, Read

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from involvex/youtube-music-cli at commit a0d4e49, republished under its MIT licence (© involvex). 342 words, ~2,110 tokens.

Download SKILL.mdSave it as .claude/skills/bun-build/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
bun-build
description
Create optimized production bundles with Bun's native bundler. Use when building applications for production, optimizing bundle sizes, setting up multi-environment builds, or replacing webpack/esbuild/rollup.
allowed-tools
Bash, Write, Read
compatibility
Requires Bun 1.0+
metadata.author
dale
metadata.category
bun-runtime
metadata.tags
bun, build, bundler, production, optimization

Bun Production Build Configuration

Set up production builds using Bun's native bundler - fast, optimized bundle creation without webpack or esbuild.

Quick Reference

For detailed patterns, see:

  • Build Targets: targets.md - Browser, Node.js, library, CLI configurations
  • Optimization: optimization.md - Tree shaking, code splitting, analysis
  • Plugins: plugins.md - Custom loaders and transformations

Core Workflow

1. Check Prerequisites
bash
# Verify Bun installation
bun --version

# Check project structure
ls -la package.json src/
2. Determine Build Requirements

Ask the user about their build needs:

  • Application Type: Frontend SPA, Node.js backend, CLI tool, or library
  • Target Platform: Browser, Node.js, Bun runtime, or Cloudflare Workers
  • Output Format: ESM (modern), CommonJS (legacy), or both
3. Create Basic Build Script

Create build.ts in project root:

typescript
#!/usr/bin/env bun

const result = await Bun.build({
  entrypoints: ['./src/index.ts'],
  outdir: './dist',
  target: 'browser', // or 'node', 'bun'
  format: 'esm', // or 'cjs', 'iife'
  minify: true,
  splitting: true,
  sourcemap: 'external',
});

if (!result.success) {
  console.error('Build failed');
  for (const message of result.logs) {
    console.error(message);
  }
  process.exit(1);
}

console.log('✅ Build successful');
console.log(`📦 ${result.outputs.length} files generated`);

// Show bundle sizes
for (const output of result.outputs) {
  const size = (output.size / 1024).toFixed(2);
  console.log(`  ${output.path} - ${size} KB`);
}
4. Configure for Target Platform

For Browser/Frontend:

typescript
await Bun.build({
  entrypoints: ['./src/index.tsx'],
  outdir: './dist',
  target: 'browser',
  format: 'esm',
  minify: true,
  splitting: true,
  define: {
    'process.env.NODE_ENV': '"production"',
  },
  loader: {
    '.png': 'file',
    '.svg': 'dataurl',
    '.css': 'css',
  },
});

For Node.js Backend:

typescript
await Bun.build({
  entrypoints: ['./src/server.ts'],
  outdir: './dist',
  target: 'node',
  format: 'esm',
  minify: true,
  external: ['*'], // Don't bundle node_modules
});

For libraries, CLI tools, and other targets, see targets.md.

5. Add Production Optimizations
typescript
await Bun.build({
  entrypoints: ['./src/index.ts'],
  outdir: './dist',
  target: 'browser',

  // Maximum minification
  minify: {
    whitespace: true,
    identifiers: true,
    syntax: true,
  },

  // Code splitting for optimal caching
  splitting: true,

  // Content hashing for cache busting
  naming: {
    entry: '[dir]/[name].[hash].[ext]',
    chunk: 'chunks/[name].[hash].[ext]',
    asset: 'assets/[name].[hash].[ext]',
  },

  // Source maps for debugging
  sourcemap: 'external',
});

For advanced optimizations (tree shaking, bundle analysis, size limits), see optimization.md.

6. Environment-Specific Builds

Create build-env.ts:

typescript
#!/usr/bin/env bun

const env = process.env.NODE_ENV || 'development';

const configs = {
  development: {
    minify: false,
    sourcemap: 'inline',
    define: {
      'process.env.NODE_ENV': '"development"',
      'process.env.API_URL': '"http://localhost:3000"',
    },
  },
  production: {
    minify: true,
    sourcemap: 'external',
    define: {
      'process.env.NODE_ENV': '"production"',
      'process.env.API_URL': '"https://api.example.com"',
    },
  },
};

const config = configs[env as keyof typeof configs];

const result = await Bun.build({
  entrypoints: ['./src/index.ts'],
  outdir: './dist',
  target: 'browser',
  format: 'esm',
  splitting: true,
  ...config,
});

if (!result.success) {
  console.error('❌ Build failed');
  process.exit(1);
}

console.log(`✅ ${env} build successful`);

Run with:

bash
NODE_ENV=production bun run build-env.ts
7. Update package.json

Add build scripts:

json
{
  "scripts": {
    "build": "bun run build.ts",
    "build:dev": "NODE_ENV=development bun run build-env.ts",
    "build:prod": "NODE_ENV=production bun run build-env.ts",
    "build:watch": "bun run build.ts --watch",
    "clean": "rm -rf dist"
  }
}

For libraries, also add:

json
{
  "type": "module",
  "main": "./dist/cjs/index.js",
  "module": "./dist/esm/index.js",
  "types": "./dist/esm/index.d.ts",
  "exports": {
    ".": {
      "import": "./dist/esm/index.js",
      "require": "./dist/cjs/index.js",
      "types": "./dist/esm/index.d.ts"
    }
  },
  "files": ["dist"]
}
8. Generate Type Declarations (Libraries)

For libraries, generate TypeScript declarations:

typescript
// build-lib-with-types.ts
import { $ } from 'bun';

// Build JavaScript
await Bun.build({
  entrypoints: ['./src/index.ts'],
  outdir: './dist',
  target: 'node',
  format: 'esm',
  minify: true,
});

// Generate type declarations
await $`bunx tsc --declaration --emitDeclarationOnly --outDir dist`;

console.log('✅ Built library with type declarations');

Build Options Reference

Target
  • browser: For web applications (includes browser globals)
  • node: For Node.js applications (assumes Node.js APIs)
  • bun: For Bun runtime (optimized for Bun-specific features)
Format
  • esm: ES Modules (modern, tree-shakeable) - Recommended
  • cjs: CommonJS (legacy Node.js)
  • iife: Immediately Invoked Function Expression (browser scripts)
Minification
typescript
minify: true                  // Basic minification
minify: {                     // Granular control
  whitespace: true,
  identifiers: true,
  syntax: true,
}
Source Maps
  • external: Separate .map files (production)
  • inline: Inline in bundle (development)
  • none: No source maps

Verification

After building:

bash
# 1. Check output directory
ls -lh dist/

# 2. Verify bundle size
du -sh dist/*

# 3. Test bundle
bun run dist/index.js

# 4. Check for errors
echo $?  # Should be 0

Common Build Patterns

Watch mode for development:

typescript
import { watch } from 'fs';

async function build() {
  await Bun.build({
    entrypoints: ['./src/index.ts'],
    outdir: './dist',
    minify: false,
  });
}

await build();

watch('./src', { recursive: true }, async (event, filename) => {
  if (filename?.endsWith('.ts')) {
    console.log(`Rebuilding...`);
    await build();
  }
});

Custom asset loaders:

typescript
loader: {
  '.png': 'file',     // Copy file, return path
  '.svg': 'dataurl',  // Inline as data URL
  '.txt': 'text',     // Inline as string
  '.json': 'json',    // Parse and inline
}

For custom plugins and advanced transformations, see plugins.md.

Troubleshooting

Build fails:

typescript
if (!result.success) {
  for (const log of result.logs) {
    console.error(log);
  }
}

Bundle too large: See optimization.md for:

  • Bundle analysis
  • Code splitting
  • Tree shaking
  • Size limits

Module not found: Check external configuration:

typescript
external: ['*']         // Exclude all node_modules
external: ['react']     // Exclude specific packages
external: []            // Bundle everything

Completion Checklist

  • ✅ Build script created
  • ✅ Target platform configured
  • ✅ Minification enabled
  • ✅ Source maps configured
  • ✅ Environment-specific builds set up
  • ✅ Package.json scripts added
  • ✅ Build tested successfully
  • ✅ Bundle size verified

Next Steps

After basic build setup:

  1. Optimization: Add bundle analysis and size limits
  2. CI/CD: Automate builds in your pipeline
  3. Type Checking: Add pre-build type checking
  4. Testing: Run tests before building
  5. Deployment: Integrate with bun-deploy for containerization

For detailed implementations, see the reference files linked above.

© involvex, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in .agents/skills/bun-build of involvex/youtube-music-cli.

  • SKILL.md
  • references/optimization.md
  • references/plugins.md
  • references/targets.md

Open the folder on GitHubat commit a0d4e49

Compare with similar skills

Bun Build next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Bun Build compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Bun Build this skillinvolvex/youtube-music-cli456—~2.1kAutomated safety check: NotesMIT
SEO GoogleAgriciDaniel/codex-seo7872 repos~3.4kAutomated safety check: PassMIT
Core Web VitalsvmDeshpande/ai-agent-automation1784 repos~3.6kAutomated safety check: PassMIT
Dependency Auditagulli/atlas-agents578—~477Automated safety check: PassMIT
Igniteui Wc Optimize Bundle SizeIgniteUI/igniteui-webcomponents170—~3.6kAutomated safety check: PassMIT
Performance ProfilerEliasOulkadi/shokunin114—~2.7kAutomated safety check: NotesMIT

Similar skills

  • SEO Google

    AgriciDaniel/codex-seo

    Google SEO APIs: Search Console (Search Analytics, URL Inspection, Sitemaps), PageSpeed Insights v5, CrUX field data with 25-week history, Indexing API v3, and GA4 organic traffic.

    787 GitHub starsUsed in 2 repos~3.4k tokens
    Frontend & DesignAuto-check passed
  • Core Web Vitals

    vmDeshpande/ai-agent-automation

    Optimize Core Web Vitals (LCP, INP, CLS) for better page experience and search ranking.

    178 GitHub starsUsed in 4 repos~3.6k tokens
    Frontend & DesignAuto-check passed
  • Dependency Audit

    agulli/atlas-agents

    Audit project dependencies for vulnerabilities, license issues, and bloat.

    578 GitHub stars~477 tokensUpdated 2 mo ago
    Frontend & DesignAuto-check passed
  • Igniteui Wc Optimize Bundle Size

    IgniteUI/igniteui-webcomponents

    Reduce application bundle size with Ignite UI Web Components by registering only needed components via named imports from the package root with defineComponents instead of defineAllComponents…

    170 GitHub stars~3.6k tokensUpdated today
    Frontend & DesignAuto-check passed
  • Performance Profiler

    EliasOulkadi/shokunin

    Performance profiling and optimization for web apps — Core Web Vitals (LCP, INP, CLS), Lighthouse audits, bundle analysis, backend profiling (CPU, memory, DB queries), N+1 detection, caching…

    114 GitHub stars~2.7k tokensUpdated 2 days ago
    Frontend & DesignAuto-check: notes
  • Nextjs Bundle Optimizer

    pproenca/dot-skills

    Next.js 16 bundle-size and build-time optimization — runs a data-driven iteration loop: measure baseline → analyze top offenders → apply ONE recipe → re-measure → verify nothing broke (build + types…

    214 GitHub stars~1.5k tokensUpdated 1 mo ago
    Frontend & DesignAuto-check passed

More from involvex/youtube-music-cli

  • React State Management

    involvex/youtube-music-cli

    Master modern React state management with Redux Toolkit, Zustand, Jotai, and React Query.

    456 GitHub starsUsed in 12 repos~3k tokens
    Auto-check passed
  • Bun Win32

    involvex/youtube-music-cli

    Win32 FFI binding lifecycle for @bun-win32/ packages (Win32 DLL bindings via bun:ffi on Windows).

    456 GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Bun Dev Server

    involvex/youtube-music-cli

    Set up high-performance development servers with Hot Module Replacement.

    456 GitHub stars~2.9k tokensUpdated yesterday
    Auto-check: notes
  • Bun Test

    involvex/youtube-music-cli

    Configure Bun's built-in test runner with Jest-compatible APIs.

    456 GitHub stars~2.3k tokensUpdated yesterday
    Auto-check: notes
  • Bun Init

    involvex/youtube-music-cli

    Initialize a new Bun project with TypeScript and optimal configuration.

    456 GitHub stars~2.1k tokensUpdated yesterday
    Auto-check: notes

Questions about Bun Build

What does Bun Build do?

Create optimized production bundles with Bun's native bundler. Bun Build is an agent skill from involvex/youtube-music-cli. Create optimized production bundles with Bun's native bundler.

When should I use Bun Build?

Bun Build fits situations like: building applications for production; optimizing bundle sizes; setting up multi-environment builds; replacing webpack/esbuild/rollup.

How do I install Bun Build in Claude Code?

Run `npx skills add involvex/youtube-music-cli --skill bun-build -a claude-code`. Or copy the skill folder (.agents/skills/bun-build in involvex/youtube-music-cli) into .claude/skills/bun-build in your project. Claude Code loads it when a task matches its description.

How do I install Bun Build in Codex?

Run `npx skills add involvex/youtube-music-cli --skill bun-build -a codex`. Or copy the skill folder (.agents/skills/bun-build in involvex/youtube-music-cli) into .agents/skills/bun-build in your project. Codex loads it when a task matches its description.

Can I use Bun Build in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add involvex/youtube-music-cli --skill bun-build -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/bun-build, .gemini/skills/bun-build, .github/skills/bun-build and .opencode/skills/bun-build in your project.

What does Bun Build need to run?

Going by SKILL.md and its folder, Bun Build needs the command-line tools its instructions call (bun). Our summary lists: Node.js. Its frontmatter pre-approves these tools: Bash, Write, Read. Compatibility (from SKILL.md): Requires Bun 1.0+.

Does Bun Build access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Bun Build safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Bun Build use?

Bun Build is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Bun Build use?

About 2.1k tokens (SKILL.md is roughly 8.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 4.2k tokens, read only when the agent opens those files.

What are the alternatives to Bun Build?

Skills that share tags, products or a category with Bun Build: SEO Google (AgriciDaniel/codex-seo, 787 stars), Core Web Vitals (vmDeshpande/ai-agent-automation, 178 stars), Dependency Audit (agulli/atlas-agents, 578 stars) and Igniteui Wc Optimize Bundle Size (IgniteUI/igniteui-webcomponents, 170 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Bun Build?

involvex (a GitHub user) maintains it in involvex/youtube-music-cli, which has 456 GitHub stars. The repository holds 6 skills in this directory. The repository was last updated on October 6, 2026.

Source: involvex/youtube-music-cli on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.