jpskill.com
🛠️ 開発・MCP コミュニティ

wp-performance

Use when investigating or improving WordPress performance (backend-only agent): profiling and measurement (WP-CLI profile/doctor, Server-Timing, Query Monitor via REST headers), database/query optimization, autoloaded options, object caching, cron, HTTP API calls, and safe verification.

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

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

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

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

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

📖 Skill本文(日本語訳)

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

WP Performance (バックエンドのみ)

どのような時に使うか

このスキルは、以下のような場合に利用します。

  • WordPress のサイト/ページ/エンドポイントが遅い場合 (フロントエンドの TTFB、管理画面、REST、WP-Cron)
  • プロファイリング計画とツールに関する推奨事項が必要な場合 (WP-CLI の profile/doctor、Query Monitor、Xdebug/XHProf、APM)
  • DB クエリ、自動ロードされるオプション、オブジェクトキャッシュ、cron タスク、またはリモート HTTP コールを最適化する場合

このスキルは、エージェントがブラウザ UI を使用できないことを前提としています。WP-CLI、ログ、および HTTP リクエストを優先します。

必要な入力

  • 環境と安全性: 開発/ステージング/本番環境、制限事項 (書き込み不可、プラグインのインストール不可など)。
  • インストール対象の指定方法:
    • WP ルート --path=<path>
    • (マルチサイト/サイトの対象指定) --url=<url>
  • パフォーマンスの症状と範囲:
    • 対象の URL/REST ルート/管理画面
    • いつ発生するか (常に発生するか、断続的か。ログインしているか、ログアウトしているか)

手順

0) ガードレール: 最初に測定し、リスクの高い操作は避ける

  1. 書き込み操作 (プラグインのインストール、設定変更、キャッシュのフラッシュ) を実行できるかどうかを確認します。
  2. 再現可能なターゲット (URL または REST ルート) を選択し、ベースラインをキャプチャします。
    • 可能であれば curl で TTFB/時間
    • 利用可能であれば WP-CLI プロファイリング

参照:

  • references/measurement.md

1) バックエンドのみのパフォーマンスレポートを生成する (決定的)

以下を実行します。

  • node skills/wp-performance/scripts/perf_inspect.mjs --path=<path> [--url=<url>]

これにより、以下が検出されます。

  • WP-CLI の可用性とコアバージョン
  • wp doctor / wp profile が利用可能かどうか
  • 自動ロードされるオプションのサイズ (可能な場合)
  • オブジェクトキャッシュのドロップインの存在

2) 手軽な改善: 詳細なプロファイリングの前に診断を実行する

WP-CLI にアクセスできる場合は、以下を優先します。

  • wp doctor check

これは、一般的な本番環境での失敗 (自動ロードの肥大化、SAVEQUERIES/WP_DEBUG、プラグインの数、アップデート) を検出します。

参照:

  • references/wp-cli-doctor.md

3) 詳細なプロファイリング (ブラウザは不要)

推奨される順序:

  1. wp profile stage を実行して、どこに時間がかかっているかを確認します (bootstrap/main_query/template)。
  2. wp profile hook (必要に応じて --url=) を実行して、遅いフック/コールバックを見つけます。
  3. ターゲットを絞ったコードパスに対して wp profile eval を実行します。

参照:

  • references/wp-cli-profile.md

4) Query Monitor (バックエンドのみの使用)

Query Monitor は通常 UI 主導ですが、REST API レスポンスヘッダーと _envelope レスポンスを介してヘッドレスで使用できます。

  • 認証 (nonce または Application Password)。
  • REST レスポンスをリクエストし、ヘッダー (x-qm-*) および/または ?_envelope を使用する場合の qm プロパティを検査します。

参照:

  • references/query-monitor-headless.md

5) カテゴリ別に修正する (主要なボトルネックを選択する)

プロファイル出力を使用して、1 つの主要なボトルネックカテゴリを選択します。

  • DB クエリ → クエリ数を減らし、N+1 パターンを修正し、インデックスを改善し、コストのかかるメタクエリを回避します。
    • references/database.md
  • 自動ロードされるオプション → 最大の自動ロードされるオプションを特定し、大きな blob の自動ロードを停止します。
    • references/autoload-options.md
  • オブジェクトキャッシュのミス → キャッシュを導入するか、キャッシュキー/グループの使用法を修正します。必要に応じて永続的なオブジェクトキャッシュを追加します。
    • references/object-cache.md
  • リモート HTTP コール → タイムアウト、キャッシュ、バッチ処理を追加します。すべてのリクエストでリモート API を呼び出すことを避けます。
    • references/http-api.md
  • Cron → 現在実行する必要のあるスパイクを減らし、イベントの重複を排除し、負荷の高いタスクをリクエストパスから移動します。
    • references/cron.md

6) 検証 (同じ測定を繰り返す)

  • 同じ wp profile / wp doctor / REST リクエストを再実行します。
  • パフォーマンスの差と動作が変わっていないことを確認します。
  • 修正がリスクの高い場合は、可能な限りフィーチャーフラグまたは段階的なロールアウトの背後に出荷します。

WordPress 6.9 のパフォーマンス改善

プロファイリングを行う際は、これらの 6.9 の変更に注意してください。

クラシックテーマのオンデマンド CSS:

  • クラシックテーマは、オンデマンド CSS ローディングを取得するようになりました (以前はブロックテーマのみがこれを持っていました)。
  • ページで使用されているブロックのスタイルのみをロードすることにより、CSS ペイロードを 30〜65% 削減します。
  • クラシックテーマをプロファイリングしている場合、これはすでに役立っているはずです。

レンダリングをブロックするリソースがないブロックテーマ:

  • カスタムスタイルシート (Twenty Twenty-Three/Four など) を定義しないブロックテーマは、レンダリングをブロックする CSS なしでロードできるようになりました。
  • スタイルは、グローバルスタイル (theme.json) と個別のブロックスタイルから取得され、すべてインライン化されます。
  • これにより、LCP (Largest Contentful Paint) が大幅に向上します。

インライン CSS の制限が増加:

  • 小さなスタイルシートをインライン化するためのしきい値が引き上げられ、レンダリングをブロックするリソースが削減されました。

参照: https://make.wordpress.org/core/2025/11/18/wordpress-6-9-frontend-performance-field-guide/

検証

  • ベースラインと修正後の数値がキャプチャされていること (同じ環境、同じ URL/ルート)。
  • wp doctor check がクリーンである (または改善されている) こと (該当する場合)。
  • ログに新しい PHP エラーまたは警告がないこと。
  • 正確性のためにキャッシュのフラッシュが必要ないこと (キャッシュのフラッシュは最後の手段である必要があります)。

失敗モード/デバッグ

  • コード変更後に「変化なし」:
    • 別の URL/サイト (--url の不一致) を測定したか、キャッシュが結果をマスクしたか、または opcode キャッシュが古くなっています。
  • プロファイリングデータがノイズが多い:
    • バックグラウンドタスクを排除し、ウォームキャッシュでテストし、複数のサンプルを実行します。
  • SAVEQUERIES/Query Monitor がオーバーヘッドを引き起こす:
    • 明示的に承認されない限り、本番環境では実行しないでください。

エスカレーション

  • これが本番環境であり、明示的な承認がない場合は、以下を行わないでください。
    • プラグインのインストール、SAVEQUERIES の有効化、ロードテストの実行、またはトラフィック中のキャッシュのフラッシュ
  • システムレベルのプロファイリング (APM、PHP プロファイラー拡張機能) が必要な場合は、運用/ホスティングと連携してください。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

WP Performance (backend-only)

When to use

Use this skill when:

  • a WordPress site/page/endpoint is slow (frontend TTFB, admin, REST, WP-Cron)
  • you need a profiling plan and tooling recommendations (WP-CLI profile/doctor, Query Monitor, Xdebug/XHProf, APMs)
  • you’re optimizing DB queries, autoloaded options, object caching, cron tasks, or remote HTTP calls

This skill assumes the agent cannot use a browser UI. Prefer WP-CLI, logs, and HTTP requests.

Inputs required

  • Environment and safety: dev/staging/prod, any restrictions (no writes, no plugin installs).
  • How to target the install:
    • WP root --path=<path>
    • (multisite/site targeting) --url=<url>
  • The performance symptom and scope:
    • which URL/REST route/admin screen
    • when it happens (always vs sporadic; logged-in vs logged-out)

Procedure

0) Guardrails: measure first, avoid risky ops

  1. Confirm whether you may run write operations (plugin installs, config changes, cache flush).
  2. Pick a reproducible target (URL or REST route) and capture a baseline:
    • TTFB/time with curl if possible
    • WP-CLI profiling if available

Read:

  • references/measurement.md

1) Generate a backend-only performance report (deterministic)

Run:

  • node skills/wp-performance/scripts/perf_inspect.mjs --path=<path> [--url=<url>]

This detects:

  • WP-CLI availability and core version
  • whether wp doctor / wp profile are available
  • autoloaded options size (if possible)
  • object-cache drop-in presence

2) Fast wins: run diagnostics before deep profiling

If you have WP-CLI access, prefer:

  • wp doctor check

It catches common production foot-guns (autoload bloat, SAVEQUERIES/WP_DEBUG, plugin counts, updates).

Read:

  • references/wp-cli-doctor.md

3) Deep profiling (no browser required)

Preferred order:

  1. wp profile stage to see where time goes (bootstrap/main_query/template).
  2. wp profile hook (optionally with --url=) to find slow hooks/callbacks.
  3. wp profile eval for targeted code paths.

Read:

  • references/wp-cli-profile.md

4) Query Monitor (backend-only usage)

Query Monitor is normally UI-driven, but it can be used headlessly via REST API response headers and _envelope responses:

  • Authenticate (nonce or Application Password).
  • Request REST responses and inspect headers (x-qm-*) and/or the qm property when using ?_envelope.

Read:

  • references/query-monitor-headless.md

5) Fix by category (choose the dominant bottleneck)

Use the profile output to pick one primary bottleneck category:

  • DB queries → reduce query count, fix N+1 patterns, improve indexes, avoid expensive meta queries.
    • references/database.md
  • Autoloaded options → identify the biggest autoloaded options and stop autoloading large blobs.
    • references/autoload-options.md
  • Object cache misses → introduce caching or fix cache key/group usage; add persistent object cache where appropriate.
    • references/object-cache.md
  • Remote HTTP calls → add timeouts, caching, batching; avoid calling remote APIs on every request.
    • references/http-api.md
  • Cron → reduce due-now spikes, de-duplicate events, move heavy tasks out of request paths.
    • references/cron.md

6) Verify (repeat the same measurement)

  • Re-run the same wp profile / wp doctor / REST request.
  • Confirm the performance delta and that behavior is unchanged.
  • If the fix is risky, ship behind a feature flag or staged rollout when possible.

WordPress 6.9 performance improvements

Be aware of these 6.9 changes when profiling:

On-demand CSS for classic themes:

  • Classic themes now get on-demand CSS loading (previously only block themes had this).
  • Reduces CSS payload by 30-65% by only loading styles for blocks actually used on the page.
  • If you're profiling a classic theme, this should already be helping.

Block themes with no render-blocking resources:

  • Block themes that don't define custom stylesheets (like Twenty Twenty-Three/Four) can now load with zero render-blocking CSS.
  • Styles come from global styles (theme.json) and separate block styles, all inlined.
  • This significantly improves LCP (Largest Contentful Paint).

Inline CSS limit increased:

  • The threshold for inlining small stylesheets has been raised, reducing render-blocking resources.

Reference: https://make.wordpress.org/core/2025/11/18/wordpress-6-9-frontend-performance-field-guide/

Verification

  • Baseline vs after numbers are captured (same environment, same URL/route).
  • wp doctor check is clean (or improved) when applicable.
  • No new PHP errors or warnings in logs.
  • No cache flush is required for correctness (cache flush should be last resort).

Failure modes / debugging

  • “No change” after code changes:
    • you measured a different URL/site (--url mismatch), caches masked results, or opcode cache is stale
  • Profiling data is noisy:
    • eliminate background tasks, test with warmed caches, run multiple samples
  • SAVEQUERIES/Query Monitor causes overhead:
    • don’t run in production unless explicitly approved

Escalation

  • If this is production and you don’t have explicit approval, do not:
    • install plugins, enable SAVEQUERIES, run load tests, or flush caches during traffic
  • If you need system-level profiling (APM, PHP profiler extensions), coordinate with ops/hosting.

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。