jpskill.com
💼 ビジネス コミュニティ

wp-wpcli-and-ops

WordPressの運用を効率化するため、WP-CLIを使って安全な検索・置換、データベース操作、プラグイン管理、自動化スクリプト実行など、様々な作業を簡単に行えるようにするSkill。

📜 元の英語説明(参考)

Use when working with WP-CLI (wp) for WordPress operations: safe search-replace, db export/import, plugin/theme/user/content management, cron, cache flushing, multisite, and scripting/automation with wp-cli.yml.

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

一言でいうと

WordPressの運用を効率化するため、WP-CLIを使って安全な検索・置換、データベース操作、プラグイン管理、自動化スクリプト実行など、様々な作業を簡単に行えるようにするSkill。

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

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

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

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

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

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

📖 Skill本文(日本語訳)

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

WP-CLI と運用

どのような時に使うか

このスキルは、以下を含む WP-CLI を介した WordPress の運用作業を行う際に使用します。

  • wp search-replace (URL の変更、ドメインの移行、プロトコルの切り替え)
  • DB のエクスポート/インポート、リセット、および検査 (wp db *)
  • プラグイン/テーマのインストール/アクティブ化/更新、言語パック
  • cron イベントのリスト表示/実行
  • キャッシュ/リライトのフラッシュ
  • マルチサイトの操作 (wp site *, --url, --network)
  • 反復可能なスクリプトの構築 (wp-cli.yml、シェルスクリプト、CI ジョブ)

必要な入力

  • WP-CLI をどこで実行するか (ローカル開発、ステージング、本番) と、実行しても安全かどうか。
  • 正しいサイトルートをターゲットにする方法:
    • --path=<wordpress-root> および (マルチサイト) --url=<site-url>
  • これがマルチサイトであるかどうか、およびコマンドをネットワーク全体で実行する必要があるかどうか。
  • 制約 (ダウンタイムなし、DB 書き込みなし、メンテナンスウィンドウ)。

手順

0) 安全対策: 環境と影響範囲の確認

WP-CLI コマンドは破壊的な可能性があります。書き込みを行うコマンドを実行する前に:

  1. 環境 (開発/ステージング/本番) を確認します。
  2. (パス/URL) のターゲットを確認して、間違ったサイトにアクセスしないようにします。
  3. リスクの高い操作を実行する場合は、バックアップを作成します。

参照:

  • references/safety.md

1) WP-CLI とサイトのターゲティングの検査 (決定論的)

インスペクターを実行します。

  • node skills/wp-wpcli-and-ops/scripts/wpcli_inspect.mjs --path=<path> [--url=<url>]

WP-CLI が利用できない場合は、プロジェクトのドキュメント化されたツール (Composer、コンテナ、またはシステムパッケージ) を介してインストールするか、予想される実行環境を問い合わせてください。

2) 適切なワークフローを選択する

A) 安全な URL/ドメインの移行 (search-replace)

安全なシーケンスに従います。

  1. wp db export (バックアップ)
  2. wp search-replace --dry-run (影響の確認)
  3. 適切なフラグを指定して実際の置換を実行します
  4. 必要に応じてキャッシュ/リライトをフラッシュします

参照:

  • references/search-replace.md

B) プラグイン/テーマの操作

wp plugin * / wp theme * を使用し、意図したサイト (およびネットワーク) に対して操作していることを最初に確認します。

参照:

  • references/packages-and-updates.md

C) Cron とキュー

cron の状態を検査し、「すべてを盲目的に実行する」のではなく、デバッグのために個々のイベントを実行します。

参照:

  • references/cron-and-cache.md

D) マルチサイトの操作

マルチサイトの変更は、多くのサイトに影響を与える可能性があります。常に、次のどちらを操作しているかを判断します。

  • 単一のサイト (--url=)、または
  • ネットワーク全体 (--network / サイトの反復処理)

参照:

  • references/multisite.md

3) 自動化パターン (スクリプト + wp-cli.yml)

反復可能な運用には、以下を推奨します。

  • デフォルト値 (パス/URL、PHP メモリ制限) のための wp-cli.yml
  • コマンドをログに記録し、エラー時に停止するシェルスクリプト
  • デフォルトで読み取り専用チェックを実行する CI ジョブ

参照:

  • references/automation.md

検証

  • ターゲティングまたは構成に影響を与える可能性のある変更後、wpcli_inspect を再実行します。
  • 意図した副作用を確認します。
    • 正しい URL が更新された
    • プラグイン/テーマが期待される状態にある
    • 必要に応じて cron/キャッシュがフラッシュされた
  • ヘルスチェックエンドポイントまたはスモークテストスイートがある場合は、運用変更後に実行します。

失敗モード/デバッグ

  • 「Error: This does not seem to be a WordPress installation.」
    • 間違った --path、間違ったコンテナ、または wp-config.php がない
  • マルチサイトコマンドが間違ったサイトに影響を与える
    • --url がないか、間違った URL
  • Search-replace が予期しないシリアライズの問題を引き起こす
    • 間違ったフラグまたはシリアライズされたデータを安全でない方法で変更する

参照:

  • references/debugging.md

エスカレーション

  • 環境の安全性を確認できない場合は、書き込み操作を実行しないでください。
  • リポジトリがコンテナ化されたツール (Docker/wp-env) を使用しているが、アクセスできない場合は、意図されたコマンドランナーまたは CI ジョブを問い合わせてください。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

WP-CLI and Ops

When to use

Use this skill when the task involves WordPress operational work via WP-CLI, including:

  • wp search-replace (URL changes, domain migrations, protocol switch)
  • DB export/import, resets, and inspections (wp db *)
  • plugin/theme install/activate/update, language packs
  • cron event listing/running
  • cache/rewrite flushing
  • multisite operations (wp site *, --url, --network)
  • building repeatable scripts (wp-cli.yml, shell scripts, CI jobs)

Inputs required

  • Where WP-CLI will run (local dev, staging, production) and whether it’s safe to run.
  • How to target the correct site root:
    • --path=<wordpress-root> and (multisite) --url=<site-url>
  • Whether this is multisite and whether commands should run network-wide.
  • Any constraints (no downtime, no DB writes, maintenance window).

Procedure

0) Guardrails: confirm environment and blast radius

WP-CLI commands can be destructive. Before running anything that writes:

  1. Confirm environment (dev/staging/prod).
  2. Confirm targeting (path/url) so you don’t hit the wrong site.
  3. Make a backup when performing risky operations.

Read:

  • references/safety.md

1) Inspect WP-CLI and site targeting (deterministic)

Run the inspector:

  • node skills/wp-wpcli-and-ops/scripts/wpcli_inspect.mjs --path=<path> [--url=<url>]

If WP-CLI isn’t available, fall back to installing it via the project’s documented tooling (Composer, container, or system package), or ask for the expected execution environment.

2) Choose the right workflow

A) Safe URL/domain migration (search-replace)

Follow a safe sequence:

  1. wp db export (backup)
  2. wp search-replace --dry-run (review impact)
  3. Run the real replace with appropriate flags
  4. Flush caches/rewrite if needed

Read:

  • references/search-replace.md

B) Plugin/theme operations

Use wp plugin * / wp theme * and confirm you’re acting on the intended site (and network) first.

Read:

  • references/packages-and-updates.md

C) Cron and queues

Inspect cron state and run individual events for debugging rather than “run everything blindly”.

Read:

  • references/cron-and-cache.md

D) Multisite operations

Multisite changes can affect many sites. Always decide whether you’re operating:

  • on a single site (--url=), or
  • network-wide (--network / iterating sites)

Read:

  • references/multisite.md

3) Automation patterns (scripts + wp-cli.yml)

For repeatable ops, prefer:

  • wp-cli.yml for defaults (path/url, PHP memory limits)
  • shell scripts that log commands and stop on error
  • CI jobs that run read-only checks by default

Read:

  • references/automation.md

Verification

  • Re-run wpcli_inspect after changes that could affect targeting or config.
  • Confirm intended side effects:
    • correct URLs updated
    • plugins/themes in expected state
    • cron/caches flushed where needed
  • If there’s a health check endpoint or smoke test suite, run it after ops changes.

Failure modes / debugging

  • “Error: This does not seem to be a WordPress installation.”
    • wrong --path, wrong container, or missing wp-config.php
  • Multisite commands affecting the wrong site
    • missing --url or wrong URL
  • Search-replace causes unexpected serialization issues
    • wrong flags or changing serialized data unsafely

See:

  • references/debugging.md

Escalation

  • If you cannot confirm environment safety, do not run write operations.
  • If the repo uses containerized tooling (Docker/wp-env) but you can’t access it, ask for the intended command runner or CI job.

同梱ファイル

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