jpskill.com
📦 その他 コミュニティ

optimize

ウェブサイトやアプリの表示速度、画像、アニメーションなどを改善し、ユーザー体験をより速くスムーズにするための、インターフェースパフォーマンスを最適化するSkill。

📜 元の英語説明(参考)

Improve interface performance across loading speed, rendering, animations, images, and bundle size. Makes experiences faster and smoother.

🇯🇵 日本人クリエイター向け解説

一言でいうと

ウェブサイトやアプリの表示速度、画像、アニメーションなどを改善し、ユーザー体験をより速くスムーズにするための、インターフェースパフォーマンスを最適化するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o optimize.zip https://jpskill.com/download/19789.zip && unzip -o optimize.zip && rm optimize.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/19789.zip -OutFile "$d\optimize.zip"; Expand-Archive "$d\optimize.zip" -DestinationPath $d -Force; ri "$d\optimize.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して optimize.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → optimize フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

[スキル名] 最適化

より速く、よりスムーズなユーザーエクスペリエンスを実現するために、パフォーマンスの問題を特定して修正します。

パフォーマンスの問題を評価する

現在のパフォーマンスを理解し、問題を特定します。

  1. 現在の状態を測定する:

    • Core Web Vitals: LCP、FID/INP、CLS スコア
    • 読み込み時間: インタラクティブになるまでの時間、最初のコンテンツの描画
    • バンドルサイズ: JavaScript、CSS、画像サイズ
    • ランタイムパフォーマンス: フレームレート、メモリ使用量、CPU 使用量
    • ネットワーク: リクエスト数、ペイロードサイズ、ウォーターフォール
  2. ボトルネックを特定する:

    • 何が遅いですか?(初期読み込み?インタラクション?アニメーション?)
    • 何が原因ですか?(大きな画像?重い JavaScript?レイアウトスラッシング?)
    • どれくらいひどいですか?(知覚できる?イライラする?ブロックしている?)
    • 誰が影響を受けていますか?(すべてのユーザー?モバイルのみ?低速接続?)

重要: 測定は前後で行ってください。時期尚早な最適化は時間の無駄です。実際に重要なものを最適化しましょう。

最適化戦略

体系的な改善計画を作成します。

読み込みパフォーマンス

画像を最適化する:

  • 最新のフォーマット(WebP、AVIF)を使用する
  • 適切なサイズにする(300px表示のために3000pxの画像を読み込まない)
  • スクロール領域外の画像は遅延読み込みする
  • レスポンシブ画像(srcsetpicture要素)
  • 画像を圧縮する(80-85%の品質は通常知覚できません)
  • 高速配信のために CDN を使用する
<img 
  src="hero.webp"
  srcset="hero-400.webp 400w, hero-800.webp 800w, hero-1200.webp 1200w"
  sizes="(max-width: 400px) 400px, (max-width: 800px) 800px, 1200px"
  loading="lazy"
  alt="Hero image"
/>

JavaScript バンドルを削減する:

  • コード分割(ルートベース、コンポーネントベース)
  • ツリーシェイキング(未使用コードの削除)
  • 未使用の依存関係を削除する
  • 非クリティカルなコードを遅延読み込みする
  • 大きなコンポーネントには動的インポートを使用する
// 重いコンポーネントを遅延読み込みする
const HeavyChart = lazy(() => import('./HeavyChart'));

CSS を最適化する:

  • 未使用の CSS を削除する
  • クリティカル CSS はインライン化し、残りは非同期にする
  • CSS ファイルを最小化する
  • 独立した領域には CSS containment を使用する

フォントを最適化する:

  • font-display: swap または optional を使用する
  • フォントをサブセット化する(必要な文字のみ)
  • クリティカルなフォントをプリロードする
  • 適切な場合はシステムフォントを使用する
  • 読み込むフォントウェイトを制限する
@font-face {
  font-family: 'CustomFont';
  src: url('/fonts/custom.woff2') format('woff2');
  font-display: swap; /* フォールバックをすぐに表示する */
  unicode-range: U+0020-007F; /* 基本ラテン文字のみ */
}

読み込み戦略を最適化する:

  • クリティカルなリソースを最初に(非クリティカルなものは async/defer)
  • クリティカルなアセットをプリロードする
  • 次の可能性のあるページをプリフェッチする
  • オフライン/キャッシュのためにサービスワーカーを使用する
  • 多重化のために HTTP/2 または HTTP/3 を使用する

レンダリングパフォーマンス

レイアウトスラッシングを避ける:

// ❌ 悪い例: 読み取りと書き込みを交互に行う(リフローを引き起こす)
elements.forEach(el => {
  const height = el.offsetHeight; // 読み取り(レイアウトを強制する)
  el.style.height = height * 2; // 書き込み
});

// ✅ 良い例: 読み取りをまとめて行い、次に書き込みをまとめて行う
const heights = elements.map(el => el.offsetHeight); // すべての読み取り
elements.forEach((el, i) => {
  el.style.height = heights[i] * 2; // すべての書き込み
});

レンダリングを最適化する:

  • 独立した領域には CSS の contain プロパティを使用する
  • DOM の深さを最小限にする(フラットな方が速い)
  • DOM サイズを削減する(要素数を減らす)
  • 長いリストには content-visibility: auto を使用する
  • 非常に長いリストには仮想スクロールを使用する(react-window、react-virtualized)

描画と合成を削減する:

  • アニメーションには transformopacity を使用する(GPU アクセラレーション)
  • レイアウトプロパティ(width、height、top、left)のアニメーションは避ける
  • 既知の重い操作には will-change を控えめに使用する
  • 描画領域を最小限にする(小さい方が速い)

アニメーションパフォーマンス

GPU アクセラレーション:

/* ✅ GPU アクセラレーション(高速) */
.animated {
  transform: translateX(100px);
  opacity: 0.5;
}

/* ❌ CPU 依存(低速) */
.animated {
  left: 100px;
  width: 300px;
}

スムーズな 60fps:

  • 1フレームあたり16ms(60fps)を目標にする
  • JS アニメーションには requestAnimationFrame を使用する
  • スクロールハンドラをデバウンス/スロットルする
  • 可能な場合は CSS アニメーションを使用する
  • アニメーション中に長時間実行される JavaScript を避ける

Intersection Observer:

// 要素がビューポートに入ったことを効率的に検出する
const observer = new IntersectionObserver((entries) => {
  entries.forEach(entry => {
    if (entry.isIntersecting) {
      // 要素が表示されているので、遅延読み込みまたはアニメーションを行う
    }
  });
});

React/フレームワークの最適化

React 固有:

  • 重いコンポーネントには memo() を使用する
  • 重い計算には useMemo()useCallback() を使用する
  • 長いリストを仮想化する
  • ルートをコード分割する
  • レンダリング時にインライン関数を作成しない
  • React DevTools Profiler を使用する

フレームワークに依存しない:

  • 再レンダリングを最小限にする
  • 重い操作をデバウンスする
  • 計算された値をメモ化する
  • ルートとコンポーネントを遅延読み込みする

ネットワークの最適化

リクエストを削減する:

  • 小さなファイルを結合する
  • アイコンには SVG スプライトを使用する
  • 小さなクリティカルなアセットをインライン化する
  • 未使用のサードパーティスクリプトを削除する

API を最適化する:

  • ページネーションを使用する(すべてを読み込まない)
  • GraphQL で必要なフィールドのみをリクエストする
  • レスポンス圧縮(gzip、brotli)
  • HTTP キャッシュヘッダー
  • 静的アセットには CDN を使用する

低速接続向けに最適化する:

  • 接続状況に応じた適応型読み込み(navigator.connection)
  • オプティミスティック UI 更新
  • リクエストの優先順位付け
  • プログレッシブエンハンスメント

Core Web Vitals の最適化

Largest Contentful Paint (LCP < 2.5秒)

  • ヒーロー画像を最適化する
  • クリティカル CSS をインライン化する
  • 主要なリソースをプリロードする
  • CDN を使用する
  • サーバーサイドレンダリング

First Input Delay (FID < 100ms) / INP (< 200ms)

  • 長いタスクを分割する
  • 非クリティカルな JavaScript を遅延させる
  • 重い計算には Web Worker を使用する
  • JavaScript の実行時間を短縮する

Cumulative Layout Shift (CLS < 0.1)

  • 画像と動画に寸法を設定する
  • 既存のコンテンツの上にコンテンツを挿入しない
  • aspect-ratio CSS プロパティを使用する
  • 広告/埋め込みのためにスペースを確保する
  • レイアウトシフトを引き起こすアニメーションは避ける
/* 画像のためにスペースを確保する */
.image-container {
  aspect-ratio: 16 / 9;
}

パフォーマンス監視

使用するツール:

  • Chrome DevTools (Lighthouse、Performance パネル)
  • Web
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Identify and fix performance issues to create faster, smoother user experiences.

Assess Performance Issues

Understand current performance and identify problems:

  1. Measure current state:

    • Core Web Vitals: LCP, FID/INP, CLS scores
    • Load time: Time to interactive, first contentful paint
    • Bundle size: JavaScript, CSS, image sizes
    • Runtime performance: Frame rate, memory usage, CPU usage
    • Network: Request count, payload sizes, waterfall
  2. Identify bottlenecks:

    • What's slow? (Initial load? Interactions? Animations?)
    • What's causing it? (Large images? Expensive JavaScript? Layout thrashing?)
    • How bad is it? (Perceivable? Annoying? Blocking?)
    • Who's affected? (All users? Mobile only? Slow connections?)

CRITICAL: Measure before and after. Premature optimization wastes time. Optimize what actually matters.

Optimization Strategy

Create systematic improvement plan:

Loading Performance

Optimize Images:

  • Use modern formats (WebP, AVIF)
  • Proper sizing (don't load 3000px image for 300px display)
  • Lazy loading for below-fold images
  • Responsive images (srcset, picture element)
  • Compress images (80-85% quality is usually imperceptible)
  • Use CDN for faster delivery
<img 
  src="hero.webp"
  srcset="hero-400.webp 400w, hero-800.webp 800w, hero-1200.webp 1200w"
  sizes="(max-width: 400px) 400px, (max-width: 800px) 800px, 1200px"
  loading="lazy"
  alt="Hero image"
/>

Reduce JavaScript Bundle:

  • Code splitting (route-based, component-based)
  • Tree shaking (remove unused code)
  • Remove unused dependencies
  • Lazy load non-critical code
  • Use dynamic imports for large components
// Lazy load heavy component
const HeavyChart = lazy(() => import('./HeavyChart'));

Optimize CSS:

  • Remove unused CSS
  • Critical CSS inline, rest async
  • Minimize CSS files
  • Use CSS containment for independent regions

Optimize Fonts:

  • Use font-display: swap or optional
  • Subset fonts (only characters you need)
  • Preload critical fonts
  • Use system fonts when appropriate
  • Limit font weights loaded
@font-face {
  font-family: 'CustomFont';
  src: url('/fonts/custom.woff2') format('woff2');
  font-display: swap; /* Show fallback immediately */
  unicode-range: U+0020-007F; /* Basic Latin only */
}

Optimize Loading Strategy:

  • Critical resources first (async/defer non-critical)
  • Preload critical assets
  • Prefetch likely next pages
  • Service worker for offline/caching
  • HTTP/2 or HTTP/3 for multiplexing

Rendering Performance

Avoid Layout Thrashing:

// ❌ Bad: Alternating reads and writes (causes reflows)
elements.forEach(el => {
  const height = el.offsetHeight; // Read (forces layout)
  el.style.height = height * 2; // Write
});

// ✅ Good: Batch reads, then batch writes
const heights = elements.map(el => el.offsetHeight); // All reads
elements.forEach((el, i) => {
  el.style.height = heights[i] * 2; // All writes
});

Optimize Rendering:

  • Use CSS contain property for independent regions
  • Minimize DOM depth (flatter is faster)
  • Reduce DOM size (fewer elements)
  • Use content-visibility: auto for long lists
  • Virtual scrolling for very long lists (react-window, react-virtualized)

Reduce Paint & Composite:

  • Use transform and opacity for animations (GPU-accelerated)
  • Avoid animating layout properties (width, height, top, left)
  • Use will-change sparingly for known expensive operations
  • Minimize paint areas (smaller is faster)

Animation Performance

GPU Acceleration:

/* ✅ GPU-accelerated (fast) */
.animated {
  transform: translateX(100px);
  opacity: 0.5;
}

/* ❌ CPU-bound (slow) */
.animated {
  left: 100px;
  width: 300px;
}

Smooth 60fps:

  • Target 16ms per frame (60fps)
  • Use requestAnimationFrame for JS animations
  • Debounce/throttle scroll handlers
  • Use CSS animations when possible
  • Avoid long-running JavaScript during animations

Intersection Observer:

// Efficiently detect when elements enter viewport
const observer = new IntersectionObserver((entries) => {
  entries.forEach(entry => {
    if (entry.isIntersecting) {
      // Element is visible, lazy load or animate
    }
  });
});

React/Framework Optimization

React-specific:

  • Use memo() for expensive components
  • useMemo() and useCallback() for expensive computations
  • Virtualize long lists
  • Code split routes
  • Avoid inline function creation in render
  • Use React DevTools Profiler

Framework-agnostic:

  • Minimize re-renders
  • Debounce expensive operations
  • Memoize computed values
  • Lazy load routes and components

Network Optimization

Reduce Requests:

  • Combine small files
  • Use SVG sprites for icons
  • Inline small critical assets
  • Remove unused third-party scripts

Optimize APIs:

  • Use pagination (don't load everything)
  • GraphQL to request only needed fields
  • Response compression (gzip, brotli)
  • HTTP caching headers
  • CDN for static assets

Optimize for Slow Connections:

  • Adaptive loading based on connection (navigator.connection)
  • Optimistic UI updates
  • Request prioritization
  • Progressive enhancement

Core Web Vitals Optimization

Largest Contentful Paint (LCP < 2.5s)

  • Optimize hero images
  • Inline critical CSS
  • Preload key resources
  • Use CDN
  • Server-side rendering

First Input Delay (FID < 100ms) / INP (< 200ms)

  • Break up long tasks
  • Defer non-critical JavaScript
  • Use web workers for heavy computation
  • Reduce JavaScript execution time

Cumulative Layout Shift (CLS < 0.1)

  • Set dimensions on images and videos
  • Don't inject content above existing content
  • Use aspect-ratio CSS property
  • Reserve space for ads/embeds
  • Avoid animations that cause layout shifts
/* Reserve space for image */
.image-container {
  aspect-ratio: 16 / 9;
}

Performance Monitoring

Tools to use:

  • Chrome DevTools (Lighthouse, Performance panel)
  • WebPageTest
  • Core Web Vitals (Chrome UX Report)
  • Bundle analyzers (webpack-bundle-analyzer)
  • Performance monitoring (Sentry, DataDog, New Relic)

Key metrics:

  • LCP, FID/INP, CLS (Core Web Vitals)
  • Time to Interactive (TTI)
  • First Contentful Paint (FCP)
  • Total Blocking Time (TBT)
  • Bundle size
  • Request count

IMPORTANT: Measure on real devices with real network conditions. Desktop Chrome with fast connection isn't representative.

NEVER:

  • Optimize without measuring (premature optimization)
  • Sacrifice accessibility for performance
  • Break functionality while optimizing
  • Use will-change everywhere (creates new layers, uses memory)
  • Lazy load above-fold content
  • Optimize micro-optimizations while ignoring major issues (optimize the biggest bottleneck first)
  • Forget about mobile performance (often slower devices, slower connections)

Verify Improvements

Test that optimizations worked:

  • Before/after metrics: Compare Lighthouse scores
  • Real user monitoring: Track improvements for real users
  • Different devices: Test on low-end Android, not just flagship iPhone
  • Slow connections: Throttle to 3G, test experience
  • No regressions: Ensure functionality still works
  • User perception: Does it feel faster?

Remember: Performance is a feature. Fast experiences feel more responsive, more polished, more professional. Optimize systematically, measure ruthlessly, and prioritize user-perceived performance.