# Optimize Bundle

> Apply bundle size optimizations Use when this capability is needed.

- Skill: `tomevault-io/optimize-bundle` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/optimize-bundle`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/optimize-bundle/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/optimize-bundle

---


# Bundle Optimization Skill

Apply bundle size optimizations to reduce build output and improve performance.

## Options

```
--dry-run        Show what would be changed without applying
--safe           Only apply safe, reversible optimizations
```

## Workflow

```
1. Run full bundle analysis
2. Identify optimization opportunities
3. Prioritize by impact and risk
4. Apply recommended changes (or show dry-run)
5. Rebuild if changes applied
6. Verify improvements
7. Report before/after metrics
```

## Optimization Levels

### Safe
- Configure code splitting
- Enable tree-shaking for ESM
- Add terser/minification
- Configure chunk optimization

### Moderate
- Replace heavy dependencies with lighter alternatives
- Add dynamic imports for routes
- Configure asset optimization

### Aggressive
- Remove unused dependencies
- Inline small modules
- Configure aggressive minification

## Output

- Applied changes list
- Before/after size comparison
- Build time comparison
- Risk assessment for each change

## Examples

```bash
# Apply all safe optimizations
optimize-bundle

# Preview changes without applying
optimize-bundle --dry-run

# Only apply safe optimizations
optimize-bundle --safe
```

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/baekenough) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-12 -->

