bundle-optimization — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited bundle-optimization (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Any task involving JavaScript/TypeScript bundle size reduction, tree shaking, code splitting, lazy loading, or front-end performance budgets.
| Metric | Target |
|---|---|
| Main bundle (gzipped) | < 100KB |
| Total initial JS (gzipped) | < 300KB |
| Largest single chunk | < 150KB |
| Time to Interactive (3G) | < 5s |
Requirements for tree shaking to work:
"sideEffects": false in package.json.export * from).import { debounce } from 'lodash-es' not import _ from 'lodash'.Common tree-shaking failures:
lib[method]() prevents dead code elimination.Fix barrel file problem:
// BAD: barrel imports everything
import { Button } from '@/components';
// GOOD: direct import only loads Button
import { Button } from '@/components/Button';Route-based splitting (most impactful):
// React
const Dashboard = React.lazy(() => import('./pages/Dashboard'));
const Settings = React.lazy(() => import('./pages/Settings'));
// Next.js: automatic per-page splitting (built-in)Component-based splitting (for heavy components):
// Only load chart library when chart is rendered
const Chart = React.lazy(() => import('./Chart'));
// With loading state
<Suspense fallback={<ChartSkeleton />}>
<Chart data={data} />
</Suspense>Library-based splitting:
Strategy: separate stable code from frequently changing code.
// webpack config
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendor',
chunks: 'all',
},
framework: {
test: /[\\/]node_modules[\\/](react|react-dom)[\\/]/,
name: 'framework',
priority: 10,
},
},
},
}Benefits:
Preload (critical, needed NOW):
<link rel="preload" href="/fonts/main.woff2" as="font" crossorigin>
<link rel="preload" href="/critical.js" as="script">Prefetch (likely needed SOON):
<link rel="prefetch" href="/next-page-bundle.js">webpack-bundle-analyzer:
npx webpack-bundle-analyzer stats.jsonsource-map-explorer:
npx source-map-explorer dist/main.jsbundlephobia.com:
knip, ts-prune, or bundler warnings.import(/* webpackChunkName: "chart" */ './Chart').webpackPreload / webpackPrefetch magic comments where appropriate.~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.