jutsu-bun
Bun validation hook plus five skills covering runtime, testing, bundler, package manager, and SQLite.
- CCM score
- 50 of 100
- GitHub stars
- 201
Own this plugin? Claim it
What it does
- Adds five skills (
bun-runtime,bun-testing,bun-bundler,bun-package-manager, andbun-sqlite) and a validation hook for Bun.js projects - Runs
bun build --target=bun --no-bundleafter conversations, agent work, and before commits to catch TypeScript errors - Covers file I/O, HTTP servers, the built-in test runner, bundling, workspaces, and the built-in SQLite driver
- Designed for projects already on Bun that want type checks and Bun API guidance inside Claude Code
Validation and quality enforcement for Bun.js projects with runtime, testing, bundler, package manager, and SQLite skills.
Add marketplace
/plugin marketplace add TheBushidoCollective/hanRun it inside Claude Code once, then install the plugin below.
Install
/plugin install jutsu-bun@hanRun it inside Claude Code after adding the marketplace.
Files
Discovered from sourceBun Bundler
Use this skill when bundling JavaScript/TypeScript applications with Bun's built-in bundler, which provides exceptional performance and modern features.
Key Concepts
Basic Bundling
Bun can bundle your code for different targets:
# Bundle for Bun runtime
bun build ./src/index.ts --outdir ./dist
# Bundle for browsers
bun build ./src/index.ts --outdir ./dist --target=browser
# Bundle for Node.js
bun build ./src/index.ts --outdir ./dist --target=node
# Minify output
bun build ./src/index.ts --outdir ./dist --minify
Programmatic API
Use Bun's build API in TypeScript:
import { build } from "bun";
await build({
entrypoints: ["./src/index.ts"],
outdir: "./dist",
target: "bun",
minify: true,
sourcemap: "external",
});
Build Targets
Bun supports multiple build targets:
bun- Optimized for Bun runtime (default)browser- Browser-compatible bundlenode- Node.js-compatible bundle
Output Formats
Control output format:
await build({
entrypoints: ["./src/index.ts"],
outdir: "./dist",
format: "esm", // or "cjs", "iife"
});
Best Practices
Entry Points Configuration
Define multiple entry points for complex applications:
await build({
entrypoints: [
"./src/client/index.ts",
"./src/server/index.ts",
"./src/worker.ts",
],
outdir: "./dist",
naming: {
entry: "[dir]/[name].[ext]",
chunk: "[name]-[hash].[ext]",
asset: "assets/[name]-[hash].[ext]",
},
});
Tree Shaking
Bun automatically tree-shakes unused code:
// utils.ts
export function used() {
return "used";
}
export function unused() {
return "unused";
}
// index.ts
import { used } from "./utils";
console.log(used()); // Only 'used' function will be bundled
Code Splitting
Split code for better loading performance:
await build({
entrypoints: ["./src/index.ts"],
outdir: "./dist",
splitting: true, // Enable code splitting
target: "browser",
});
Environment Variables
Replace environment variables at build time:
await build({
entrypoints: ["./src/index.ts"],
outdir: "./dist",
define: {
"process.env.API_URL": JSON.stringify("https://api.example.com"),
"process.env.NODE_ENV": JSON.stringify("production"),
},
});
External Dependencies
Mark dependencies as external to exclude from bundle:
await build({
entrypoints: ["./src/index.ts"],
outdir: "./dist",
external: ["react", "react-dom"], // Don't bundle React
target: "browser",
});
Source Maps
Generate source maps for debugging:
await build({
entrypoints: ["./src/index.ts"],
outdir: "./dist",
sourcemap: "external", // or "inline", "none"
minify: true,
});
Common Patterns
Building a Library
// build.ts
import { build } from "bun";
// ESM build
await build({
entrypoints: ["./src/index.ts"],
outdir: "./dist/esm",
format: "esm",
target: "node",
minify: true,
sourcemap: "external",
});
// CJS build
await build({
entrypoints: ["./src/index.ts"],
outdir: "./dist/cjs",
format: "cjs",
target: "node",
minify: true,
sourcemap: "external",
});
console.log("Build complete!");
Building a Web Application
// build.ts
import { build } from "bun";
await build({
entrypoints: ["./src/index.tsx"],
outdir: "./dist",
target: "browser",
format: "esm",
minify: true,
splitting: true,
sourcemap: "external",
publicPath: "/assets/",
naming: {
entry: "[dir]/[name].[ext]",
chunk: "[name]-[hash].[ext]",
asset: "assets/[name]-[hash].[ext]",
},
define: {
"process.env.NODE_ENV": JSON.stringify("production"),
},
});
Building Multiple Outputs
// build.ts
import { build } from "bun";
const builds = [
{
entrypoints: ["./src/index.ts"],
outdir: "./dist/esm",
format: "esm" as const,
target: "browser" as const,
},
{
entrypoints: ["./src/index.ts"],
outdir: "./dist/cjs",
format: "cjs" as const,
target: "node" as const,
},
{
entrypoints: ["./src/index.ts"],
outdir: "./dist/iife",
format: "iife" as const,
target: "browser" as const,
},
];
for (const config of builds) {
await build({
...config,
minify: true,
sourcemap: "external",
});
}
console.log("All builds complete!");
Build Script with Watching
// watch-build.ts
import { watch } from "fs";
import { build } from "bun";
async function buildApp() {
console.log("Building...");
await build({
entrypoints: ["./src/index.ts"],
outdir: "./dist",
target: "bun",
});
console.log("Build complete!");
}
// Initial build
await buildApp();
// Watch for changes
watch("./src", { recursive: true }, async (event, filename) => {
console.log(`File changed: ${filename}`);
await buildApp();
});
Plugin System
Create custom build plugins:
import type { BunPlugin } from "bun";
const myPlugin: BunPlugin = {
name: "my-plugin",
setup(build) {
build.onLoad({ filter: /\.custom$/ }, async (args) => {
const text = await Bun.file(args.path).text();
return {
contents: `export default ${JSON.stringify(text)}`,
loader: "js",
};
});
},
};
await build({
entrypoints: ["./src/index.ts"],
outdir: "./dist",
plugins: [myPlugin],
});
Anti-Patterns
Don't Bundle Node Modules for Node Target
// Bad - Bundling all dependencies for Node
await build({
entrypoints: ["./src/server.ts"],
target: "node",
// Missing external configuration
});
// Good - Mark dependencies as external
await build({
entrypoints: ["./src/server.ts"],
target: "node",
external: ["express", "mongoose", "*"], // "*" excludes all node_modules
});
Don't Ignore Build Errors
// Bad - No error handling
await build({
entrypoints: ["./src/index.ts"],
outdir: "./dist",
});
// Good - Handle build errors
try {
const result = await build({
entrypoints: ["./src/index.ts"],
outdir: "./dist",
});
if (!result.success) {
console.error("Build failed");
process.exit(1);
}
console.log("Build succeeded");
} catch (error) {
console.error("Build error:", error);
process.exit(1);
}
Don't Minify Development Builds
// Bad - Always minifying
await build({
entrypoints: ["./src/index.ts"],
outdir: "./dist",
minify: true, // Hard to debug in development
});
// Good - Conditional minification
const isDev = Bun.env.NODE_ENV === "development";
await build({
entrypoints: ["./src/index.ts"],
outdir: "./dist",
minify: !isDev,
sourcemap: isDev ? "inline" : "external",
});
Don't Over-Split Code
// Bad - Excessive code splitting
await build({
entrypoints: ["./src/index.ts"],
outdir: "./dist",
splitting: true,
target: "bun", // Code splitting not needed for Bun target
});
// Good - Split only when beneficial
await build({
entrypoints: ["./src/index.ts"],
outdir: "./dist",
splitting: true,
target: "browser", // Beneficial for browsers
});
Related Skills
- bun-runtime: Understanding Bun's runtime for target optimization
- bun-package-manager: Managing build dependencies
- bun-testing: Testing bundled code
Readme
Bun
Validation and quality enforcement for Bun.js projects.
What This Plugin Provides
Validation Hooks
- Bun Type Check: Runs Bun's build type checker to ensure TypeScript code is valid
- Fast Validation: Leverages Bun's exceptional performance for rapid feedback
Skills
This plugin provides the following skills:
- bun-runtime: Working with Bun's runtime APIs including file I/O, HTTP servers, WebSockets, and native APIs
- bun-testing: Writing tests with Bun's built-in test runner, assertions, mocking, and snapshot testing
- bun-bundler: Bundling JavaScript/TypeScript code with Bun's fast bundler for different targets
- bun-package-manager: Managing dependencies with Bun's package manager, workspaces, and lockfiles
- bun-sqlite: Working with SQLite databases using Bun's built-in high-performance SQLite driver
Installation
han plugin install bun
Usage
Once installed, this plugin automatically validates your Bun code:
- When you finish a conversation with Claude Code
- When Claude Code agents complete their work
- Before commits (when combined with git hooks)
The validation runs bun build --target=bun --no-bundle to check for type errors without actually bundling your code.
Requirements
- Bun 1.0.0 or higher
- TypeScript (for type checking)
Why Bun?
Bun is an all-in-one JavaScript runtime and toolkit designed for speed:
- Fast Runtime: 3x faster than Node.js for many operations
- Built-in Tools: Bundler, test runner, package manager all included
- Web Standard APIs: First-class support for Web APIs like fetch, WebSocket
- TypeScript Native: Run TypeScript and JSX directly without transpilation
- npm Compatible: Works with existing npm packages
- SQLite Built-in: High-performance SQLite driver included
Features Covered by Skills
Runtime APIs
- File I/O with
Bun.file()andBun.write() - HTTP servers with
Bun.serve() - WebSocket support
- Password hashing
- Environment variables
- Shell command execution with
Bun.$
Testing
- Built-in test runner
- Jest-compatible API
- Mocking and spies
- Snapshot testing
- Coverage reporting
- Watch mode
Bundler
- Fast bundling for multiple targets (bun, browser, node)
- Tree shaking
- Code splitting
- Minification
- Source maps
- Plugin system
Package Manager
- Fast dependency installation
- Binary lockfile (bun.lockb)
- Workspace support for monorepos
- npm/yarn/pnpm compatibility
- Global packages
- Link local packages
SQLite
- Native SQLite driver
- Prepared statements
- Transactions
- Migration support
- High performance
Examples
Create a Simple HTTP Server
Bun.serve({
port: 3000,
fetch(req) {
return new Response("Hello from Bun!");
},
});
Run Tests
import { test, expect } from "bun:test";
test("addition", () => {
expect(1 + 1).toBe(2);
});
Bundle Your Code
bun build src/index.ts --outdir dist --target browser --minify
Install Dependencies
bun add express
bun add -d @types/express
Use SQLite
import { Database } from "bun:sqlite";
const db = new Database("mydb.sqlite");
db.run("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)");
db.run("INSERT INTO users (name) VALUES (?)", ["Alice"]);
Details
- Marketplace
- TheBushidoCollective/han
- Source
- plugins/tools/bun
- Category
- Tool
- Keywords
- bun, javascript, typescript, runtime, testing, bundler
- Listed since
- Apr 7, 2026
More from TheBushidoCollective/han
All 340- jutsu-c
- jutsu-checkstyle
- jutsu-clippy
- jutsu-cocoapods
- jutsu-cpp
- jutsu-credo
- jutsu-crystal
- jutsu-csharp
- jutsu-cucumber
- jutsu-cypress
- jutsu-dialyzer
- jutsu-django
- jutsu-docker-compose
- jutsu-ecto
- jutsu-effect
- jutsu-elixir
- jutsu-erlang
- jutsu-esbuild
- jutsu-eslint
- jutsu-expo
- jutsu-fastapi
- jutsu-fnox
- jutsu-functional-programming
- jutsu-git-storytelling
Similar to jutsu-bun
More Developer ToolsbunPluginTheBushidoCollective/han201 starsValidation and quality enforcement for Bun.js projects with runtime, testing, bundler, package manager, and SQLite skills.
jutsu-eslintPluginTheBushidoCollective/han201 starsComprehensive ESLint skills for JavaScript and TypeScript linting with configuration, rules, and custom plugin development.
bun-developmentSkillsickn33/agentic-awesome-skills2.9K installsFast JavaScript and TypeScript development guidance for the Bun runtime, including Node.js migration and Bun's built-in tooling.
bun-runtimeSkillaffaan-m/ecc12.3K installsBun runtime guidance covering when to choose Bun over Node, migration steps, and Vercel deployment settings.
ex_unitPluginbradleygolden/claude-marketplace-elixir176 starsExUnit testing automation with pre-commit test validation
unit-testingPluginwshobson/agents42.9K starsUnit and integration test automation for Python and JavaScript with debugging support