/xwiki:xwiki-javadocfrom xwiki
Writes clear, useful Javadoc for XWiki Java code following XWiki Java Code Style and Oracle conventions. Use when adding or improving Javadoc on classes, interfaces, methods, fields, or parameters in an XWiki repo.
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.
XWiki follows the Oracle "How to Write Doc Comments" style guide, as stated in the XWiki Java Code Style. The bar is not "Checkstyle passes" — it is "a caller who has never seen the code can use the API correctly from the Javadoc alone".
The frequent failure is Javadoc that restates the name and stops. Document the things a caller actually wonders about, and verify each against the implementation — never guess:
{@code ...} (for example {@code xwiki}, {@code WebHome}).null / empty / absent behaviour: what does passing null (or omitting a query parameter) do?{@code -1}), or a cap that triggers an error?{@code asc} / {@code desc}), and what an invalid value does (reject? fall back?).@throws state real conditions (lack of
rights vs. not-found vs. validation failure), not a vague "if an error occurs".Before writing a parameter's description, read the method's implementation (and the service it delegates to) to learn the real contract. If a detail genuinely can't be determined, describe what is known — do not invent.
// BAD — restates the name, tells the caller nothing
/**
* @param spaceName the space where the page is located in
* @param start the index of the first attachment to return
* @param number the maximum number of attachments to return
*/
// GOOD — verified against the implementation
/**
* @param spaceName the reference of the space(s) containing the page; nested spaces are separated by
* {@code /spaces/} (for example {@code A/spaces/B/spaces/C} for the space {@code A.B.C})
* @param start the 0-based index of the first attachment to return, used together with {@code number} for
* pagination; defaults to {@code 0}
* @param number the maximum number of attachments to return; when {@code null} the wiki's configured REST query
* limit is used, and a value that is negative or larger than that configured limit is rejected with a
* {@code 400} response
*/
Returns the label. / Gets the label. (preferred) — not Return the label. or Get the label..@param descriptions).@param: @param name <description>. The description is a lowercase phrase (uppercase only if it is a full
sentence). End with a period only if another sentence follows. Do not wrap the parameter name in <code>/
{@code} (Javadoc does that automatically, and Checkstyle compares the name to the signature).@return: a phrase describing what is returned and its meaningful states; omit only for void methods.@throws: @throws SomeException if <condition>. Document checked exceptions and any unchecked exception a
caller might reasonably catch (not NullPointerException).{@code ...} / {@link ...} for keywords, identifiers and literals — used economically (link the first
occurrence of an API name, not every one).e.g.), "that is" (not i.e.), "also known as" (not
aka), "namely" (not viz.). ("etc." is fine.)@param → @return → @throws → @see → @since → @deprecated.@version $Id$ on every class/interface (unexpanded keyword — SCM expands it). Never use @author —
XWiki has no code ownership.@since on new API, using the next release of the current dev version written <X.Y.0>RC1 (for example
18.6.0RC1). Read the real current version from the root pom.xml; do not trust a cached value. See the
versioning rules via the xwiki-knowledge skill.@Deprecated annotation (with since = "…", no forRemoval — XWiki does not break
APIs) and the @deprecated Javadoc tag. In the tag say WHY it is deprecated and WHAT to use instead (with a
{@link}); do not repeat the version there (the annotation's since is what the tool shows). For deprecation
across several branches use a comma-separated since, for example @Deprecated(since = "14.10.12,15.5RC1").@Override method, either add nothing (inherits automatically) or
use {@inheritDoc} and then add only what is specific. Always keep the @Override annotation.{@return ...} combo tag — allowed, but only for simple gettersJava 16's inline {@return description} folds the summary and @return into one. XWiki's Checkstyle now accepts
it (fixed in xwiki-commons by the "[Misc] Allow {@return...} structure" change), so it no longer breaks the
-Pquality build on current versions. The community agreed
(forum discussion) to
use it only for simple getter(-like) methods whose entire behaviour fits in the one or two sentences of the tag:
/**
* {@return the key of the space this page belongs to, for example {@code Main}}
*/
String getParentSpaceKey();
It is not a replacement for comprehensive Javadoc. As soon as there is anything a caller needs to reason about
(parameters, sentinel values, null behaviour, defaults, error conditions — see "be useful, not shallow" above), keep
the classic form: a standalone first-sentence summary and a separate @return tag, both carrying the real detail.
If summary and @return feel redundant, that is the signal to make the Javadoc better (add the missing detail), not
to collapse it into {@return}.
Notes:
Returns + your text + ., so write it as a noun phrase ({@return the label}), not a
full sentence beginning with "Returns".{@return} still fails -Pquality (with JavadocStyle: First sentence should end with a period. / JavadocMethod: @return tag should be present and have description.); use the
classic form there. Verify with the -Pquality profile (see below).MissingJavadocType / MissingJavadocMethod checks require Javadoc on API types/methods. Write the Javadoc —
never add @SuppressWarnings("checkstyle:MissingJavadocType"|"checkstyle:MissingJavadocMethod") to silence them.
If a method legitimately needs many parameters, keep only the unrelated suppression it already carries (for example
@SuppressWarnings("checkstyle:ParameterNumber")).-Pquality profile using the xwiki-build skill, for example (single module):
mvn -B -ntp checkstyle:check@default -Pquality -pl <module>. Aim for 0 Checkstyle violations.What SKILL.md sets; muted values are Claude Code's defaults
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.