/xwiki:xwiki-legacyfrom xwiki
Moves deprecated public XWiki APIs from main modules into backward-compatibility -legacy modules using AspectJ weaving or plain class re-addition, with Revapi enforcement.
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.
None: SKILL.md is the whole skill.
-legacy moduleXWiki keeps binary/semantic backward compatibility (enforced by Revapi — see the
backward-compatibility KB topic). A deprecated public API therefore cannot simply be deleted:
it is removed from the main module and re-added by that module's -legacy companion, which
weaves the main artifact with AspectJ and re-exports it under the same
xwiki.extension.features. Existing extensions that still call the old API keep working by depending
on the legacy jar; the main jar is clean.
Do this only for a public API that nothing calls any more (step 1). Purely internal classes are
not API — just delete them, no legacy needed.
Confirm the API is deprecated with a documented replacement (@deprecated … use {@link …}), and that
no caller is left in xwiki-commons, xwiki-rendering or xwiki-platform (released together), in any
language: finding and migrating them is the xwiki-fix-deprecation skill.
Delete the declaration (and, for an interface method, its implementations). Keep the replacement.
Fix any @see/{@link} references that pointed at the removed member.
-legacy modulePick the pattern by API shape. Study the sibling that already does it (xwiki-commons-legacy-job
for whole types, xwiki-commons-legacy-velocity / xwiki-commons-legacy-component for aspects).
Whole type (class / interface / enum): move the .java file verbatim into the legacy module
under the same package (see xwiki-commons-legacy-job → JobManager). Nothing else needed beyond
the module being a weaver (step 4) — a re-added top-level type does not even require an aspect.
Instance method / field on a concrete class: add an AspectJ inter-type declaration in a
src/main/aspect/…/<Class>CompatibilityAspect.aj, delegating to the replacement, e.g.
public privileged aspect JSONToolCompatibilityAspect
{
@Deprecated
public Object JSONTool.parse(String json)
{
return fromString(json);
}
}
Interface method: an ITD cannot add an abstract method to an interface's implementors, so use a
companion interface carrying the method as a default method, plus a declare parents aspect
that makes the woven interface extend it:
// CompatiblePropertyDescriptor.java (plain source in the legacy module)
public interface CompatiblePropertyDescriptor
{
@Deprecated
default Field getFied()
{
return ((PropertyDescriptor) this).getField(); // delegate to the replacement
}
}
// PropertyDescriptorCompatibilityAspect.aj
public aspect PropertyDescriptorCompatibilityAspect
{
declare parents : PropertyDescriptor implements CompatiblePropertyDescriptor;
}
After weaving, PropertyDescriptor extends CompatiblePropertyDescriptor, so every implementation
inherits the default getFied() — no per-class ITD required. (The older -legacy-component code
predates default methods and instead pairs an abstract Compatibility* interface with a per-class
ITD aspect; prefer the default-method form in new code.)
Three traps the legacy module's build rejects:
static final primitive/String) cannot be an ITD field: AspectJ emits
it non-final, set from <clinit> (java.field.noLongerConstant). Declare it in a
Compatibility<Class>Constants interface in the legacy module and add
declare parents : <Class> implements Compatibility<Class>Constants; — interface fields are real
constants, and <Class>.NAME still resolves.Serializable class without an explicit serialVersionUID fails AspectJ
(Xlint:needsSerialVersionUIDField, an error in XWiki builds). Add
private static final long serialVersionUID = 1L; to the main class, as elsewhere in the codebase.ajc gets the
sources in file-system listing order, so it may check the subclass first. Green on CI, red on some
machines. Put the subclass ITDs in the aspect of the class that carries the inherited ITDs (see
ListClassCompatibiityAspect in xwiki-platform-legacy-oldcore).Give new legacy types/aspects @since <next-version>RC1 (see xwiki-knowledge for the version
string) and keep the original @deprecated since … line.
A legacy module that only added classes (no <weaveDependency>) becomes a replacement of the
main artifact the moment it must modify an existing type. Mirror xwiki-commons-legacy-velocity's
pom.xml:
xwiki.extension.features = <groupId>:<main-artifactId> and an xwiki.extension.name.<xwiki.revapi.skip>true</xwiki.revapi.skip> with the comment
Skipping revapi since <legacy-artifactId> wraps this module and runs checks on it — Revapi moves to
the legacy module, which checks the woven jar (see xwiki-platform-refactoring-api).<type>pom</type> (trigger, no jar) and again as
<scope>provided</scope> (build order + weaving source); add org.aspectj:aspectjrt.aspectj-maven-plugin with a <weaveDependency> naming the main artifact.maven-jar-plugin excluding **/builddef.lst.maven-surefire-plugin classpathDependencyExcludes for the main jar (and
xwiki-commons-component-api jar) so tests run against the woven jar only.META-INF/components.txt, a maven-antrun-plugin step (phase
process-classes) that concats the legacy module's own components.txt onto the woven one
(append="true"). The woven jar must end up with all component lines (main + legacy). Verify:
wc -l target/classes/META-INF/components.txt and check for no duplicates.ComponentAnnotationProcessor skipForeignDeclarations=true
(the merged components.txt references classes that come from the woven dependency).A move to legacy adds no <revapi.differences> entry: the main module skips Revapi (step 4) and the
legacy module's Revapi compares the woven jar with its previous release. A Revapi error on the legacy
module means the re-add is not faithful — fix the re-add. A downstream consumer failing (step 8) is not
fixed by an ignore either: see the backward-compatibility KB topic.
Once the legacy module weaves the whole main artifact, its jar now bundles the (untested-here) main
classes, so its JaCoCo instruction ratio drops sharply. Lower xwiki.jacoco.instructionRatio to the
new achieved value with a comment explaining the module re-exports the main artifact (as
xwiki-commons-legacy-velocity does). Use the xwiki-increase-test-coverage skill to compute it.
A weaving legacy module's jar is a full replacement of the main jar, so packaging both in the
WAR under the legacy profile is a conflict (duplicate, woven-vs-clean classes). If step 4 turned a
previously non-weaving legacy module into a weaver — i.e. the main artifact was not banned before
— you must update
xwiki-platform-distribution/xwiki-platform-distribution-war-legacydependencies/pom.xml in the
xwiki-platform repo (released together with commons/rendering):
maven-enforcer-plugin bannedDependencies rule:
<exclude>org.xwiki.commons:xwiki-commons-<name>:*:jar:*</exclude> — this fails the build if the
clean jar ever comes back, andxwiki-platform-distribution-war-dependencies dependency
(and from any other legacy dependency that pulls it in transitively — the enforcer tells you where).Model it on the existing xwiki-commons-velocity / xwiki-commons-component-* entries, which are
wrapped commons modules handled exactly this way. (A legacy module that was already a weaver — and
thus already banned — needs nothing here.)
Build the main module and the legacy weaver with all checks — this is exactly the case the
xwiki-build skill covers ("also rebuild any legacy module that weaves the changed module"):
mvn clean install -B -ntp -Pquality,legacy \
-pl <main-module-path>,<legacy-module-path>
-Pquality is mandatory: it adds the JaCoCo check (confirms the lowered ratio) to Revapi, which
runs in any build. Then
sanity-check the outcome with javap on the woven legacy classes: the main jar must no longer expose
the API, and the legacy jar must re-add it.
A module depending on the clean main jar whose own API reaches the changed class still sees the member as removed. When the moved API sits on such a class, check one of those consumers:
cd <a module depending on the main artifact> && mvn compile revapi:check -B -ntp -Pquality
If it fails, exclude the main artifact from its dependents' Revapi analysis as the KB topic describes (not a per-method ignore), and re-run it.
Open the PR with the xwiki-pull-request conventions ([Misc] prefix when there is no JIRA issue).
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.