An agent skill that enables AI coding agents to run WP-CLI, MySQL, Composer, and PHP commands against WordPress sites managed by LocalWP on macOS.
LocalWP runs each WordPress site in an isolated environment with its own PHP runtime, MySQL instance, and configuration files. Running bare commands fails because the system environment doesn't know about these private resources, resulting in database connection errors or wrong PHP/MySQL versions.
This skill provides a single, zero-config helper script (localwp-cli.sh) that connects any command to the correct LocalWP environment automatically. It supports a dual-mode lookup:
- Mode A (Fast): Sources LocalWP's generated
ssh-entryscript, dynamically stripping the interactiveexec $SHELLstatement. - Mode B (Fallback): If the site shell script hasn't been created yet, it parses
sites.jsonusingpython3to resolve the site metadata, paths, PHP, and MySQL versions, generating the exact environment on the fly.
- macOS only (Apple Silicon and Intel).
- LocalWP installed.
- The target WordPress site must be running (started in LocalWP).
# Execute db check from your WordPress directory:
path/to/scripts/localwp-cli.sh wp db check
# Run from a different directory by passing the project path first:
path/to/scripts/localwp-cli.sh /path/to/wordpress/project wp plugin listconnect-localwp-cli/
├── SKILL.md # Main agent instructions
├── README.md # This file (for humans)
├── LICENSE # MIT License
├── .gitignore
├── agents/
│ └── openai.yaml # OpenAI Codex agent metadata
└── scripts/
└── localwp-cli.sh # Zero-config wrapper script
Copy the connect-localwp-cli/ directory into your project's agent skills directory (e.g., .agents/skills/ or .claude/skills/).
Navigate to your WordPress site directory and run:
.agents/skills/connect-localwp-cli/scripts/localwp-cli.sh wp db checkOr run any other utility like composer or mysql in that environment:
.agents/skills/connect-localwp-cli/scripts/localwp-cli.sh composer info