plugins/wordpress-trac/skills/wp-trac-fix/SKILL.md
Reproduce and attempt a fix for a specific WordPress core defect from Trac in an isolated worktree. Use when the user asks to "work on Trac #N", "fix Trac ticket #N", "reproduce and fix #N", or similar.
npx skillsauth add sirreal/agent-skills wp-trac-fixInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
If no ticket number was provided, ask the user which ticket they want to work on.
Reproduce and fix a WordPress core defect from Trac in an isolated worktree, with discipline that produces evidence-grade outcomes — including NOT-REPRODUCIBLE / INCONCLUSIVE classifications when the bug cannot be triggered.
Verify before starting:
WordPress/wordpress-develop.upstream remote points at WordPress/wordpress-develop. Confirm with git remote get-url upstream.envlite tool is on $PATH. Confirm with command -v envlite.If any precondition fails, stop and report the missing piece. For envlite specifically, tell the user: "envlite was not found on $PATH — install it and ensure the envlite command is reachable, then re-run."
Create a per-ticket worktree forked from upstream/trunk and initialize envlite. The slug is a kebab-case summary of the bug (1–4 words, e.g. datepicker-footer-l10n).
git fetch upstream
git worktree add --no-track ../agent-fixes/<ticket> \
-b trac-<ticket>/<slug> upstream/trunk
cd ../agent-fixes/<ticket>
envlite init --force
Note: the
../agent-fixes/<ticket>path is hardcoded relative to the current checkout. If this skill is ever invoked from inside a harness-isolated worktree (e.g. dispatched by atriage-trac-style orchestrator that already provided isolation), skip thegit worktree addand operate in place. Revisit this path convention when that integration lands.
envlite init runs npm ci, npm run build:dev, and composer install — minutes on first init. All subsequent work occurs in this worktree. Never cd out of it; never switch branches inside it.
Fetch the ticket via the wp-trac-ticket skill. The default mode returns everything you need — description, attachments, changesets, comments, and any linked pull requests — in a single call.
Read critically — the entire ticket, not only the comments. Descriptions, sample code, and commenter conclusions are all unreliable; they may be wrong, stale, or written without ever being run. Conversely, comments that look dismissable (a patch that didn't apply, a confused author) often contain load-bearing environment details. Read every comment for its evidence, separately from its conclusion.
references/repro-strategies.md for common snippet-failure modes.Pick a strategy from the matrix and attempt once before escalating.
| Ticket signal | Strategy |
|---|---|
| PHP API behavior | phpunit |
| Admin UI / front-end rendering / browser-specific | browser MCP via envlite up |
| Block editor / JS module / JS function correctness | qunit (CLI; open in browser via a browser MCP for visual debugging) |
| REST / Ajax endpoints | phpunit first; escalate to a browser MCP only if PHP harness cannot reach the codepath |
| Multisite / cron / upgrade | phpunit (multisite group / cron tests / upgrade tests) |
| Unclear, "looks wrong", "is slow" | browser MCP |
"Browser MCP" here means any MCP that drives a real browser (Playwright MCP being one such tool). Pick whichever is available in the session.
For browser-driven repro: run envlite up --force backgrounded, read port from .envlite/port, then drive http://127.0.0.1:<port>/ via the browser MCP. Admin login: admin / password.
For phpunit: vendor/bin/phpunit --filter <test_name> from the worktree root.
See references/repro-strategies.md for detailed per-strategy guidance.
After Phase B, classify the outcome:
Before declaring REPRODUCED, write a one-sentence comparison: "Ticket reports X fails; my repro produces Y; X ≈ Y because Z." Include this verbatim in the final report. Two failure modes to guard against:
If either guard fails, keep working or classify INCONCLUSIVE.
Default: test-driven development. Write a failing test in a standard WP test location (tests/phpunit/tests/... or tests/qunit/tests/...). Verify it fails. Implement the fix. Verify it passes.
TDD waiver — only for genuine UI/visual bugs where the underlying logic cannot be isolated into a function-level test. If waived, replace the report's "verification" field with the exact manual recipe (browser MCP steps or shell sequence) needed to re-verify the fix. Document the waiver reason in one sentence.
Minimal but complete. The fix touches only the lines that must change. Variables that become unused or names that become misleading as a consequence of the fix may be updated. Side-quests — refactoring, cleanup of pre-existing issues, restructuring "while we're here", touching adjacent code — are disallowed.
Hard cap: ~100 lines including the test. If the fix grows past that, stop. Classify REPRODUCED+UNFIXED with notes describing what a fuller fix would entail. A small reviewable diff is worth more than a sprawling one.
Run, in this order:
vendor/bin/phpcs <changed-files> — run as soon as the new test passes, on the modified source and test files only. WordPress core enforces phpcs cleanliness; failing it blocks merge. Run early so any style fixes happen before the broader checks.vendor/bin/phpunit --group dependencies for script-loader tests). Confirm zero regressions.Before committing, review your own diff adversarially — as if reviewing a stranger's PR. Ask:
Address what you find. If a concern can't be resolved within scope, capture it in the report's notes field rather than expanding the diff.
Commit on the trac-<ticket>/<slug> branch with a WP-style message:
<Component>: <imperative summary>.
<2-4 paragraphs explaining the bug, the fix, and any subtlety>.
See #<ticket>.
Stage files explicitly (git add <file1> <file2>). Never git add -A — .envlite/ and other generated artifacts must not be committed.
Produce the final report as the last message of the conversation, 250 words max:
classification: <REPRODUCED+FIXED | REPRODUCED+UNFIXED | NOT-REPRODUCIBLE | INCONCLUSIVE>
worktree: <absolute path>
branch: trac-<ticket>/<slug> (commit <sha>)
root cause: <one sentence | n/a>
repro: <exact command/URL/recipe — when the ticket's wording could plausibly refer to more than one UI surface, enumerate each with its state: broken / unaffected / not-checked. Do not declare REPRODUCED+FIXED with any plausible surface in not-checked state.>
repro evidence: <"Ticket reports X; repro produces Y; X ≈ Y because Z" | n/a>
fix: <one sentence | n/a>
verification: <command + observed result, OR manual recipe + observed result>
test: <path to test file | waiver: <reason>>
files changed: <list | none>
notes: <≤3 lines on edge cases, surprises, reviewer caveats>
references/repro-strategies.md — detailed phpunit / qunit / browser MCP guidance, including WP test conventions, action-firing patterns, output capture via get_echo, ticket-snippet sanity checks (re-entrancy, broken samples), mu-plugin + browser end-to-end repro pattern, escalation rules, and probe technique for NOT-REPRODUCIBLE evidence.references/worked-example.md — full walkthrough of Trac #50040 (datepicker footer localization) from setup through report, including the critical-reading-of-comments lesson.testing
Browse WordPress Trac timeline activity feed. Use when the user asks about recent WordPress core Trac activity, commits, ticket changes, or what a specific author has been working on. Matches queries like "recent trac activity", "what has USER done on trac", "WordPress core commits this week", "show me USER's trac contributions".
development
Look up a specific WordPress Trac ticket by its number to see all information about it: metadata, description, attachments, linked changesets, discussion comments, and GitHub pull requests. Accepts #62345, 62345, or https://core.trac.wordpress.org/ticket/62345. Use whenever the user references a specific ticket number. Do NOT use wp-trac-search for single ticket lookups.
development
Search and filter WordPress Trac tickets on core.trac.wordpress.org. Use when the user wants to find tickets matching criteria, search for bugs, query open or closed tickets, filter by component (e.g., "HTML API", "Editor", "REST API"), or search by status, milestone, owner, reporter, type, or keywords. NOT for looking up a single ticket by number — use wp-trac-ticket for that. Example queries: "find open HTML API tickets", "search for closed editor bugs", "tickets assigned to <username>".
tools
Look up a WordPress Trac changeset (commit, revision) to see the commit message, author, and timestamp. Accepts [41062], r41062, or https://core.trac.wordpress.org/changeset/41062. Use when the user asks about a commit, revision, changeset, or "what changed in rNNNNN".