_legacy/frontend/frontend-performance/SKILL.md
フロントエンドパフォーマンス最適化ガイド。Core Web Vitals改善、バンドルサイズ削減、レンダリング最適化、画像最適化など、高速なWebアプリケーション構築のベストプラクティス。
npx skillsauth add gaku52/claude-code-skills frontend-performanceInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
このSkillは、フロントエンドパフォーマンス最適化をカバーします:
このガイドで学べること: Core Web Vitals改善、バンドル最適化、レンダリング戦略、画像最適化、キャッシング戦略 公式で確認すべきこと: 最新のパフォーマンス指標、ブラウザアップデート、フレームワーク最適化機能
web.dev Performance - Googleパフォーマンスガイド
Next.js Performance - Next.js最適化ガイド
Chrome DevTools - パフォーマンス分析ツール
WebPageTest Documentation - パフォーマンス測定
プロダクションレベルの最適化を学ぶには、以下の完全ガイドを参照してください:
30,000文字 | 実測値データ | 業界別ベンチマーク
26,000文字 | Code Splitting | 依存関係管理
27,000文字 | SSR・ISR | React最適化 | 仮想化
合計: 83,000文字 | 40以上の完全実装例 | 実プロジェクトの測定データ
| 指標 | 説明 | 目標 | |-----|------|------| | LCP (Largest Contentful Paint) | 最大コンテンツの表示時間 | < 2.5秒 | | FID (First Input Delay) | 初回入力遅延 | < 100ms | | CLS (Cumulative Layout Shift) | レイアウトシフト | < 0.1 |
// Next.js App Router(デフォルトでSSR)
export default async function Page() {
const data = await fetch('https://api.example.com/data')
return <div>{/* content */}</div>
}
// Next.js Image(自動最適化)
import Image from 'next/image'
<Image
src="/hero.jpg"
alt="Hero"
width={1200}
height={600}
priority // Above the fold
/>
// next.config.js
module.exports = {
optimizeFonts: true,
}
// app/layout.tsx
import { Inter } from 'next/font/google'
const inter = Inter({ subsets: ['latin'] })
export default function RootLayout({ children }) {
return (
<html lang="ja" className={inter.className}>
<body>{children}</body>
</html>
)
}
// 動的インポート
import dynamic from 'next/dynamic'
const HeavyComponent = dynamic(() => import('@/components/HeavyComponent'), {
loading: () => <p>Loading...</p>,
})
export default function Page() {
return <HeavyComponent />
}
// ❌ 悪い例(不要なライブラリ)
import moment from 'moment' // 288KB
// ✅ 良い例(軽量ライブラリ)
import { format } from 'date-fns' // 13KB
// ❌ 悪い例(サイズ未指定 → レイアウトシフト)
<img src="/image.jpg" alt="Image" />
// ✅ 良い例(サイズ指定)
<Image
src="/image.jpg"
alt="Image"
width={800}
height={600}
/>
/* ❌ 悪い例(フォント読み込み待ち → レイアウトシフト) */
@font-face {
font-family: 'CustomFont';
src: url('/fonts/custom.woff2');
font-display: block;
}
/* ✅ 良い例(フォールバックフォント表示) */
@font-face {
font-family: 'CustomFont';
src: url('/fonts/custom.woff2');
font-display: swap;
}
# Next.js バンドル分析
pnpm add -D @next/bundle-analyzer
# next.config.js
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
})
module.exports = withBundleAnalyzer({
// ...
})
# 実行
ANALYZE=true pnpm build
// ❌ 悪い例(全体インポート)
import _ from 'lodash' // 全体がバンドルされる
// ✅ 良い例(個別インポート)
import debounce from 'lodash/debounce'
// または
import { debounce } from 'lodash-es' // ES Modules版
// ルートベース分割(Next.jsは自動)
app/
├── page.tsx # Bundle 1
├── about/page.tsx # Bundle 2
└── blog/page.tsx # Bundle 3
// コンポーネント分割
const Modal = dynamic(() => import('@/components/Modal'))
function Page() {
const [showModal, setShowModal] = useState(false)
return (
<>
<button onClick={() => setShowModal(true)}>Open</button>
{showModal && <Modal />} // 必要なときのみロード
</>
)
}
// Next.js(ビルド時に生成)
export default async function Page() {
const posts = await getPosts()
return <PostList posts={posts} />
}
// 静的パス生成
export async function generateStaticParams() {
const posts = await getPosts()
return posts.map(post => ({ slug: post.slug }))
}
// 60秒ごとに再生成
export const revalidate = 60
export default async function Page() {
const posts = await fetch('https://api.example.com/posts', {
next: { revalidate: 60 }
}).then(r => r.json())
return <PostList posts={posts} />
}
// React.memo
const ExpensiveComponent = React.memo(({ data }) => {
return <div>{/* ... */}</div>
})
// useMemo
function Component({ items }) {
const sortedItems = useMemo(() => {
return items.sort((a, b) => a.name.localeCompare(b.name))
}, [items])
return <List items={sortedItems} />
}
// useCallback
function Parent() {
const handleClick = useCallback(() => {
console.log('clicked')
}, [])
return <Child onClick={handleClick} />
}
import Image from 'next/image'
// ✅ 自動最適化
<Image
src="/images/hero.jpg"
alt="Hero"
width={1200}
height={600}
quality={75} // デフォルト75
priority // Above the fold
/>
// ✅ レスポンシブ画像
<Image
src="/images/hero.jpg"
alt="Hero"
fill
style={{ objectFit: 'cover' }}
sizes="(max-width: 768px) 100vw, 50vw"
/>
// Next.jsは自動でWebPに変換
<Image src="/image.jpg" alt="Image" width={800} height={600} />
// → 自動的にWebPで配信(ブラウザサポート時)
// デフォルトで遅延ローディング
<Image src="/image.jpg" alt="Image" width={800} height={600} />
// priorityで無効化(Above the fold画像)
<Image src="/hero.jpg" alt="Hero" width={1200} height={600} priority />
// app/layout.tsx
import { SpeedInsights } from '@vercel/speed-insights/next'
import { Analytics } from '@vercel/analytics/react'
export default function RootLayout({ children }) {
return (
<html>
<body>
{children}
<SpeedInsights />
<Analytics />
</body>
</html>
)
}
import Image from 'next/image'
export default function Gallery({ images }) {
return (
<div className="grid grid-cols-3 gap-4">
{images.map((image, index) => (
<Image
key={image.id}
src={image.url}
alt={image.alt}
width={400}
height={300}
loading={index < 6 ? 'eager' : 'lazy'} // 最初の6枚は即座に読み込み
quality={75}
/>
))}
</div>
)
}
import dynamic from 'next/dynamic'
const Chart = dynamic(() => import('@/components/Chart'), {
loading: () => <div>Loading chart...</div>,
ssr: false, // クライアントサイドのみ
})
export default function Dashboard() {
return (
<div>
<h1>Dashboard</h1>
<Chart data={data} />
</div>
)
}
# Chrome DevTools → Lighthouse
# または
pnpm add -D lighthouse
npx lighthouse https://example.com --view
pnpm add web-vitals
// app/layout.tsx
'use client'
import { useEffect } from 'react'
import { onCLS, onFID, onLCP } from 'web-vitals'
export function WebVitals() {
useEffect(() => {
onCLS(console.log)
onFID(console.log)
onLCP(console.log)
}, [])
return null
}
ANALYZE=true pnpm build
パフォーマンス分析
Lighthouse スコアを実行して、改善点を提案してください。
バンドルサイズ削減
バンドルサイズを分析して、大きな依存関係を特定してください。
軽量な代替ライブラリを提案してください。
画像最適化
/public/images 内の画像をNext.js Imageコンポーネントに置き換えてください。
Last updated: 2025-12-26
tools
Fundamentals of modern web development. Framework selection (React, Vue, Next.js), project architecture, state management, routing, build tools, and CSS strategy best practices.
development
# React Development — Complete Guide > A comprehensive guide to building modern React applications with TypeScript. Covers fundamentals through advanced patterns, Hooks mastery, TypeScript integration, performance optimization, and algorithm internals. ## Target Audience - Developers new to React who want a solid foundation - Intermediate React developers looking to deepen their understanding of Hooks and TypeScript patterns - Engineers who want to understand React's internal algorithms (Virt
development
# Node.js Development Skill > A practical guide collection for Node.js development. Covers all aspects of Node.js application development, including Express, NestJS, asynchronous patterns, and performance optimization. ## Overview This skill covers the following topics: - **Express & NestJS**: When to use a lightweight framework vs. an enterprise framework - **Asynchronous Patterns**: Promise, async/await, Event Emitter, Streams, Worker Threads, Cluster - **Performance Optimization**: Memory
development
# Backend Development — Complete Guide > A comprehensive guide to backend engineering. Covers the fundamentals of HTTP, REST API design, databases, authentication, environment configuration, and algorithm proofs — everything needed to build robust server-side systems. ## Target Audience - Developers new to backend engineering - Frontend engineers expanding toward full-stack development - Engineers looking to solidify their understanding of server-side fundamentals ## Prerequisites - Basic p