jpskill.com
💬 コミュニケーション コミュニティ 🟡 少し慣れが必要 👤 幅広いユーザー

💬 Performance

performance

ウェブサイトの読み込み速度を向上させ、ユーザー体験を最適化することで、サイトのパフォーマンスを改善するSkill。

⏱ お礼メール定型化 5分/通 → 30秒/通

📺 まず動画で見る(YouTube)

▶ 【最新版】Claude(クロード)完全解説!20以上の便利機能をこの動画1本で全て解説 ↗

※ jpskill.com 編集部が参考用に選んだ動画です。動画の内容と Skill の挙動は厳密には一致しないことがあります。

📜 元の英語説明(参考)

Optimize web performance for faster loading and better user experience. Use when asked to "speed up my site", "optimize performance", "reduce load time", "fix slow loading", "improve page speed", or "performance audit".

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

一言でいうと

ウェブサイトの読み込み速度を向上させ、ユーザー体験を最適化することで、サイトのパフォーマンスを改善するSkill。

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

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して performance.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → performance フォルダができる
  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-17
取得日時
2026-05-17
同梱ファイル
1

💬 こう話しかけるだけ — サンプルプロンプト

  • performance の使い方を教えて
  • performance で何ができるか具体例で見せて
  • performance を初めて使う人向けにステップを案内して

これをClaude Code に貼るだけで、このSkillが自動発動します。

📖 Skill本文(日本語訳)

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

[Skill 名] パフォーマンス

パフォーマンス最適化

Lighthouseのパフォーマンス監査に基づいた、詳細なパフォーマンス最適化です。読み込み速度、ランタイム効率、リソース最適化に焦点を当てています。

仕組み

  1. コードとアセットにおけるパフォーマンスのボトルネックを特定します。
  2. Core Web Vitalsへの影響度で優先順位を付けます。
  3. コード例を交えながら具体的な最適化策を提供します。
  4. 改善度をBefore/Afterの指標で測定します。

パフォーマンス予算

リソース 予算 根拠
総ページ容量 < 1.5 MB 3G回線で約4秒で読み込み
JavaScript (圧縮済み) < 300 KB パース + 実行時間
CSS (圧縮済み) < 100 KB レンダリングブロック
画像 (ファーストビュー) < 500 KB LCPへの影響
フォント < 100 KB FOIT/FOUTの防止
サードパーティ < 200 KB 制御不能な遅延

クリティカルレンダリングパス

サーバー応答

  • TTFB < 800ms。 Time to First Byteは高速であるべきです。CDN、キャッシング、効率的なバックエンドを使用します。
  • 圧縮を有効にする。 テキストアセットにはGzipまたはBrotliを使用します。Brotliが推奨されます(15-20%小さい)。
  • HTTP/2またはHTTP/3。 多重化により接続オーバーヘッドが削減されます。
  • エッジキャッシング。 可能であれば、CDNエッジでHTMLをキャッシュします。

リソースの読み込み

必要なオリジンへのプリコネクト:

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://cdn.example.com" crossorigin>

クリティカルなリソースのプリロード:

<!-- LCP画像 -->
<link rel="preload" href="/hero.webp" as="image" fetchpriority="high">

<!-- クリティカルなフォント -->
<link rel="preload" href="/font.woff2" as="font" type="font/woff2" crossorigin>

非クリティカルなCSSの遅延読み込み:

<!-- クリティカルなCSSをインライン化 -->
<style>/* Above-fold styles */</style>

<!-- 非クリティカルなCSS -->
<link rel="preload" href="/styles.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="/styles.css"></noscript>

JavaScriptの最適化

重要でないスクリプトの遅延読み込み:

<!-- パーサーブロック(避けるべき) -->
<script src="/critical.js"></script>

<!-- 遅延読み込み(推奨) -->
<script defer src="/app.js"></script>

<!-- 非同期(独立したスクリプト用) -->
<script async src="/analytics.js"></script>

<!-- モジュール(デフォルトで遅延読み込み) -->
<script type="module" src="/app.mjs"></script>

コード分割のパターン:

// ルートベースの分割
const Dashboard = lazy(() => import('./Dashboard'));

// コンポーネントベースの分割
const HeavyChart = lazy(() => import('./HeavyChart'));

// 機能ベースの分割
if (user.isPremium) {
  const PremiumFeatures = await import('./PremiumFeatures');
}

ツリーシェイキングのベストプラクティス:

// ❌ ライブラリ全体をインポート
import _ from 'lodash';
_.debounce(fn, 300);

// ✅ 必要なものだけをインポート
import debounce from 'lodash/debounce';
debounce(fn, 300);

画像の最適化

フォーマットの選択

フォーマット ユースケース ブラウザサポート
AVIF 写真、最高の圧縮率 92%+
WebP 写真、良好なフォールバック 97%+
PNG 透明度のあるグラフィック 汎用
SVG アイコン、ロゴ、イラスト 汎用

レスポンシブ画像

<picture>
  <!-- 最新のブラウザ向けAVIF -->
  <source 
    type="image/avif"
    srcset="hero-400.avif 400w,
            hero-800.avif 800w,
            hero-1200.avif 1200w"
    sizes="(max-width: 600px) 100vw, 50vw">

  <!-- WebPフォールバック -->
  <source 
    type="image/webp"
    srcset="hero-400.webp 400w,
            hero-800.webp 800w,
            hero-1200.webp 1200w"
    sizes="(max-width: 600px) 100vw, 50vw">

  <!-- JPEGフォールバック -->
  <img 
    src="hero-800.jpg"
    srcset="hero-400.jpg 400w,
            hero-800.jpg 800w,
            hero-1200.jpg 1200w"
    sizes="(max-width: 600px) 100vw, 50vw"
    width="1200" 
    height="600"
    alt="Hero image"
    loading="lazy"
    decoding="async">
</picture>

LCP画像の優先順位付け

<!-- ファーストビューのLCP画像: eager loading, 高優先度 -->
<img 
  src="hero.webp" 
  fetchpriority="high"
  loading="eager"
  decoding="sync"
  alt="Hero">

<!-- ファーストビューより下の画像: lazy loading -->
<img 
  src="product.webp" 
  loading="lazy"
  decoding="async"
  alt="Product">

フォントの最適化

読み込み戦略

/* フォールバックとしてのシステムフォントスタック */
body {
  font-family: 'Custom Font', -apple-system, BlinkMacSystemFont, 
               'Segoe UI', Roboto, sans-serif;
}

/* テキストの非表示を防ぐ */
@font-face {
  font-family: 'Custom Font';
  src: url('/fonts/custom.woff2') format('woff2');
  font-display: swap; /* または非クリティカルな場合はoptional */
  font-weight: 400;
  font-style: normal;
  unicode-range: U+0000-00FF; /* ラテン文字にサブセット化 */
}

クリティカルなフォントのプリロード

<link rel="preload" href="/fonts/heading.woff2" as="font" type="font/woff2" crossorigin>

可変フォント

/* 複数のウェイトの代わりに1つのファイル */
@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
}

キャッシング戦略

Cache-Controlヘッダー

# HTML (短期間またはキャッシュなし)
Cache-Control: no-cache, must-revalidate

# ハッシュ付き静的アセット (不変)
Cache-Control: public, max-age=31536000, immutable

# ハッシュなし静的アセット
Cache-Control: public, max-age=86400, stale-while-revalidate=604800

# API応答
Cache-Control: private, max-age=0, must-revalidate

サービスワーカーのキャッシング

// 静的アセットのキャッシュファースト
self.addEventListener('fetch', (event) => {
  if (event.request.destination === 'image' ||
      event.request.destination === 'style' ||
      event.request.destination === 'script') {
    event.respondWith(
      caches.match(event.request).then((cached) => {
        return cached || fetch(event.request).then((response) => {
          const clone = response.clone();
          caches.open('static-v1').then((cache) => cache.put(event.request, clone));
          return response;
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Performance optimization

Deep performance optimization based on Lighthouse performance audits. Focuses on loading speed, runtime efficiency, and resource optimization.

How it works

  1. Identify performance bottlenecks in code and assets
  2. Prioritize by impact on Core Web Vitals
  3. Provide specific optimizations with code examples
  4. Measure improvement with before/after metrics

Performance budget

Resource Budget Rationale
Total page weight < 1.5 MB 3G loads in ~4s
JavaScript (compressed) < 300 KB Parsing + execution time
CSS (compressed) < 100 KB Render blocking
Images (above-fold) < 500 KB LCP impact
Fonts < 100 KB FOIT/FOUT prevention
Third-party < 200 KB Uncontrolled latency

Critical rendering path

Server response

  • TTFB < 800ms. Time to First Byte should be fast. Use CDN, caching, and efficient backends.
  • Enable compression. Gzip or Brotli for text assets. Brotli preferred (15-20% smaller).
  • HTTP/2 or HTTP/3. Multiplexing reduces connection overhead.
  • Edge caching. Cache HTML at CDN edge when possible.

Resource loading

Preconnect to required origins:

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://cdn.example.com" crossorigin>

Preload critical resources:

<!-- LCP image -->
<link rel="preload" href="/hero.webp" as="image" fetchpriority="high">

<!-- Critical font -->
<link rel="preload" href="/font.woff2" as="font" type="font/woff2" crossorigin>

Defer non-critical CSS:

<!-- Critical CSS inlined -->
<style>/* Above-fold styles */</style>

<!-- Non-critical CSS -->
<link rel="preload" href="/styles.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="/styles.css"></noscript>

JavaScript optimization

Defer non-essential scripts:

<!-- Parser-blocking (avoid) -->
<script src="/critical.js"></script>

<!-- Deferred (preferred) -->
<script defer src="/app.js"></script>

<!-- Async (for independent scripts) -->
<script async src="/analytics.js"></script>

<!-- Module (deferred by default) -->
<script type="module" src="/app.mjs"></script>

Code splitting patterns:

// Route-based splitting
const Dashboard = lazy(() => import('./Dashboard'));

// Component-based splitting
const HeavyChart = lazy(() => import('./HeavyChart'));

// Feature-based splitting
if (user.isPremium) {
  const PremiumFeatures = await import('./PremiumFeatures');
}

Tree shaking best practices:

// ❌ Imports entire library
import _ from 'lodash';
_.debounce(fn, 300);

// ✅ Imports only what's needed
import debounce from 'lodash/debounce';
debounce(fn, 300);

Image optimization

Format selection

Format Use case Browser support
AVIF Photos, best compression 92%+
WebP Photos, good fallback 97%+
PNG Graphics with transparency Universal
SVG Icons, logos, illustrations Universal

Responsive images

<picture>
  <!-- AVIF for modern browsers -->
  <source 
    type="image/avif"
    srcset="hero-400.avif 400w,
            hero-800.avif 800w,
            hero-1200.avif 1200w"
    sizes="(max-width: 600px) 100vw, 50vw">

  <!-- WebP fallback -->
  <source 
    type="image/webp"
    srcset="hero-400.webp 400w,
            hero-800.webp 800w,
            hero-1200.webp 1200w"
    sizes="(max-width: 600px) 100vw, 50vw">

  <!-- JPEG fallback -->
  <img 
    src="hero-800.jpg"
    srcset="hero-400.jpg 400w,
            hero-800.jpg 800w,
            hero-1200.jpg 1200w"
    sizes="(max-width: 600px) 100vw, 50vw"
    width="1200" 
    height="600"
    alt="Hero image"
    loading="lazy"
    decoding="async">
</picture>

LCP image priority

<!-- Above-fold LCP image: eager loading, high priority -->
<img 
  src="hero.webp" 
  fetchpriority="high"
  loading="eager"
  decoding="sync"
  alt="Hero">

<!-- Below-fold images: lazy loading -->
<img 
  src="product.webp" 
  loading="lazy"
  decoding="async"
  alt="Product">

Font optimization

Loading strategy

/* System font stack as fallback */
body {
  font-family: 'Custom Font', -apple-system, BlinkMacSystemFont, 
               'Segoe UI', Roboto, sans-serif;
}

/* Prevent invisible text */
@font-face {
  font-family: 'Custom Font';
  src: url('/fonts/custom.woff2') format('woff2');
  font-display: swap; /* or optional for non-critical */
  font-weight: 400;
  font-style: normal;
  unicode-range: U+0000-00FF; /* Subset to Latin */
}

Preloading critical fonts

<link rel="preload" href="/fonts/heading.woff2" as="font" type="font/woff2" crossorigin>

Variable fonts

/* One file instead of multiple weights */
@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
}

Caching strategy

Cache-Control headers

# HTML (short or no cache)
Cache-Control: no-cache, must-revalidate

# Static assets with hash (immutable)
Cache-Control: public, max-age=31536000, immutable

# Static assets without hash
Cache-Control: public, max-age=86400, stale-while-revalidate=604800

# API responses
Cache-Control: private, max-age=0, must-revalidate

Service worker caching

// Cache-first for static assets
self.addEventListener('fetch', (event) => {
  if (event.request.destination === 'image' ||
      event.request.destination === 'style' ||
      event.request.destination === 'script') {
    event.respondWith(
      caches.match(event.request).then((cached) => {
        return cached || fetch(event.request).then((response) => {
          const clone = response.clone();
          caches.open('static-v1').then((cache) => cache.put(event.request, clone));
          return response;
        });
      })
    );
  }
});

Runtime performance

Avoid layout thrashing

// ❌ Forces multiple reflows
elements.forEach(el => {
  const height = el.offsetHeight; // Read
  el.style.height = height + 10 + 'px'; // Write
});

// ✅ Batch reads, then batch writes
const heights = elements.map(el => el.offsetHeight); // All reads
elements.forEach((el, i) => {
  el.style.height = heights[i] + 10 + 'px'; // All writes
});

Debounce expensive operations

function debounce(fn, delay) {
  let timeout;
  return (...args) => {
    clearTimeout(timeout);
    timeout = setTimeout(() => fn(...args), delay);
  };
}

// Debounce scroll/resize handlers
window.addEventListener('scroll', debounce(handleScroll, 100));

Use requestAnimationFrame

// ❌ May cause jank
setInterval(animate, 16);

// ✅ Synced with display refresh
function animate() {
  // Animation logic
  requestAnimationFrame(animate);
}
requestAnimationFrame(animate);

Virtualize long lists

// For lists > 100 items, render only visible items
// Use libraries like react-window, vue-virtual-scroller, or native CSS:
.virtual-list {
  content-visibility: auto;
  contain-intrinsic-size: 0 50px; /* Estimated item height */
}

Third-party scripts

Load strategies

// ❌ Blocks main thread
<script src="https://analytics.example.com/script.js"></script>

// ✅ Async loading
<script async src="https://analytics.example.com/script.js"></script>

// ✅ Delay until interaction
<script>
document.addEventListener('DOMContentLoaded', () => {
  const observer = new IntersectionObserver((entries) => {
    if (entries[0].isIntersecting) {
      const script = document.createElement('script');
      script.src = 'https://widget.example.com/embed.js';
      document.body.appendChild(script);
      observer.disconnect();
    }
  });
  observer.observe(document.querySelector('#widget-container'));
});
</script>

Facade pattern

<!-- Show static placeholder until interaction -->
<div class="youtube-facade" 
     data-video-id="abc123" 
     onclick="loadYouTube(this)">
  <img src="/thumbnails/abc123.jpg" alt="Video title">
  <button aria-label="Play video">▶</button>
</div>

Measurement

Key metrics

Metric Target Tool
LCP < 2.5s Lighthouse, CrUX
FCP < 1.8s Lighthouse
Speed Index < 3.4s Lighthouse
TBT < 200ms Lighthouse
TTI < 3.8s Lighthouse

Testing commands

# Lighthouse CLI
npx lighthouse https://example.com --output html --output-path report.html

# Web Vitals library
import {onLCP, onINP, onCLS} from 'web-vitals';
onLCP(console.log);
onINP(console.log);
onCLS(console.log);

References

For Core Web Vitals specific optimizations, see Core Web Vitals.