clarify-java-comments
Skill739 starsChanged 6 days agoApache-2.0View on GitHub
Clarify or review Java Javadocs, Javadoc tags, and explanatory code comments for legibility, accuracy, and source alignment. Use when asked to simplify verbose or generated comments, edit documentation in a local file, class, or member, repair Javadoc markup, propose copy-ready replacements, or add GitHub suggestions to an existing pending PR review. Documentation-focused: never change executable code or turn the task into a general code review. Do not submit a review unless explicitly requested.
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- build-logic/AGENTS.mdAGENTS.md
- buildSrc/AGENTS.mdAGENTS.md
- build-logic/CLAUDE.mdCLAUDE.md
- buildSrc/CLAUDE.mdCLAUDE.md
- .claude/CLAUDE.mdCLAUDE.md
- apm-integrationsSkill
- fix-continuation-leakageSkill
- java-lintSkill
- migrate-groovy-to-javaSkill
- migrate-junit-source-to-tabletestSkill
- perf-reviewSkill
- reproduce-ci-flakinessSkill
- resolve-muzzle-ciSkill
- review-groovy-migrationSkill
- techdebtSkill
- fix-continuation-leakageSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
25 rules. About 0 are common, 23 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈23
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
- could be automatic: a setting could enforce it
- Distinctive: line 32
Read enough surrounding implementation, tests, and callers to verify every retained claim.
- Distinctive: line 35
Before shortening a comment, inventory its distinct technical claims and invariants.
- Distinctive: line 43
Read all references that apply to the request:
- Distinctive: line 55
Use this deletion test before shortening or removing explanatory detail: would its absence make a competent maintainer likely to miss a …
- Distinctive: line 59
Keep a verified explanation when it affects the API contract, correctness, safe modification, compatibility, or performance and is not …
- Distinctive: line 62
Treat behavior as non-obvious when it is implicit in the platform or runtime, such as JVM, Java Memory Model, or JIT behavior.
- Distinctive: line 73
Do not equate proximity with obviousness.
- Distinctive: line 82
Do not remove JVM internals merely because they are arcane.
- Distinctive: line 93
Use a one-line Javadoc for an obvious delegate or predicate.
- Very specific: line 101
Prefer <pre>{@code ...}</pre> for a useful copy-ready example.
- Distinctive: line 103
When a claim depends on JVM, library, or tool behavior outside the repository, verify it with primary sources such as OpenJDK source or the …
- Distinctive: line 106
Use plain international English.
- Distinctive: line 115
Put the main point first. Use a concrete subject and an active verb where practical.
- Distinctive: line 116
Keep one idea per sentence and one purpose per paragraph.
- Distinctive: line 120
Keep the connective sentence that makes a causal relationship understandable.
- Distinctive: line 122
Use terminology that matches the code and domain.
- Distinctive: line 124
Read the replacement once in its surrounding context.
- Distinctive: line 135
Keep comments that record an invariant, a non-obvious reason, a compatibility constraint, or a deliberate tradeoff.
- Distinctive: line 138
Never modify suppression directives, generated markers, license text, or tooling instructions in this skill.
- Distinctive: line 144
Before presenting, applying, or posting a replacement:
- Distinctive: line 147
Check reused state, cached values, version-dependent behavior, and benchmark setup.
- Distinctive: line 149
Verify links and tags name real types, members, and parameters.
- Distinctive: line 150
Keep the replacement compatible with the original comment kind, surrounding delimiters, and repository formatting.
- Distinctive: line 157
If verification cannot run, state exactly what was not run and why.
- Very specific: line 160
If the workflow needs non-trivial scripting, use a Java 25 source-file launch script and run it directly with java --source 25 …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Clarify Java Comments
Produce concise documentation that preserves the contract, useful conclusions, and important hidden behavior without narrating every inference or obvious implementation step. Treat existing comments and PR descriptions as claims to verify against the current source.
Scope the work
- Review or edit only the Javadocs and explanatory code comments changed by the diff or explicitly named by the user.
- Read enough surrounding implementation, tests, and callers to verify every retained claim. Report an inaccurate claim instead of preserving it in smoother prose.
- Before shortening a comment, inventory its distinct technical claims and invariants. Classify each as supported and important, obvious or redundant, or unsupported. Preserve every supported non-obvious item in the rewrite.
- Stay documentation-focused. Do not expand into a general correctness or performance review unless a behavioral issue makes the proposed Javadoc false.
Route the workflow
Read all references that apply to the request:
- Javadoc tags for whole-comment rewrites or explicit tag repair.
- Local edits before changing documentation in the checkout. A path selects a target but does not authorize an edit.
- GitHub reviews before any GitHub review workflow. Posting, replying, editing, and submitting each require the separate authorizations defined there.
Decide what deserves explanation
Use this deletion test before shortening or removing explanatory detail: would its absence make a competent maintainer likely to miss a material constraint or have to reconstruct it through specialist knowledge or non-local investigation?
- Keep a verified explanation when it affects the API contract, correctness, safe modification, compatibility, or performance and is not cheaply recoverable from the signature and nearby straight-line code using ordinary Java knowledge.
- Treat behavior as non-obvious when it is implicit in the platform or runtime, such as JVM, Java Memory Model, or JIT behavior; when its cause or effect lies elsewhere, such as in a caller, lifecycle, generated bytecode, or downstream consumer; or when the local code requires specialist reasoning about synchronization, memory visibility, interleavings, type profiling, allocation, or escape analysis.
- Preserve the shortest causal chain that explains the constraint: the condition or mechanism, the resulting effect or invariant, and why it matters to callers or future changes. Omit intermediate proof steps once that chain is understandable.
- Omit prose that only restates names, types, syntax, or visible control flow; repeats the same contract or conclusion; catalogs irrelevant alternatives or history; or adds technical detail without a reader-relevant consequence.
- Do not equate proximity with obviousness. Nearby code can require explanation, and distant or technical behavior should be retained only when it materially matters.
Rewrite for readers
- Lead with the API contract or purpose. Apply the decision rule above to any explanatory detail beyond that contract.
- Express each retained explanation as a compact causal chain rather than narrating every inference.
- Do not remove JVM internals merely because they are arcane. When relevant, retain
matters such as Java Memory Model publication and happens-before guarantees, safe
traversal through retained links, HotSpot escape analysis or devirtualization,
composite-key allocation, identity fast paths and boxing, atomic updater and
reservation accounting, or type erasure in runtime containers such as
AtomicReferenceArray. These are examples of details to preserve, not a checklist of content to invent. - Define specialist terms on first use. Prefer one compact explanation over a historical detour or a list of what the code does not do.
- State a supported conclusion once. Retain only the reasoning needed to satisfy the decision rule above and make the conclusion safe to act on.
- Use a one-line Javadoc for an obvious delegate or predicate. Use paragraphs only when they carry distinct information.
- For benchmark documentation, separate inputs and setup from measured results and conclusions. Keep existing JMH result tables and numbers when present unless the user asks to remove them or evidence shows that they are stale or invalid. Retain the environment details needed to interpret the numbers, and remove speculation that was not measured. If results are unreliable, flag the problem instead of silently replacing the evidence with prose.
- Prefer
<pre>{@code ...}</pre>for a useful copy-ready example. Do not add an example when the signature already makes usage clear. - When a claim depends on JVM, library, or tool behavior outside the repository, verify it with primary sources such as OpenJDK source or the maintained project's official documentation. Do not rely on commercial aggregator sites.
- Use plain international English. Remove stacked parentheticals, repeated claims, conversational asides, promotional adjectives, and long "not to be confused with" passages.
Write for one-pass reading
A rewrite must be easier to understand, not merely shorter. Aim for an informative, concise, legible, blog-like technical style.
- Put the main point first. Use a concrete subject and an active verb where practical.
- Keep one idea per sentence and one purpose per paragraph. Split nested clauses and long parenthetical chains.
- Name the relevant method, state, or JVM mechanism instead of relying on an unclear pronoun or distant antecedent.
- Keep the connective sentence that makes a causal relationship understandable. Concision must not make the text compressed, cryptic, or abrupt.
- Use terminology that matches the code and domain. Replace vague generated labels with names a maintainer would naturally use.
- Read the replacement once in its surrounding context. If understanding a sentence requires backtracking to find its subject, condition, or conclusion, rewrite it.
Reword explanatory code comments
Apply the same source-grounded rewrite to // and /* ... */ comments that narrate
obvious steps, repeat conclusions, stack caveats, or otherwise read like generated
verbiage.
- Preserve the comment's form and scope; do not turn an implementation comment into Javadoc unless the user requests an API documentation change.
- Keep comments that record an invariant, a non-obvious reason, a compatibility constraint, or a deliberate tradeoff. Remove line-by-line narration of code that is already clear.
- Never modify suppression directives, generated markers, license text, or tooling instructions in this skill. Preserve TODO/FIXME ownership and status; rewrite only their explanatory prose when the user explicitly names it.
Check the replacement
Before presenting, applying, or posting a replacement:
- Compare each sentence with the exact source and relevant tests.
- Check reused state, cached values, version-dependent behavior, and benchmark setup; these commonly make plausible Javadoc claims false.
- Verify links and tags name real types, members, and parameters.
- Keep the replacement compatible with the original comment kind, surrounding delimiters, and repository formatting.
- For prose-only local edits, run the narrowest formatting check. When links, tags,
or examples changed, also run the narrowest available Javadoc or doclint task and
any compilation needed to resolve referenced symbols. Run Gradle with
./gradlew .... After a GitHub mutation, re-fetch and verify the exact body, path, range, commit, owning review, and expected review state. - If verification cannot run, state exactly what was not run and why. Do not turn an environment or unrelated pre-existing failure into a finding about the rewrite.
If the workflow needs non-trivial scripting, use a Java 25 source-file launch script
and run it directly with java --source 25 <script>.java; keep shell usage to simple
commands such as gh, rg, and sed.
Report the outcome
Summarize which Javadocs or draft comments were changed or proposed, call out corrected factual claims, and state the verification performed. After suggestion-only mutations, confirm the review remains pending. After submission, report the selected event, terminal state, and submission timestamp.
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.

