db-migration
Skill1 starsChanged 4 months agoMITView on GitHub
Generate safe wp-cli search-replace commands for a WordPress URL migration. Use this when the user is moving a site between environments (staging to production, old domain to new domain), changing the site URL, or needs to rewrite URLs in the database. Produces a dry-run command first and a clear warning about serialized data.
26 other projects use a version of this.
Adopted by
Most recently taken up by
- chrysogonus/prompt-maker-studiotheir own version, first seen Nov 15, 2026
- ricci-labs/twisetheir own version, first seen Nov 8, 2026
- aniketshukla1/sdlc-kittheir own version, first seen Nov 8, 2026
- globalmpc/backendskillstheir own version, first seen Nov 8, 2026
- F3-Nation/f3-nationtheir own version, first seen Nov 2, 2026
- andidev30/the-artifacttheir own version, first seen Oct 20, 2026
Used with
Projects with it also use api-endpoint, write-tests and 7 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
tadoEngSkillapi-endpoint
Add or change a backend API endpoint on this product, keeping Pydantic as the single contract authority and regenerating the TypeScript client. Use when asked to add an endpoint, expose data to the frontend, change a request or response shape, or wire a new backend capability into a page.
Also in 4 projects that use this
SentrySkillwrite-tests
Write tests following project conventions. Use when adding new tests or modifying existing ones.
Also in 3 projects that use this
Microsoft AzureSkillgit-workflow
Squad branching model: dev-first workflow with insiders preview channel
Also in 3 projects that use this
Microsoft AzureSkilldesign
Design rules and conventions for the API Center Portal. Use when editing detail pages, card components, badges, layout, navigation, sidebars, or headers. Covers badge styling, metadata placement, page navigation patterns, and layout alignment.
Also in 3 projects that use this
AnthropicSkilldebug
Structured debugging session — reproduce, isolate, diagnose, and fix. Trigger with an error message or stack trace, "this works in staging but not prod", "something broke after the deploy", or when behavior diverges from expected and the cause isn't obvious.
Also in 3 projects that use this
VercelSkillagent-browser
Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.
Also in 3 projects that use this
- +1 more from Azure
Other versions26 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 26
- dipu-bd/lightnovel-crawler★ 2.6ksame name
- lncrawl/lightnovel-crawler★ 2.6ksame name
- openmeterio/openmeter★ 2.4ksame name
- F3-Nation/f3-nation★ 210same name
- hiromaily/go-crypto-wallet★ 128same name
- nrjdalal/zerostarter★ 65same name
- xin-lai/CodeSpirit★ 56same name
- globalmpc/backendskills★ 44same name
- NicholasFlemmer/styx-app★ 31same name
- nikandr-surkov/ai-saas-starter★ 16same name
16 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository5 other files it gives its agents.
- gutenberg-blockSkill
- plugin-scaffoldSkill
- security-auditSkill
- theme-initSkill
- wp-debugSkill
The file
We split this skill into the rules it gives an agent
10 rules. 0 are common, 4 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 22 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
If either URL is missing, ask for both.
- Distinctive: line 32
Always run a backup first.
- Very specific: line 38
If the site is very large, use --add-drop-table and compress:
- Distinctive: line 65
Read the output. The last line reports the number of replacements across each table.
- Very specific: line 98
If the site is a WordPress multisite, add --network and run per-site for any per-site tables:
- Distinctive: line 159
Do not run any migration command from this skill.
- Very specific: line 160
Do not use raw SQL like UPDATE wp_options SET option_value = REPLACE(option_value, 'old', 'new') anywhere.
- Very specific: line 161
Do not rewrite the guid column.
- Distinctive: line 162
Do not skip the backup step, even on staging.
- Very specific: line 163
Do not print database credentials, even if they appear in wp-config.php.
“Common” is measured: kept by at least 6 in 10 of the 22 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Generate safe wp-cli search-replace commands
Produce the exact wp-cli commands the user should run to migrate URLs in a WordPress database. Always generate a dry-run first, a backup step, and then the real run. Serialized data is handled correctly by wp search-replace because it reserializes after replacement, so the tool must be used, not raw SQL.
Inputs
$ARGUMENTS is two URLs: the old URL and the new URL.
Example: https://staging.acme.com https://acme.com.
If either URL is missing, ask for both. Confirm whether the source has http:// or https:// and whether the target has a trailing slash convention (WordPress stores it without trailing slash).
Workflow
- Confirm the environment. Ask which environment the commands will run against (staging, production, local). The commands should never be run on production without a confirmed backup.
- Normalize both URLs: strip trailing slashes, confirm the scheme (
httpvshttps). - Output the four-step plan: backup, dry-run, real run, flush caches. Keep it in the conversation for the user to review before running.
- Print the serialized-data warning in plain language.
- Remind the user to clear caches and rebuild permalinks after the real run.
The four commands
Step 1. Take a backup
Always run a backup first. The wp-cli export is portable and keeps the site recoverable.
wp db export pre-migration-$(date +%Y%m%d-%H%M%S).sqlIf the site is very large, use --add-drop-table and compress:
wp db export pre-migration-$(date +%Y%m%d-%H%M%S).sql --add-drop-table
gzip pre-migration-*.sqlStep 2. Dry-run the search-replace
Dry-run prints what would change without modifying anything. Always run this first.
wp search-replace 'https://staging.acme.com' 'https://acme.com' \
--all-tables-with-prefix \
--precise \
--recurse-objects \
--skip-columns=guid \
--dry-runFlag meanings:
--all-tables-with-prefix: replace in every table that starts with the current table prefix, not just core.--precise: use PHP-side serialized-safe replacement. Slower but correct for every case.--recurse-objects: walk into serialized PHP objects, not just arrays.--skip-columns=guid: never rewrite theguidcolumn. The GUID is a stable identifier for feed readers, not a URL.--dry-run: print changes, do not apply.
Read the output. The last line reports the number of replacements across each table. If the counts look reasonable, continue.
Step 3. Run it for real
Remove --dry-run:
wp search-replace 'https://staging.acme.com' 'https://acme.com' \
--all-tables-with-prefix \
--precise \
--recurse-objects \
--skip-columns=guidStep 4. Post-migration tasks
wp cache flush
wp rewrite flushwp cache flush clears whatever object cache is active, whether the built-in, Redis, or Memcached. If the site also uses a page cache plugin (WP Super Cache, W3 Total Cache, LiteSpeed Cache), clear that from its admin page.
The serialized-data warning
This warning is important. Announce it before the user runs anything.
Warning. WordPress stores many values as serialized PHP arrays or objects. A serialized string contains byte-length prefixes like
s:24:"https://staging.acme.com". A raw SQL statement likeUPDATE wp_options SET option_value = REPLACE(option_value, 'https://staging.acme.com', 'https://acme.com')will replace the URL but not update thes:24length prefix, corrupting the serialized data. This breaks theme mods, widgets, plugin settings, and custom fields in ways that are hard to diagnose.Always use
wp search-replace. It deserializes, replaces, and reserializes with correct length prefixes. Never run raw SQL to rewrite URLs.
Multisite
If the site is a WordPress multisite, add --network and run per-site for any per-site tables:
wp search-replace 'https://staging.acme.com' 'https://acme.com' \
--network \
--all-tables-with-prefix \
--precise \
--recurse-objects \
--skip-columns=guid \
--dry-runAlso update DOMAIN_CURRENT_SITE in wp-config.php if the primary site URL changed.
Output format
Present a single copyable migration-plan.sh example in the conversation, with the three commands and the post-migration tasks commented by step. Do not create files. Example content:
#!/usr/bin/env bash
set -euo pipefail
# Step 1: backup
wp db export "pre-migration-$(date +%Y%m%d-%H%M%S).sql" --add-drop-table
# Step 2: dry-run
wp search-replace 'https://staging.acme.com' 'https://acme.com' \
--all-tables-with-prefix \
--precise \
--recurse-objects \
--skip-columns=guid \
--dry-run
echo "Review the dry-run output above. Re-run this script without the --dry-run line to apply."
# Step 3: real run (comment out until dry-run has been reviewed)
# wp search-replace 'https://staging.acme.com' 'https://acme.com' \
# --all-tables-with-prefix \
# --precise \
# --recurse-objects \
# --skip-columns=guid
# Step 4: flush caches
# wp cache flush
# wp rewrite flushTell the user to review the plan before running, and to uncomment step 3 only after step 2 has been checked.
Example
User runs /wordpress-devkit:db-migration https://staging.acme.com https://acme.com.
The skill:
- Asks which environment the commands will run against.
- Presents a
migration-plan.shexample with the four steps above. - Prints the serialized-data warning.
- Reminds the user to take the backup first and to review the dry-run output before the real run.
Do not
- Do not run any migration command from this skill. Generate commands only. The user runs them.
- Do not use raw SQL like
UPDATE wp_options SET option_value = REPLACE(option_value, 'old', 'new')anywhere. It corrupts serialized data. - Do not rewrite the
guidcolumn. Always include--skip-columns=guid. - Do not skip the backup step, even on staging. Backups are free insurance.
- Do not print database credentials, even if they appear in
wp-config.php.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

