bundle-size-optimization — Claude Code skill: how to install
Cuts JavaScript and CSS bundle sizes using code splitting and tree shaking. Helps optimize production builds and evaluate heavy dependencies before deployment.
npx skills add aj-geddes/useful-ai-prompts --skill bundle-size-optimization -a claude-codeWhat bundle-size-optimization does
This skill guides the agent through auditing and trimming production assets. Trimming bundle bytes reduces download and parse delays. That matters on mobile devices.
The package provides guides in references/ covering bundle audits and implementation strategy. For profiling, it highlights utilities like webpack-bundle-analyzer and Source Map Explorer. This helps isolate heavy libraries like moment.js.
Thorough testing before deployment is strictly required. Aggressive bundle pruning breaks runtime code if validation gets skipped. The guide also bans hard-coding build configuration values.
What it helps with
- identify oversized dependencies before shipping to production
- implement code splitting to shrink main bundle weight
- remove dead code using tree shaking
- inspect bundle breakdown reports via tools like
webpack-bundle-analyzer
Example prompts for the agent
- Inspect the production build and flag the heaviest dependencies in the vendor bundle.
- Guide me through configuring code splitting for these page routes.
- Set up tree shaking to drop unused functions from the final output.
How to install bundle-size-optimization
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill bundle-size-optimization -a claude-code2Manually: put the files in place
~/.claude/skills/bundle-size-optimization/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/bundle-size-optimization/
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill bundle-size-optimization -a codex2Manually: put the files in place
.agents/skills/bundle-size-optimization/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill bundle-size-optimization -a cursor2Manually: put the files in place
.cursor/skills/bundle-size-optimization/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install aj-geddes/useful-ai-prompts bundle-size-optimization2Manually: put the files in place
.github/skills/bundle-size-optimization/SKILL.md1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill bundle-size-optimization -a gemini-cli2Platform CLI
gemini skills install https://github.com/aj-geddes/useful-ai-prompts --path skills/bundle-size-optimizationManually: put the files in place
.devin/skills/bundle-size-optimization/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill bundle-size-optimization -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about bundle-size-optimization
How do I install bundle-size-optimization in Claude Code?
Run npx skills add aj-geddes/useful-ai-prompts --skill bundle-size-optimization -a claude-code. You can also save the skill definition directly to ~/.claude/skills/bundle-size-optimization/SKILL.md.
What does the bundle-size-optimization skill do?
It directs the AI assistant during JavaScript and CSS asset reduction. The skill covers code splitting, dependency auditing, and tree-shaking practices.
Which analysis utilities are referenced in this skill?
It mentions webpack-bundle-analyzer, Source Map Explorer, Bundle Buddy, and Bundlephobia.
Source text
SKILL.md · MIT
---
name: bundle-size-optimization
description: >
Reduce JavaScript and CSS bundle sizes through code splitting, tree shaking,
and optimization techniques. Improve load times and overall application
performance.
---
# Bundle Size Optimization
## Table of Contents
- [Overview](#overview)
- [When to Use](#when-to-use)
- [Quick Start](#quick-start)
- [Reference Guides](#reference-guides)
- [Best Practices](#best-practices)
## Overview
Smaller bundles download faster, parse faster, and execute faster, dramatically improving perceived performance especially on slower networks.
## When to Use
- Build process optimization
- Bundle analysis before deployment
- Performance baseline improvement
- Mobile performance focus
- After adding new dependencies
## Quick Start
Minimal working example:
```javascript
// Analyze bundle composition
class BundleAnalysis {
analyzeBundle() {
return {
tools: [
"webpack-bundle-analyzer",
"Source Map Explorer",
"Bundle Buddy",
"Bundlephobia",
],
metrics: {
total_size: "850KB gzipped",
main_js: "450KB",
main_css: "120KB",
vendor: "250KB",
largest_lib: "moment.js (67KB)",
},
breakdown: {
react: "85KB (10%)",
lodash: "45KB (5%)",
moment: "67KB (8%)",
other: "653KB (77%)",
},
};
// ... (see reference guides for full implementation)
```
## Reference Guides
Detailed implementations in the `references/` directory:
| Guide | Contents |
|---|---|
| [Bundle Analysis](references/bundle-analysis.md) | Bundle Analysis |
| [Optimization Techniques](references/optimization-techniques.md) | Optimization Techniques |
| [Implementation Strategy](references/implementation-strategy.md) | Implementation Strategy |
| [Best Practices](references/best-practices.md) | Best Practices |
## Best Practices
### ✅ DO
- Follow established patterns and conventions
- Write clean, maintainable code
- Add appropriate documentation
- Test thoroughly before deploying
### ❌ DON'T
- Skip testing or validation
- Ignore error handling
- Hard-code configuration values
© aj-geddes · MIT · aj-geddes/useful-ai-prompts