wp-cli-database-ops
Installation
SKILL.md
WP-CLI and Database Operations
Workflow
- Confirm docroot, environment and database target before any write.
- Prefer read commands first: option/plugin/theme/user/cron/db queries.
- Back up the database before bulk mutations or cleanup.
- Use
wp search-replace --dry-runbefore replacements and preserve serialized data via WP-CLI. - For cleanup, quantify rows/bytes and prove table/option ownership before deletion.
- Use transactions where practical for direct SQL.
- Re-run targeted queries and application checks after mutation.
Guardrails
Never run global search-replace, arbitrary SQL deletion, user password changes, or cache flushes against an unverified environment.