wordpress-plugins-repo-worktrees
Skill1 starsChanged 9 months agoMITView on GitHub
Use when managing git worktrees in a WordPress plugins monorepo — switching, creating, or listing worktrees that need wp-config.php integration
In this repository4 other files it gives its agents.
- commitSkill
- diagnose-requestSkill
- html-to-wp-fseSkill
- prepare-prSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 6 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 26
Update ACTIVE_PLUGINS_WORKTREE in wp-config.php
- Distinctive: line 73
Verify worktree exists: git worktree list
- Distinctive: line 75
Update the comment listing available worktrees if needed
- Distinctive: line 91
Update wp-config.php comments to list new worktree
- Distinctive: line 92
Ask user if they want to switch to it
- Distinctive: line 96
Check if it's the active WordPress worktree
- Distinctive: line 97
If active, switch to different worktree first
- Very specific: line 144
Combined usage: Run claude -w session-name from inside a plugins-* worktree for isolated development with WordPress integration.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
WordPress Plugins Repo Worktree Orchestration
Overview
Prerequisites: This skill applies when wp-content/plugins itself IS the git repository (a monorepo containing multiple plugins), NOT when individual plugins have their own repos.
Git worktrees allow multiple branches checked out simultaneously in separate directories. In WordPress, you must ALSO update wp-config.php to tell WordPress which worktree to use as the plugins folder.
Core principle: Git worktrees + WordPress config = complete branch switching.
Critical Integration Point
WordPress uses these constants to locate plugins:
WP_PLUGIN_DIR- filesystem pathWP_PLUGIN_URL- URL path
A custom ACTIVE_PLUGINS_WORKTREE constant controls which worktree WordPress uses.
Switching worktrees means:
- Git worktree exists (or create it)
- Update
ACTIVE_PLUGINS_WORKTREEin wp-config.php
Quick Reference
| Action | Git Command | WordPress Config |
| List worktrees | git worktree list | Check ACTIVE_PLUGINS_WORKTREE value |
| Switch worktree | (none - already exists) | Update ACTIVE_PLUGINS_WORKTREE |
| Create worktree | git worktree add ../plugins-name branch | Update config if switching to it |
| Remove worktree | git worktree remove ../plugins-name | Switch to different worktree first |
wp-config.php Structure
Location: {wordpress-root}/wp-config.php
/**
* Git Worktree Support
* Available worktrees listed in comments
*/
define( 'ACTIVE_PLUGINS_WORKTREE', 'plugins-feature-name' );
// Set custom plugins directory based on worktree
define( 'WP_PLUGIN_DIR', __DIR__ . '/wp-content/' . ACTIVE_PLUGINS_WORKTREE );
// Dynamically build plugin URL
$_mi_scheme = ( ! empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' ) ? 'https' : 'http';
$_mi_host = $_SERVER['HTTP_HOST'] ?? 'localhost';
define( 'WP_PLUGIN_URL', $_mi_scheme . '://' . $_mi_host . '/wp-content/' . ACTIVE_PLUGINS_WORKTREE );Workflows
List Worktrees (show status)
# 1. List git worktrees
cd wp-content/plugins && git worktree list
# 2. Check which one WordPress is using
grep "ACTIVE_PLUGINS_WORKTREE" wp-config.phpReport BOTH - git worktrees available AND which one WordPress is configured to use.
Switch to Existing Worktree
- Verify worktree exists:
git worktree list - Edit wp-config.php: change
ACTIVE_PLUGINS_WORKTREEvalue - Update the comment listing available worktrees if needed
- Confirm: show new value
Create New Worktree
# From existing branch
git worktree add ../plugins-feature-name existing-branch
# From new branch based on another
git worktree add -b new-branch ../plugins-new-branch base-branchNaming convention: plugins-{short-description} (e.g., plugins-auth-fix, plugins-ui-redesign)
After creation:
- Update wp-config.php comments to list new worktree
- Ask user if they want to switch to it
Remove Worktree
- Check if it's the active WordPress worktree
- If active, switch to different worktree first
git worktree remove ../plugins-name- Update wp-config.php comments
Common Mistakes
| Mistake | Fix |
| Only running git commands | MUST also update wp-config.php |
| Forgetting to update comments | Keep worktree list in comments current |
| Creating worktree for already-checked-out branch | Switch main worktree to different branch first |
| Removing active worktree | Switch WordPress to different worktree before removing |
Directory Structure Example
wp-content/
├── plugins/ # main/master branch (primary git worktree)
├── plugins-feature-x/ # feature/x branch
├── plugins-bugfix-123/ # bugfix/123 branch
└── themes/Error Handling
"Branch already checked out": The branch is in another worktree. Either use that worktree or checkout a different branch in the conflicting worktree.
"Assets not found after switch": Built assets may not exist in new worktree. Run build commands (npm run build) in the worktree.
Claude Code Native Worktrees
Claude Code has a native --worktree flag for isolated Claude sessions:
# Start Claude in an isolated worktree
claude --worktree feature-auth
claude -w bugfix-123Key differences:
| Feature | claude --worktree | WordPress Worktrees (this skill) |
| Purpose | Isolated Claude sessions | WordPress plugin development |
| Location | .claude/worktrees/ | wp-content/plugins-* |
| WordPress integration | None | Updates wp-config.php |
| Cleanup | Auto on exit | Manual |
Combined usage: Run claude -w session-name from inside a plugins-* worktree for isolated development with WordPress integration.
Red Flags - Common Mistakes
These thoughts mean STOP - you're missing the WordPress integration:
| Thought | Reality |
| "I'll just use git checkout" | NO - use worktrees, they allow parallel branches |
| "Switching worktree is done" after git commands | NO - you must ALSO update wp-config.php |
| "Active worktree = current directory" | NO - active = what ACTIVE_PLUGINS_WORKTREE says |
| "git worktree list shows everything" | NO - also check wp-config.php for WordPress state |
All worktree operations require BOTH git commands AND wp-config.php updates.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

