Generated banner for Wp Env
Generated logo for Wp Env

Wp Env

WordPressOfficialPublished by WordPress

  • Skill
  • Tool integration
  • Software development
  • GPL-2.0-or-later
  • No issues found

From the author

Use when setting up, configuring, or troubleshooting local WordPress development environments with @wordpress/env (wp-env). Triggers on mentions of wp-env, local WordPress development, Docker-based WordPress, or requests to start/stop/configure a local WordPress instance.
— the description by WordPress

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

The wp-env skill provides a standardized approach to setting up, configuring, and troubleshooting local WordPress development environments. It leverages Docker to create isolated, reproducible instances for WordPress core, plugins, and themes. This tool is designed for developers who require a robust local environment that supports WP-CLI, PHPUnit testing, Xdebug, and persistent database management. It supports auto-detection of project types and allows for granular configuration via .wp-env.json files, enabling seamless integration of plugins, themes, and custom mappings.

What it does

  • Automates the creation of Docker-based WordPress development environments.
  • Supports configuration of PHP versions, multisite, and custom plugin/theme loading.
  • Provides a command-line interface for executing WP-CLI, Composer, and database operations.
  • Enables Xdebug integration for local debugging and code profiling.
  • Facilitates environment lifecycle management including starting, stopping, resetting, and destroying instances.
  • Handles auto-detection of WordPress plugins, themes, and core directories.

When to use it

  • When you need a local WordPress instance with a persistent MySQL database.
  • When your project includes a .wp-env.json configuration file.
  • When you need to run WP-CLI commands or PHPUnit tests against a local WordPress site.
  • When you are developing WordPress core, plugins, or themes that require a full Docker-based environment.
  • When you need to debug WordPress code using Xdebug.

Advantages

  • Zero-config setup for standard WordPress projects.
  • Consistent development environments across different machines.
  • Full support for WP-CLI and database management within containers.
  • Flexible configuration via JSON files for complex project requirements.
  • Isolated environments prevent conflicts between different projects.

Usage examples

“How do I start a new local WordPress environment for my plugin?”
The agent will guide you to install @wordpress/env, verify Docker is running, and execute 'wp-env start' in your plugin directory.
“I need to run a WP-CLI command to update my site title in the local environment.”
The agent will provide the command 'wp-env run cli wp option update blogname "New Site Name"' to execute the command inside the container.
“How can I enable Xdebug for my local WordPress site?”
The agent will instruct you to run 'wp-env start --xdebug' and configure your IDE to listen on port 9003.
“My local environment is acting up, how do I reset the database?”
The agent will suggest running 'wp-env reset development' to clear the database while preserving your test environment.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/wordpress/wp-env/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip wp-env.zip -d .agents/skills

Documentation by WordPress

@wordpress/env (wp-env)

Zero-config, Docker-based local WordPress development environment for plugins, themes, and core.

When to use

  • User asks to set up a local WordPress development environment

  • Project contains a .wp-env.json file

  • User mentions wp-env, @wordpress/env, or Docker-based WordPress development

  • User wants to run WP-CLI commands, PHPUnit tests, or debug with Xdebug locally

  • Triage detects a plugin or theme project that needs a local WordPress instance

wp-env or wp-playground? For a quick local WordPress, prefer the wp-playground skill by default — it's faster, disposable, and needs no Docker. Use wp-env when the task actually requires it:

  • the repo already contains a .wp-env.json

  • a real MySQL database is needed (PHPUnit against the DB, wp db commands, data that survives restarts)

  • arbitrary commands must run inside the environment (shell access, Composer, full WP-CLI via wp-env run)

  • this is a WordPress core or Gutenberg checkout

  • the user explicitly asks for wp-env or Docker

wp-env can also run without Docker by using Playground as its runtime (npx @wordpress/env start --runtime=playground, experimental). That is still wp-env, driven by the same .wp-env.json, so treat it as a Docker-free fallback for a project that already carries wp-env config, not as a third option. It swaps MySQL for SQLite and drops wp-env run and the separate tests environment, which are most of the reasons to pick wp-env in the first place. For a quick Docker-free WordPress with no wp-env config, use the wp-playground skill directly.

Inputs required

  1. Docker status -- verify Docker is installed and running: docker info

  2. Node.js version -- must be >= 18.12.0: node -v

  3. Project type -- plugin, theme, or full site (check for .wp-env.json, plugin headers, or style.css theme headers)

  4. Existing config -- read .wp-env.json and .wp-env.override.json if present

Procedure

1. Install wp-env
# Global (recommended)
npm -g install @wordpress/env

# Or project-local
npm i @wordpress/env --save-dev
# Then use: npx wp-env start
2. Start the environment
wp-env start

Default credentials:

Common start options:

  • wp-env start --update -- pull latest sources and reconfigure

  • wp-env start --xdebug -- enable Xdebug (debug mode)

  • wp-env start --xdebug=profile,trace -- multiple Xdebug modes

  • wp-env start --auto-port -- find available ports when defaults are busy

3. Auto-detection (no config file)

When no .wp-env.json exists, wp-env scans the current directory:

Detected typeHow detectedAuto-config
PluginPlugin Name: header in a root .php file{ "plugins": ["."] }
ThemeTheme Name: header in style.css{ "themes": ["."] }
Corewp-includes/version.php exists{ "core": "." }
4. Configure with .wp-env.json

Place at the project root. All fields are optional.

{
  "core": null,
  "phpVersion": "8.1",
  "plugins": [
    ".",
    "https://downloads.wordpress.org/plugin/akismet.zip",
    "WordPress/classic-editor"
  ],
  "themes": [],
  "port": 8888,
  "multisite": false,
  "phpmyadmin": false,
  "config": {
    "WP_DEBUG": true,
    "SCRIPT_DEBUG": true
  },
  "mappings": {
    "wp-content/mu-plugins": "./mu-plugins"
  },
  "lifecycleScripts": {
    "afterStart": "wp-env run cli wp rewrite structure /%postname%/"
  }
}
Source string formats (for core, plugins, themes, mappings)
FormatExample
Local path".", "./path", "../path"
GitHub shorthand"WordPress/classic-editor", "owner/repo#branch"
ZIP URL"https://downloads.wordpress.org/plugin/akismet.zip"
Git SSH"ssh://user@host/repo.git#ref"

GOTCHA: WordPress.org plugin/theme slugs (bare names like "akismet") do NOT work. Use the full ZIP URL.

Local overrides with .wp-env.override.json

Create .wp-env.override.json next to .wp-env.json for personal settings (gitignored). Only config and mappings are merged -- all other fields (including plugins and themes arrays) fully replace the base.

5. Run commands in containers
# WP-CLI commands
wp-env run cli wp user list
wp-env run cli wp plugin list
wp-env run cli wp option update blogname "My Site"
wp-env run cli "wp rewrite structure /%postname%/"

# Run commands in a specific directory
wp-env run cli --env-cwd=wp-content/plugins/my-plugin composer install

# PHPUnit tests
wp-env run cli --env-cwd=wp-content/plugins/my-plugin vendor/bin/phpunit

# Pass flags with -- separator
wp-env run cli php -- --version

# MySQL access
wp-env run mysql mysql -- --user=root --password=password wordpress

Available containers: mysql, wordpress, cli, composer, phpmyadmin.

6. Manage the environment
wp-env stop                    # Stop and free ports
wp-env reset development       # Reset dev database (keeps test)
wp-env reset all               # Reset all databases
wp-env logs                    # Stream PHP/Docker logs
wp-env logs --no-watch         # Print logs and exit
wp-env status                  # Show URLs, ports, config
wp-env status --json           # Machine-readable status
wp-env cleanup                 # Remove containers/volumes (keep images)
wp-env destroy                 # Remove everything including images
7. Xdebug setup
wp-env start --xdebug          # Enable debug mode
wp-env start --xdebug=coverage # For code coverage
wp-env start                   # Disable Xdebug (restart without flag)

Modes: debug, profile, trace, develop, coverage.

IDE listens on port 9003. VS Code launch.json needs:

{
  "type": "php",
  "request": "launch",
  "name": "Listen for Xdebug",
  "port": 9003,
  "pathMappings": {
    "/var/www/html/wp-content/plugins/your-plugin": "${workspaceFolder}"
  }
}
8. Multisite
{ "multisite": true, "plugins": ["."] }

Verification

  • [ ] wp-env status shows running containers with correct ports

  • [ ] http://localhost:8888/wp-admin/ loads the WordPress admin

  • [ ] wp-env run cli wp plugin list shows expected plugins

  • [ ] Plugin/theme under development appears in the WordPress admin

  • [ ] Database resets work: wp-env reset development

Failure modes / debugging

SymptomCauseFix
"Cannot connect to Docker daemon"Docker not runningStart Docker Desktop
"Port 8888 already in use"Port conflictUse --auto-port or set custom port in .wp-env.json
Plugin not appearingMissing Plugin Name: header in main PHP fileAdd standard plugin header comment
"Could not find a valid source"Invalid source string in configUse full ZIP URL for wp.org plugins, not bare slugs
Stale environment after source changesCached Docker volumeswp-env start --update or wp-env destroy && wp-env start
White screen / PHP errorsCorrupted databasewp-env reset all && wp-env start
Override not taking effectWrong merge behaviorplugins/themes in override replace base arrays; only config/mappings merge
Tests environment not accessibleWrong portTest environment runs on port 8889 by default
Xdebug not connectingIDE not listening or wrong portEnsure IDE listens on port 9003 with correct pathMappings
npm global install permission errorNode installed to a system pathUse nvm, or install locally: npm i -D @wordpress/env and run via npx wp-env

Escalation

  • Docker issues beyond wp-env scope (networking, disk space, WSL2 backend)

  • Custom Docker Compose configurations that conflict with wp-env

  • CI/CD pipeline integration requiring non-standard Docker setups

  • WordPress Playground runtime (--runtime=playground) is experimental and has limited feature parity

References

Files

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Node.js

The author says: Targets WordPress 7.0+ (PHP 7.4.0+). Requires Docker and Node.js 18.12+.

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
WordPress
Publisher
WordPress (Official)
Source
WordPress/agent-skills · skills/wp-env · commit 7374e6f
Licence
GNU General Public License v2.0 or later (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by WordPress.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download wp-env.zip