Agent Skill · WordPress

wp-wpcli-and-ops

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.

Provider: WordPress Path in repo: skills/wp-wpcli-and-ops/SKILL.md

Skill body

WP-CLI and Ops

When to use

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

Inputs required

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:

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

Run the inspector:

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:

B) Plugin/theme operations

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

Read:

C) Cron and queues

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

Read:

D) Multisite operations

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

Read:

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

For repeatable ops, prefer:

Read:

Verification

Failure modes / debugging

See:

Escalation

Skill frontmatter

compatibility: Targets WordPress 6.9+ (PHP 7.2.24+). Requires WP-CLI in the execution environment.