bun:optimize

bun:optimize is a command for Claude Code from secondsky/claude-skills. It costs 12 tokens per session (1,028 once invoked), scanned A, original, MIT.

A set of Bun-focused commands for finding ways to reduce an application's download size and improve its runtime performance. Bun is a JavaScript runtime and package manager.

In plain words
What is it for?
Use it to inspect Bun build output and apply techniques such as minification, code splitting, streaming files, database connection pooling, and response caching.
Why use it?
It helps locate large bundles, unused code, slow file or database handling, and other common performance problems.

Command for Claude Code

Written for Claude Code: arguments in frontmatter.

Part of the bun plugin — 27 skills, 6 commands, 3 agents, 2 hooks shipped together

Good fit Use it to inspect Bun build output and apply techniques such as minification, code splitting, streaming files, database connection pooling, and response caching.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/secondsky/claude-skills/bun-optimize
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/secondsky/claude-skills

Made for: Claude Code.

Or install bun, the plugin that ships this one along with the rest of its 27 skills, 6 commands, 3 agents, 2 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for bun:optimize

README.md
[![agentmods](https://agentmods.dev/badge/commands/secondsky/claude-skills/bun-optimize/github.svg)](https://agentmods.dev/commands/secondsky/claude-skills/bun-optimize)
Your own site
<a href="https://agentmods.dev/commands/secondsky/claude-skills/bun-optimize"><img src="https://agentmods.dev/badge/commands/secondsky/claude-skills/bun-optimize/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for bun:optimize

Your own site · 80×15
<a href="https://agentmods.dev/commands/secondsky/claude-skills/bun-optimize"><img src="https://agentmods.dev/badge/commands/secondsky/claude-skills/bun-optimize.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,028 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00012 $0.01028
Opus 5.5 $0.00005 $0.00411
Sonnet 5.5 $0.00002 $0.00206
Haiku 4.5 $0.00001 $0.00103

Measured 3mo ago against content hash b4c937a38f04, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

bun:optimize scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/bun/commands/bun-optimize.md · 194 lines

How it starts

The opening of the file, as written. The whole thing — 194 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Bun Optimization

Analyze and optimize Bun application performance.

Optimization Areas

Bundle Size Optimization

Analyze current bundle:

const result = await Bun.build({
  entrypoints: ["./src/index.ts"],
  outdir: "./dist",
  minify: true,
  splitting: true,
  sourcemap: "external",
});

for (const output of result.outputs) {
  console.log(`${output.path}: ${output.size} bytes`);
}

Techniques:

  1. Enable minification - Reduces size by 40-60%
  2. Code splitting - Lazy load non-critical code
  3. Tree shaking - Remove unused exports
  4. External packages - Don't bundle large deps
  5. Drop console/debugger - Remove dev code
await Bun.build({
  entrypoints: ["./src/index.ts"],
  outdir: "./dist",
  minify: true,
  splitting: true,
  drop: ["console", "debugger"],
  external: ["react", "react-dom"],
});

Runtime Performance

  1. Use Bun APIs - Prefer Bun.file() over fs
  2. Stream large files - Don't load into memory
  3. Prepared statements - Reuse SQLite statements
  4. Connection pooling - For databases
  5. Response caching - Cache expensive operations
// Good: Stream large files
const file = Bun.file("large.json");
const stream = file.stream();

// Good: Prepared statements
const stmt = db.prepare("SELECT * FROM users WHERE id = ?");
for (const id of ids) {
  stmt.get(id);
}

// Good: Cache responses
const cache = new Map();
async function getData(key) {
  if (cache.has(key)) return cache.get(key);
  const data = await fetchData(key);
  cache.set(key, data);
  return data;
}

Memory Optimization

  1. Use --smol flag - Reduces memory footprint
  2. Stream processing - Avoid loading all data
  3. WeakMap/WeakSet - For cached objects
  4. ArrayBuffer reuse - Pool buffers
  5. Avoid closures - In hot paths
# Run with reduced memory
bun --smol run src/index.ts
// Good: Stream processing
for await (const line of file.stream()) {
  processLine(line);
}

// Good: Buffer pooling
const bufferPool = [];
function getBuffer(size) {
  return bufferPool.pop() || new ArrayBuffer(size);
}
function releaseBuffer(buf) {
  bufferPool.push(buf);
}

Read the full file on GitHub · 194 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 194 lines · 12 tokens per session scan A b4c937a38f04

Subscribe to this mod's changes

bun:optimize is a command published in the GitHub repository secondsky/claude-skills (257 stars, last pushed 2d ago), licensed MIT. It adds 12 tokens to every session and 1,028 once invoked, about $0.0000 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

bun:optimize compared with commands from other repositories

bun:optimize next to 6 commands from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
bun:optimizesecondsky/claude-skillsCommand2572d agoMITA12Claude Code
checklistgithub/spec-kitCommand153kyesterdayMITA13Claude Code
clarifygithub/spec-kitCommand153kyesterdayMITA27Claude Code
specifygithub/spec-kitCommand153kyesterdayMITA13Claude Code
analyzegithub/spec-kitCommand153kyesterdayMITA26Claude Code
convergegithub/spec-kitCommand153kyesterdayMITA35Claude Code
implementgithub/spec-kitCommand153kyesterdayMITA14Claude Code