Evo nextjs bundle reduction

From OpenLAIR/OpenSkill · View interactive version

Evo nextjs bundle reduction is an AI agent skill from the GitHub repository OpenLAIR/OpenSkill. Identifies and fixes bundle size issues including wildcard/barrel imports, missing dynamic imports for heavy components, unnecessary use client directives, and useEffect-based data fetching.

How to use this skill

Skill file

evo-nextjs-bundle-reduction

Reduces client bundle size by:

  1. Converting barrel lodash imports to individual module imports
  2. Applying next/dynamic for code splitting heavy components
  3. Minimizing 'use client' boundary scope
  4. Converting client-side useEffect fetches to server-side patterns

Key Patterns

Barrel Lodash Imports → Individual Imports

Anti-pattern:

import { groupBy, sortBy, meanBy } from 'lodash';

Fix:

import groupBy from 'lodash/groupBy';
import sortBy from 'lodash/sortBy';
import meanBy from 'lodash/meanBy';

Dynamic Import for Heavy Components

Anti-pattern: Static inline component using heavy library (mathjs)

Fix: Extract to separate file and use next/dynamic:

import dynamic from 'next/dynamic';
const AdvancedAnalysis = dynamic(() => import('@/components/AdvancedAnalysis'), {
  ssr: false,
  loading: () => <div data-testid="advanced-content">Loading...</div>
});

Usage

import sys
sys.path.insert(0, '/app/environment/skills/evo-nextjs-bundle-reduction/scripts')
from utils import fix_barrel_lodash_imports, extract_and_dynamify_component, apply_bundle_fixes

fix_barrel_lodash_imports('/app/src/app/compare/page.tsx')
extract_and_dynamify_component('/app/src/app/compare/page.tsx', 'AdvancedAnalysis')
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.