wp-migrate
WordPress site migration and deployment using wp-migrate.sh. Use when migrating WordPress sites, syncing databases, managing backups, testing migrations, debugging migration issues, or working with WordPress deployment workflows including Duplicator, Jetpack Backup, and Solid Backups archives. Also use for code modifications, testing, git workflows, PR creation, and release management for this project.
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o wp-migrate.zip https://jpskill.com/download/17652.zip && unzip -o wp-migrate.zip && rm wp-migrate.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17652.zip -OutFile "$d\wp-migrate.zip"; Expand-Archive "$d\wp-migrate.zip" -DestinationPath $d -Force; ri "$d\wp-migrate.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
wp-migrate.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
wp-migrateフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
WordPress移行スキル
このスキルは、WordPress移行ツールである wp-migrate.sh の操作に関する専門知識を提供します。
プロジェクト概要
wp-migrate.sh は、以下の2つのモードで動作する包括的なWordPress移行ツールです。
- プッシュモード: SSH経由でサーバー間でWordPressサイトを移行します(ソース → デスティネーション)。
- アーカイブモード: デスティネーションサーバー上でWordPressバックアップアーカイブ(Duplicator、Jetpack Backup、Solid Backups)をインポートします。
現在のバージョン: 最新リリースを確認してください。
git describe --tags --abbrev=0 # gitから現在のバージョンを取得
最新リリース: GitHub Releases を参照してください。
リポジトリ: BWBama85/wp-migrate.sh
メインブランチ: main
主要な機能
移行モード
プッシュモード
- wp-content とデータベースをSSH経由でソースからデスティネーションに転送します。
- 移行中に両方のサーバーでメンテナンスモードを有効にします。
- 上書き前にタイムスタンプ付きのバックアップを作成します。
- デスティネーションドメインに合わせてURLの検索・置換を実行します。
- デスティネーションのキャッシュインフラストラクチャを維持するために object-cache.php を除外します。
- StellarSitesマネージドホスティングとの互換性をサポートします(--stellarsites フラグ)。
アーカイブモード
- アーカイブ形式を自動検出します(Duplicator、Jetpack Backup、Solid Backups)。
- アーカイブを一時ディレクトリに展開します。
- ディスク容量を検証します(アーカイブサイズの3倍が必要です)。
- インポート前にデスティネーションデータベースと wp-content のバックアップを作成します。
- wp-config.php と異なる場合、テーブルプレフィックスを自動的に調整します。
- デスティネーションURLに合わせてURLの検索・置換を実行します。
- 正確なコマンドを含むロールバック手順を提供します。
主な特徴
- 確認付きの移行プレビュー: 詳細な統計情報と確認プロンプトを含む移行前の概要 (v2.6.0)
- ロールバックコマンド: --rollback フラグによるバックアップからの自動復元 (v2.6.0)
- 進捗インジケーター: pv がインストールされている場合、長時間実行される操作に対するリアルタイムのプログレスバー (v2.6.0)
- ドライランモード: 変更を加えることなくすべての操作をプレビュー (--dry-run)
- 詳細ロギング: 詳細な診断情報を表示 (--verbose)
- トレースモード: 実行前にすべてのコマンドを表示 (--trace)
- プラグインの保持: ソースにないデスティネーションのプラグイン/テーマを保持 (--preserve-dest-plugins)
- StellarSitesモード: mu-plugins の除外によるマネージドホスティングとの互換性 (--stellarsites)
- 検索・置換のスキップ: home/siteurl オプションのみを更新する高速移行 (--no-search-replace)
- 自動化サポート: CI/CDのために --yes フラグで確認プロンプトをスキップ (v2.6.0)
- クワイエットモード: --quiet で非対話型スクリプトの進捗インジケーターを抑制 (v2.6.0)
一般的なタスク
移行の実行
プッシュモード:
./wp-migrate.sh --dest-host user@dest.example.com --dest-root /var/www/site
アーカイブモード:
./wp-migrate.sh --archive /path/to/backup.zip
./wp-migrate.sh --archive /path/to/backup.tar.gz --archive-type jetpack
ドライラン:
./wp-migrate.sh --dest-host user@dest --dest-root /var/www/site --dry-run --verbose
ロールバック (v2.6.0):
./wp-migrate.sh --rollback # 最新のバックアップを自動検出
./wp-migrate.sh --rollback --rollback-backup /path/to/specific/backup # 特定のバックアップ
./wp-migrate.sh --rollback --yes # 自動化のために確認をスキップ
自動化対応 (v2.6.0):
./wp-migrate.sh --archive /path/to/backup.zip --yes --quiet # CI/CD: プロンプトをスキップ、プログレスバーなし
テスト
すべてのテストを実行:
make test
特定のテストを実行:
./test-wp-migrate.sh
ShellCheckの検証:
shellcheck wp-migrate.sh
開発ワークフロー
コード構造 (v2+)
このプロジェクトでは、モジュール式のソース構造を使用しています。
src/
├── header.sh # Shebang、デフォルト、変数の宣言
├── lib/
│ ├── core.sh # コアユーティリティ (log, err, validate_url)
│ ├── functions.sh # その他のすべての関数
│ └── adapters/ # アーカイブ形式アダプター
│ ├── README.md
│ ├── duplicator.sh
│ ├── jetpack.sh
│ └── solidbackups.sh
└── main.sh # 引数の解析とメインの実行
重要: 変更は wp-migrate.sh に直接ではなく、src/ ファイルで行う必要があります。
ビルドプロセス
ソースファイルを変更した後:
make build
これにより、以下が行われます。
- 連結されたソースに対して shellcheck を実行します。
- src/ ファイルを連結して dist/wp-migrate.sh にします。
- ./wp-migrate.sh (リポジトリのルート) にコピーします。
- SHA256チェックサムを生成します。
Pre-commitフック
pre-commitフックは、リビルドせずにソースの変更をコミットすることを防ぎます。
ln -s ../../.githooks/pre-commit .git/hooks/pre-commit
Gitワークフロー
-
ブランチ: 説明的な名前を使用して main から作成します。
- 機能拡張の場合は
feature/<slug> - バグ修正の場合は
fix/<slug> - ドキュメントの場合は
docs/<slug> - メンテナンスの場合は
chore/<slug>
- 機能拡張の場合は
-
コミット: .gitmessage テンプレート形式を使用します。
type: 短い命令的な要約 必要に応じてより長い説明タイプ: feat, fix, docs, chore, refactor, test
-
変更履歴: すべての機能または修正について、CHANGELOG.md の [Unreleased] セクションを更新します。
-
プルリクエスト:
- .github/pull_request_template.md チェックリストを使用します。
- すべてのコミット(最新のものだけでなく)に基づいて包括的な概要を含めます。
- 検証手順を含むテスト計画を含めます。
- 関連する issue を参照します。
-
マージ:
git merge --no-ffで main をリリース可能な状態に保つか、レビュー後にスカッシュします。 -
リリース: セマンティックバージョニングでタグ付けします (例:
git tag v2.7.0)。
プルリクエストの作成
PRを作成する際は、以下を確認してください。
- ブランチ内のすべてのコミットを確認します (
git log main..HEADおよびgit diff main...HEADを使用)。 - 概要は変更の完全な範囲をカバーしています。
- テスト計画はすべての機能を検証します。
- CHANGELOG.md が更新されています。
- ShellCheck がパスします。
- テストがパスします (make test)。
確認する共通ファイル
- wp-migrate.sh - メインスクリプト (ビルドされたアーティファクト、直接編集しないでください)
- src/ - モジュール式のソースファイル (これらを編集します)
- [src/li
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
WordPress Migration Skill
This skill provides expertise for working with the wp-migrate.sh WordPress migration tool.
Project Overview
wp-migrate.sh is a comprehensive WordPress migration tool that operates in two modes:
- Push Mode: Migrates WordPress sites between servers via SSH (source → destination)
- Archive Mode: Imports WordPress backup archives (Duplicator, Jetpack Backup, Solid Backups) on destination server
Current Version: Check the latest release
git describe --tags --abbrev=0 # Get current version from git
Latest Release: See GitHub Releases
Repository: BWBama85/wp-migrate.sh
Main Branch: main
Core Capabilities
Migration Modes
Push Mode
- Transfers wp-content and database from source to destination via SSH
- Enables maintenance mode on both servers during migration
- Creates timestamped backups before overwriting
- Performs URL search-replace to align destination domain
- Excludes object-cache.php to preserve destination caching infrastructure
- Supports StellarSites managed hosting compatibility (--stellarsites flag)
Archive Mode
- Auto-detects archive format (Duplicator, Jetpack Backup, Solid Backups)
- Extracts archives to temporary directory
- Validates disk space (requires 3x archive size)
- Creates backups of destination database and wp-content before import
- Automatically aligns table prefixes if different from wp-config.php
- Performs URL search-replace to align with destination URLs
- Provides rollback instructions with exact commands
Key Features
- Migration preview with confirmation: Pre-migration summary with detailed stats and confirmation prompt (v2.6.0)
- Rollback command: Automatic restoration from backups with --rollback flag (v2.6.0)
- Progress indicators: Real-time progress bars for long-running operations when pv is installed (v2.6.0)
- Dry-run mode: Preview all operations without making changes (--dry-run)
- Verbose logging: Show detailed diagnostic information (--verbose)
- Trace mode: Show every command before execution (--trace)
- Plugin preservation: Preserve destination plugins/themes not in source (--preserve-dest-plugins)
- StellarSites mode: Managed hosting compatibility with mu-plugins exclusion (--stellarsites)
- Skip search-replace: Fast migrations that only update home/siteurl options (--no-search-replace)
- Automation support: Skip confirmation prompts with --yes flag for CI/CD (v2.6.0)
- Quiet mode: Suppress progress indicators for non-interactive scripts with --quiet (v2.6.0)
Common Tasks
Running Migrations
Push Mode:
./wp-migrate.sh --dest-host user@dest.example.com --dest-root /var/www/site
Archive Mode:
./wp-migrate.sh --archive /path/to/backup.zip
./wp-migrate.sh --archive /path/to/backup.tar.gz --archive-type jetpack
Dry Run:
./wp-migrate.sh --dest-host user@dest --dest-root /var/www/site --dry-run --verbose
Rollback (v2.6.0):
./wp-migrate.sh --rollback # Auto-detects latest backups
./wp-migrate.sh --rollback --rollback-backup /path/to/specific/backup # Specific backup
./wp-migrate.sh --rollback --yes # Skip confirmation for automation
Automation-Friendly (v2.6.0):
./wp-migrate.sh --archive /path/to/backup.zip --yes --quiet # CI/CD: skip prompts, no progress bars
Testing
Run all tests:
make test
Run specific test:
./test-wp-migrate.sh
ShellCheck validation:
shellcheck wp-migrate.sh
Development Workflow
Code Structure (v2+)
The project uses a modular source structure:
src/
├── header.sh # Shebang, defaults, variable declarations
├── lib/
│ ├── core.sh # Core utilities (log, err, validate_url)
│ ├── functions.sh # All other functions
│ └── adapters/ # Archive format adapters
│ ├── README.md
│ ├── duplicator.sh
│ ├── jetpack.sh
│ └── solidbackups.sh
└── main.sh # Argument parsing and main execution
IMPORTANT: Modifications should be made in src/ files, NOT in wp-migrate.sh directly.
Build Process
After modifying source files:
make build
This will:
- Run shellcheck on concatenated source
- Concatenate src/ files into dist/wp-migrate.sh
- Copy to ./wp-migrate.sh (repo root)
- Generate SHA256 checksum
Pre-commit Hook
A pre-commit hook prevents committing source changes without rebuilding:
ln -s ../../.githooks/pre-commit .git/hooks/pre-commit
Git Workflow
-
Branching: Create from main using descriptive names:
feature/<slug>for enhancementsfix/<slug>for bug fixesdocs/<slug>for documentationchore/<slug>for maintenance
-
Commits: Use .gitmessage template format:
type: short imperative summary Longer explanation if neededTypes: feat, fix, docs, chore, refactor, test
-
Changelog: Update CHANGELOG.md under [Unreleased] section with every feature or fix
-
Pull Requests:
- Use .github/pull_request_template.md checklist
- Include comprehensive summary based on ALL commits (not just latest)
- Include test plan with verification steps
- Reference related issues
-
Merging: Keep main release-ready with
git merge --no-ffor squash after review -
Releases: Tag with semantic versioning (e.g.,
git tag v2.7.0)
Creating Pull Requests
When creating PRs, ensure:
- Review ALL commits in the branch (use
git log main..HEADandgit diff main...HEAD) - Summary covers complete scope of changes
- Test plan verifies all functionality
- CHANGELOG.md is updated
- ShellCheck passes
- Tests pass (make test)
Common Files to Check
- wp-migrate.sh - Main script (built artifact, don't edit directly)
- src/ - Modular source files (edit these)
- src/lib/adapters/ - Archive format adapters
- CHANGELOG.md - Version history
- README.md - User documentation
- Makefile - Build and test targets
- test-wp-migrate.sh - Test script
Troubleshooting Guide
Common Issues
Permission Errors on Managed Hosts (StellarSites)
- Symptom: "Permission denied" when syncing wp-content
- Solution: Use
--stellarsitesflag to exclude protected mu-plugins - Details: Managed hosts protect certain mu-plugins directories (e.g.,
stellarsites-cloud)
Database Import Fails
- Check table prefix alignment (script auto-detects and updates wp-config.php)
- Verify sufficient disk space (3x archive size for archive mode)
- Check MySQL max_allowed_packet size for large imports
URL Search-Replace Issues
- Use
--verboseto see detected URLs - Override with
--dest-home-urlor--dest-site-urlif detection fails - Use
--no-search-replacefor faster migrations that only need home/siteurl updated
Archive Detection Fails
- Use explicit
--archive-typeto specify format (duplicator, jetpack, solidbackups) - Verify archive structure matches adapter expectations (see src/lib/adapters/)
- Check detailed validation errors with --verbose (v2.6.0+)
Non-Interactive Context Failures (v2.6.0)
- Symptom: Script exits with "This script requires a TTY for confirmation prompts"
- Solution: Add
--yesflag when running in CI/CD, cron, or pipeline contexts - Details: Migration preview and rollback require confirmation by default; use --yes to bypass
Rollback Issues (v2.6.0)
- Auto-detection looks for latest timestamped backups in db-backups/ and wp-content.backup-*
- If backups aren't found, use
--rollback-backup /path/to/backupto specify explicitly - Rollback only works for archive mode migrations (restores from local backups)
SSH Connection Issues
- Add custom SSH options with
--ssh-opt(can be repeated) - Examples:
--ssh-opt 'Port=2222'or--ssh-opt 'ProxyJump=bastion'
ShellCheck Errors
- Install ShellCheck:
brew install shellcheck(macOS) or see https://www.shellcheck.net/ - Run:
shellcheck wp-migrate.sh - All code must be ShellCheck-clean before merging
Debugging Commands
Show verbose migration preview:
./wp-migrate.sh --dest-host user@dest --dest-root /var/www/site --dry-run --verbose
Show every command (trace mode):
./wp-migrate.sh --dest-host user@dest --dest-root /var/www/site --dry-run --trace
Check archive structure:
unzip -l /path/to/backup.zip | head -50
tar -tzf /path/to/backup.tar.gz | head -50
Verify wp-cli on destination:
ssh user@dest 'cd /var/www/site && wp core version'
Archive Adapter System
The script uses an extensible adapter system for different backup formats.
Supported Formats
- Duplicator: ZIP archives with
dup-installer/dup-database__*.sqlstructure - Jetpack Backup: ZIP/TAR.GZ archives with
sql/*.sqlmulti-file structure - Solid Backups: ZIP archives with split SQL in
wp-content/uploads/backupbuddy_temp/{ID}/
Adding New Adapters
See src/lib/adapters/README.md for contributor guide.
Each adapter must implement:
validate_<adapter>()- Check if file matches formatextract_<adapter>()- Extract archive to temp directorydetect_db_<adapter>()- Find database file(s)detect_wp_content_<adapter>()- Find wp-content directory
Best Practices
When Assisting with Code Changes
- Always check if source files need modification (src/) not wp-migrate.sh directly
- Run
make buildafter any source changes to regenerate wp-migrate.sh - Run ShellCheck validation before committing
- Update CHANGELOG.md for all features and fixes
- Use TodoWrite to track multi-step tasks
- Create focused PRs addressing single concerns
When Testing Migrations
- Always start with dry-run to preview operations
- Use verbose mode for troubleshooting (--verbose or --trace)
- Verify backups before destructive operations
- Test rollback procedures in safe environments
- Check logs in logs/ directory after migrations
When Creating Releases
- Update CHANGELOG.md with version number and date
- Create git tag with semantic version (e.g., v2.7.0)
- Generate GitHub release with changelog excerpt
- Verify tests pass on clean checkout
- Update README if user-facing changes exist
Common Patterns
Searching Code
Use Grep tool for code searches:
pattern: "function_name"
output_mode: "content"
-n: true (show line numbers)
Reading Source Files
Use Read tool for file contents:
file_path: /Volumes/personal/codeprojects/bash/wp-migrate/src/lib/functions.sh
Editing Code
Use Edit tool for precise changes:
file_path: /Volumes/personal/codeprojects/bash/wp-migrate/src/lib/functions.sh
old_string: "exact match from file"
new_string: "replacement text"
Running Git Commands
git status
git diff main...HEAD # See all changes in branch
git log main..HEAD # See all commits in branch
Critical Reminders
- NEVER edit wp-migrate.sh directly - edit files in src/ instead
- ALWAYS run
make buildafter source changes - ALWAYS update CHANGELOG.md for features and fixes
- ALWAYS run ShellCheck before committing (make test)
- ALWAYS commit both source AND built files together
- ALWAYS review ALL commits when creating PRs (not just latest commit)
- ALWAYS use TodoWrite for multi-step tasks to track progress