/xwiki:xwiki-fix-deprecationfrom xwiki
Migrates all callers of a deprecated XWiki Java API to its replacement across Java, Velocity, Groovy, JavaScript, and wiki pages, then retires the API to its -legacy module.
Ships in xwiki. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A deprecated API is retired in two steps (the backward-compatibility KB topic): first every XWiki
caller moves to the replacement, then the API itself moves to its -legacy module. This skill
does the first step and hands the second to xwiki-legacy. Every caller means every language: a
Velocity template or a wiki page calling the deprecated API is migrated like a Java class.
xwiki-commons, xwiki-rendering and xwiki-platform are released together, so a caller in any of them counts. Work where the callers are; the API may be declared in another repo.
The tools below live in this skill's tools/ directory (in Claude Code
${CLAUDE_PLUGIN_ROOT}/skills/xwiki-fix-deprecation/tools/, in Kimi Code ${KIMI_SKILL_DIR}/tools/, in
opencode $XWIKI_LLM_HOME/xwiki/skills/xwiki-fix-deprecation/tools/). Both are plain Node, no install.
Named by the developer — go to step 2.
Not named — propose candidates, run from the repo whose deprecations you want to retire:
node <tools>/find-candidates.mjs --limit 30 [--module <path substring>] [--json <work-dir>/candidates.json]
It lists the repo's deprecated main-code APIs, easiest first, with the callers it finds by name in the
three sibling checkouts (--repos to point elsewhere). APIs nothing calls any more come first — they
only need the move of step 6; --min-callers 1 shows the ones needing a migration. Counts are upper
bounds: a zero is reliable, a small count is not proof (a common name collects homonyms; the notes
say when callers do not even name the declaring class). Present about ten to the developer as a table
— API, since, Java / test / script callers, replacement, notes — and let them pick. Prefer, in order:
legacy weaver exists: the later move needs no new legacy module, no pom or WAR change;since; script callers cost more than Java ones (step 4 says why).Set aside, even at zero callers: a component type (its role hint is the contract, not the Java type);
anything whose @deprecated text gives no replacement and is not a no-op — ask the developer what
replaces it.
Read the @deprecated Javadoc and both implementations. Migrating is only mechanical when they are
equivalent; the usual gaps are:
XWikiContext) vs. an explicit argument;null handling, return value on "not found", checked vs. unchecked exceptions;When they are not equivalent, adapt each caller to keep its behaviour, or stop and ask.
Compile, don't grep, for the exact list. XWiki builds compile with -Xlint:all and
showDeprecation, so the build log names every call, resolved by type:
mvn clean test-compile -B -ntp -Plegacy -pl <modules> > <work-dir>/build.log 2>&1
node <tools>/deprecation-warnings.mjs <work-dir>/build.log [--api <Class#member>]
The modules are those find-candidates (or a grep) found callers in. Then grep for what javac does not
see — each of these is a caller to migrate too:
@Deprecated;$obj.method( and getters read as properties ($obj.fooBar for
getFooBar()/isFooBar()), Groovy, JavaScript — in templates (*.vm), skin files and wiki pages
(src/main/resources/**/*.xml, content and objects alike). A script usually reaches the API through
a wrapper — $xwiki, $doc, $xcontext (com.xpn.xwiki.api.*) or $services.<hint> — so grep the
wrapper's deprecated member too, not only the core class's.Callers inside -legacy modules are legacy code: leave them.
when(mock.oldMethod()), verify(...).oldMethod())
must move to the new method too: once the caller changed, the old stub no longer matches, and the test
fails — or, worse, passes without testing anything. A replacement that is a different component needs
its own @MockComponent. Load xwiki-test-guidelines before editing any test.com.xpn.xwiki.api.* wrappers and
script services; the replacement must be callable from there, with arguments a script can build (a
reference from $services.model.resolveDocument(...), not a Java constructor). When the replacement is
not exposed to scripts, stop and ask: exposing it is new API, not a migration.String where the
replacement takes a reference — is not an error: the call is printed as-is or yields nothing. Match the
replacement's signature exactly, and prove the result in step 5.$escapetool.xml(...)), its #set/$NULL handling, the
rights it runs with (Groovy needs programming right; do not move code between the two).xwiki-xar-pages conventions (mvn xar:format, page version untouched,
content XML-escaped in the .xml).Build every module you touched, plus any -legacy module weaving one of them, with the quality checks
(xwiki-build has the details):
mvn clean verify -B -ntp -Plegacy,quality -fae -pl <touched modules>,<their legacy weavers>
verify, not install: install writes your modified SNAPSHOTs into the shared ~/.m2,
where every other checkout on the machine then picks them up.deprecation-warnings.mjs on this log: the migrated API must be gone from it.*PageTest unit tests, and the Docker functional tests covering the page or template when
they exist (xwiki-build). With neither, deploy the module (xwiki-deploy-extension) and look at the
rendered page, before and after — say in the PR which of these you did.Only when steps 3–5 leave no caller in any of the three repos, in any language (legacy code aside):
internal package: not API — delete it.xwiki-legacy skill. It re-adds the API in the legacy module, so
existing extensions keep working, with no Revapi ignore (the only exception needs the developer's
explicit approval — see that skill).When a caller cannot be migrated (its replacement is not exposed to scripts, say), stop after step 5 and report it: the move waits. When the API lives in another repo than its callers, the caller PRs are merged first, then the move is a PR in the declaring repo.
[Misc] is fine. An issue is always
acceptable too — then component Development Issues only (kb/servers/jira.md), and the commit
summary is its title, verbatim.master only.xwiki-pull-request; in "Executed Tests", list the mvn commands, state that the
deprecation warnings for the API are gone, and how each migrated script was checked.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub xwiki/xwiki-dev-llm --plugin xwikiOther plugins' skills for the same job
38 skills in this plugin
/xwiki-backportBackport any change (bug fix, feature, refactor, or test) to an older branch of an XWiki repo (xwiki-platform / xwiki-commons / xwiki-rendering / xwiki-contrib). Cherry-pick `-x` the source commit(s) into a worktree, ADAPT the result to the older branch (module pom versions, Java level, `@since` tags, data migration versions and skip ranges, style/API divergence), verify it compiles against that branch, and push / open a PR. Use whenever a commit that exists on one branch needs to be applied to an older/maintenance branch. For the `testneeded`-labelled test sweep use xwiki-backport-testneeded (which builds on this skill); for Maven commands use xwiki-build; for PR/commit conventions use xwiki-pull-request; for the versioning/`@since` conventions (the format and what carries `@since`) use xwiki-knowledge./xwiki-backport-testneededBackport the automated test of one JIRA issue labelled `testneeded` to the currently-supported stable branches, adjust its `@since` tags across all branches, and open the PRs. Use when asked to backport the test of a given testneeded issue, or to catch a stable branch up with a recently-added test. (For several issues at once, the user will say so — then apply this per issue.) This is the test-specific layer on top of xwiki-backport (which owns the generic cherry-pick / adapt-to-branch / verify mechanics — including the mandatory pom-version, Java-version and `@since` checks). For Maven use xwiki-build; for PR/commit conventions use xwiki-pull-request; for the `@since` rules use xwiki-knowledge; for querying JIRA (the testneeded sweep) use xwiki-jira.