ソース情報
- リポジトリ
- tools-only/X-Skills
- ソースの最終更新活動
- 2026年2月4日 08:32
- 検出された SKILL.md の言語
- 英語
- スター
- 7
- フォーク
- 1
インストール方法
デフォルトでは、最初にソースを確認する Prompt が選択されています。直接コマンドに切り替えるか、ローカルコピーをダウンロードすることもできます。
ソースファイルを確認
インストールを決める前に、SKILL.md と SkillsMP に表示されている付属ファイルをお読みください。
メニュー
デフォルトでは、最初にソースを確認する Prompt が選択されています。直接コマンドに切り替えるか、ローカルコピーをダウンロードすることもできます。
インストールを決める前に、SKILL.md と SkillsMP に表示されている付属ファイルをお読みください。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
直接コマンドでは確認用 Prompt が省略されます。実行前にソースを確認してください。
npx skills add https://github.com/tools-only/X-Skills --skill bundle-size-checkコマンドは1行のまま表示されます。コピー前に横へスクロールして全体を確認してください。
ローカルで確認しますか?SkillsMP が現在取得できるファイルをダウンロードできます。
SKILL.md を表示中
Index of Build Systems Skills
Coordination patterns for distributed dataflow systems including barriers, epochs, and distributed snapshots
Windowing, sessionization, time-series aggregation, and late data handling for streaming systems
SOC 職業分類に基づく
| description | Analyze and optimize Next.js bundle size with detailed recommendations |
Analysis Mode: $ARGUMENTS
ls -la .next/ 2>/dev/null || echo "No build found"npm list --prod --depth=0 2>/dev/null || echo "Run npm install first"npm list --dev --depth=0 2>/dev/null || echo "Run npm install first"npm audit --audit-level=moderate 2>/dev/null || echo "No audit available"# Install webpack-bundle-analyzer
npm install --save-dev @next/bundle-analyzer
# Or use built-in Next.js analyzer
npm install --save-dev cross-env
// next.config.js
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
/** @type {import('next').NextConfig} */
const nextConfig = {
// Your existing config
experimental: {
optimizePackageImports: [
'lucide-react',
'@heroicons/react',
'date-fns',
'lodash',
],
},
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
// Bundle analysis optimizations
if (!dev && !isServer) {
config.optimization.splitChunks = {
chunks: 'all',
cacheGroups: {
default: false,
vendors: false,
// Vendor chunk for common libraries
vendor: {
name: 'vendors',
chunks: 'all',
test: /node_modules/,
priority: 20,
},
// Common chunk for shared code
common: {
name: 'commons',
minChunks: 2,
chunks: 'all',
priority: 10,
reuseExistingChunk: true,
enforce: true,
},
// UI libraries chunk
ui: {
name: 'ui-libs',
chunks: 'all',
test: /node_modules\/(react|react-dom|@radix-ui|@headlessui)/,
priority: 15,
},
// Utility libraries chunk
utils: {
name: 'utils',
chunks: 'all',
test: /node_modules\/(lodash|date-fns|clsx|classnames)/,
priority: 15,
},
},
};
}
return config;
},
};
module.exports = withBundleAnalyzer(nextConfig);
{
"scripts": {
"analyze": "cross-env ANALYZE=true next build",
"analyze:server": "cross-env BUNDLE_ANALYZE=server next build",
"analyze:browser": "cross-env BUNDLE_ANALYZE=browser next build",
"build:analyze": "npm run build && npm run analyze"
}
}
# Full bundle analysis
ANALYZE=true npm run build
# Server-side bundle analysis
BUNDLE_ANALYZE=server npm run build
# Client-side bundle analysis
BUNDLE_ANALYZE=browser npm run build
# Production build with analysis
npm run analyze
# Check current bundle size
ls -lah .next/static/chunks/ | head -20
# Check bundle sizes with details
find .next/static/chunks -name "*.js" -exec ls -lah {} \; | sort -k5 -hr
# Gzipped size analysis
find .next/static/chunks -name "*.js" -exec gzip -c {} \; | wc -c
Analyze the generated webpack-bundle-analyzer report for:
// Bundle size thresholds
const bundleThresholds = {
// First Load JS (critical)
firstLoadJS: {
warning: 200 * 1024, // 200KB
error: 300 * 1024, // 300KB
},
// Individual chunks
chunk: {
warning: 150 * 1024, // 150KB
error: 250 * 1024, // 250KB
},
// Total bundle size
total: {
warning: 1024 * 1024, // 1MB
error: 2048 * 1024, // 2MB
}
};
// Dynamic imports for large components
import dynamic from 'next/dynamic';
const HeavyComponent = dynamic(() => import('./HeavyComponent'), {
loading: () => <p>Loading...</p>,
ssr: false, // Disable SSR for client-only components
});
// Route-based code splitting
const AdminDashboard = dynamic(() => import('./AdminDashboard'), {
loading: () => <DashboardSkeleton />,
});
// Conditional loading
const ChartComponent = dynamic(
() => import('./ChartComponent'),
{
ssr: false,
loading: () => <ChartSkeleton />
}
);
// Optimize lodash imports
// ❌ Imports entire lodash library
import _ from 'lodash';
// ✅ Import only needed functions
import { debounce, throttle } from 'lodash';
// ✅ Even better - use tree-shaking friendly alternatives
import debounce from 'lodash/debounce';
import throttle from 'lodash/throttle';
// Date library optimization
// ❌ Moment.js (large bundle)
import moment from 'moment';
// ✅ date-fns (tree-shakable)
import { format, parseISO } from 'date-fns';
// ✅ Day.js (smaller alternative)
import dayjs from 'dayjs';
// next.config.js optimizations
const nextConfig = {
// Optimize package imports
experimental: {
optimizePackageImports: [
'react-icons',
'@heroicons/react',
'lucide-react',
'date-fns',
'lodash',
],
},
// Tree shaking for CSS
experimental: {
optimizeCss: true,
},
// Minimize client-side JavaScript
compiler: {
removeConsole: process.env.NODE_ENV === 'production',
},
// Webpack optimizations
webpack: (config, { dev, isServer }) => {
if (!dev && !isServer) {
// Analyze bundle size
config.optimization.concatenateModules = true;
// Enable compression
config.plugins.push(
new (require('compression-webpack-plugin'))({
algorithm: 'gzip',
test: /\.(js|css|html|svg)$/,
threshold: 8192,
minRatio: 0.8,
})
);
}
return config;
},
};
// Next.js Image component with optimization
import Image from 'next/image';
// Optimize images with proper sizing
<Image
src="/hero-image.jpg"
alt="Hero"
width={1200}
height={600}
priority={isAboveFold}
placeholder="blur"
blurDataURL="data:image/jpeg;base64,..."
sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw"
/>
Analyze bundle size impact on:
// Simulate network conditions for testing
const networkConditions = {
'Fast 3G': { downloadThroughput: 1500, uploadThroughput: 750, latency: 562.5 },
'Slow 3G': { downloadThroughput: 500, uploadThroughput: 500, latency: 2000 },
'Offline': { downloadThroughput: 0, uploadThroughput: 0, latency: 0 }
};
// Preload critical chunks
useEffect(() => {
// Preload likely next page
router.prefetch('/dashboard');
// Preload critical components
import('./CriticalComponent');
}, []);
// Lazy load non-critical features
const LazyFeature = lazy(() =>
import('./LazyFeature').then(module => ({
default: module.LazyFeature
}))
);
# GitHub Action for bundle monitoring
name: Bundle Size Check
on: [pull_request]
jobs:
bundle-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: npm ci
- run: npm run build
- uses: nextjs-bundle-analysis/bundle-analyzer@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
// webpack.config.js performance budgets
module.exports = {
performance: {
maxAssetSize: 250000, // 250KB
maxEntrypointSize: 350000, // 350KB
hints: 'error',
},
};
Generate comprehensive report including:
Provide specific, actionable recommendations for immediate and long-term bundle optimization.