Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add aj-geddes/useful-ai-prompts --skill bundle-size-optimization -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/bundle-size-optimization/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/bundle-size-optimization/

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

Similar skills

Everything for Frontend and UI →

From the same set143

push-notification-setup Integrates push notifications for iOS and Android using Firebase Cloud Messaging and APNs. Helps handle token refreshes, deep linking, and background sync. CX Codex +1 575installs database-schema-documentation Documents database schemas, generates Mermaid ERD diagrams, and tracks table constraints. Useful when creating data dictionaries or writing migration specs. CX Codex +1 569installs Data Visualization A skill that steers your agent toward the right chart type and gives working matplotlib and seaborn code for analysis and stakeholder decks. CX Codex +1 568installs app-store-deployment Deploys iOS and Android apps to App Store and Google Play. Guides through code signing, versioning, and pre-release verification. CX Codex +1 564installs security-audit-logging A skill that walks your agent through building security audit logging: events, user actions, system changes. Useful when you need logs for compliance or incident review. CX Codex +1 561installs mobile-app-debugging A skill for tracking down failures that only show up on a device: crashes, slow frames, flaky connectivity. CX Codex +1 561installs oauth-implementation Guides the setup of OAuth 2.0, OpenID Connect, JWT tokens, and SSO in web and mobile apps. Useful when configuring social logins or securing backend APIs. CX Codex +1 553installs process-mapping A skill that walks the agent through documenting a current workflow, spotting bottlenecks and designing an improved version. CX Codex +1 552installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor