Skip to content

Add wp-env skill for local WordPress development - #38

Open
rushikeshmore wants to merge 1 commit into
WordPress:trunkfrom
rushikeshmore:add/wp-env-skill
Open

Add wp-env skill for local WordPress development#38
rushikeshmore wants to merge 1 commit into
WordPress:trunkfrom
rushikeshmore:add/wp-env-skill

Conversation

@rushikeshmore

Copy link
Copy Markdown

What?

Adds a new wp-env skill that teaches AI coding assistants how to set up, configure, and troubleshoot local WordPress development environments using @wordpress/env.

Addresses the community request in #9 (comment from @owlot: "Would love to see an wp-env skill").

Why?

@wordpress/env is the official Docker-based local development tool for WordPress plugin and theme development. It's referenced throughout the Gutenberg docs and used by core contributors, but there's no agent skill covering it. AI assistants currently guess at wp-env configuration and often make mistakes like using bare plugin slugs instead of ZIP URLs, or not checking Docker status before starting.

How?

New skill: skills/wp-env/SKILL.md

  • All 7 required sections (When to use, Inputs required, Procedure, Verification, Failure modes, Escalation)
  • Covers: installation, auto-detection (plugin/theme/core), .wp-env.json configuration, source string formats, WP-CLI commands, PHPUnit testing, Xdebug setup, multisite, override files, environment management
  • Common gotchas table (port conflicts, bare slugs, override merge behavior, Docker not running)

Eval scenarios: 2 JSON scenarios

  • wp-env-start-plugin.json -- setting up wp-env for a plugin project
  • wp-env-troubleshoot-port.json -- diagnosing and fixing port conflicts

README: Updated Available Skills table with wp-env entry.

Testing

  • node eval/harness/run.mjs passes
  • node shared/scripts/skillpack-build.mjs --clean builds successfully for all 4 targets (codex, vscode, claude, cursor)
  • Skill follows required SKILL.md structure with all 7 sections
  • Two eval scenarios added
  • Frontmatter validates (name matches folder, compatibility includes WP 6.9 + PHP 7.2.24+)

Use of AI Tools

Claude Code was used to assist with drafting this skill. Content was verified against the official @wordpress/env documentation and source code.

@github-actions

github-actions Bot commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: rushikeshmore <rushikeshmore@git.wordpress.org>
Co-authored-by: mikeyarce <mikeyarce@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@rushikeshmore

Copy link
Copy Markdown
Author

Hi, just checking if this is ready for review or if anything needs changing on my end. Happy to adjust.

@mikeyarce mikeyarce left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @rushikeshmore !

Added a few notes that I think we need to work on before this is ready.

I think one of my concerns is having multiple "dev envs" like wp-env and playground, so I suggested adding some wording to help the agent know which to use when.

Once this is merged I'll make a follow-up PR with some similar instructions on the wp-playground side.

Comment thread skills/wp-env/SKILL.md Outdated
---
name: wp-env
description: 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.
compatibility: Targets WordPress 6.9+ (PHP 7.2.24+). Requires Docker and Node.js 18.12+.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
compatibility: Targets WordPress 6.9+ (PHP 7.2.24+). Requires Docker and Node.js 18.12+.
compatibility: "Targets WordPress 7.0+ (PHP 7.4.0+). Requires Docker and Node.js 18.12+."

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied. Worth noting this was more than style: the harness now requires "WordPress 7.0" and "PHP 7.4.0" in compatibility after #70, so the old 6.9 / 7.2.24 string fails validation on current trunk.

Comment thread skills/wp-env/SKILL.md Outdated
@@ -0,0 +1,212 @@
---
name: wp-env
description: 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: 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.
description: "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."

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied.

Comment thread skills/wp-env/SKILL.md Outdated
| Override not taking effect | Wrong merge behavior | `plugins`/`themes` in override **replace** base arrays; only `config`/`mappings` merge |
| Tests environment not accessible | Wrong port | Test environment runs on port 8889 by default |
| Xdebug not connecting | IDE not listening or wrong port | Ensure IDE listens on port 9003 with correct `pathMappings` |
| npm global install permission error | Node installed without nvm | Use `nvm` or prefix with `sudo` (not recommended) |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably drop the sudo reccommendation here

Suggested change
| npm global install permission error | Node installed without nvm | Use `nvm` or prefix with `sudo` (not recommended) |
| npm global install permission error | Node installed to a system path | Use `nvm`, or install locally: `npm i -D @wordpress/env` and run via `npx wp-env` |

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied. Agreed, recommending sudo for an npm global install is bad advice to leave in a skill an agent will follow.

Comment thread skills/wp-env/SKILL.md
- 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Triage detects a plugin or theme project that needs a local WordPress instance
- 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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied as written.

One knock-on effect: the plugin eval scenario asked "set up a local WordPress development environment for my plugin so I can test it", which under this new guidance should route to wp-playground, not wp-env. I updated that scenario so it does not contradict the skill: the query now asks for PHPUnit against a real database, and choosing wp-env over wp-playground is an explicit step plus a success criterion. Happy to revert that part if you would rather keep the scenarios untouched.

Agreed on the follow-up for the wp-playground side.

Add a new skill teaching AI assistants how to set up, configure, and
troubleshoot @wordpress/env local development environments.

Covers: installation, auto-detection, .wp-env.json configuration,
WP-CLI commands, PHPUnit testing, Xdebug, multisite, port conflicts,
and common failure modes.

Includes two eval scenarios:
- wp-env-start-plugin: setting up wp-env for plugin development
- wp-env-troubleshoot-port: diagnosing and fixing port conflicts

Addresses community request in WordPress#9.
@rushikeshmore

Copy link
Copy Markdown
Author

Thanks for the review. All four suggestions applied, and the branch is rebased on trunk so the conflict is gone.

One extra change beyond the suggestions: the plugin eval scenario used a generic "set up a local environment" query that the new routing block would send to wp-playground. I made it a real wp-env case (PHPUnit against a database) and added the routing decision as a step. Details in the thread, easy to revert if you want the scenarios left alone.

node eval/harness/run.mjs passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants