AI Agent Hub
Back to skills
Java Comment Standards Assistant icon

Java Comment Standards Assistant

Development Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please follow https://skillhub.cn/install/skillhub.md to install @user_b0ac05b7/java-comment-rules.

About this skill

Problem

  • Class metadata: fields such as @author, @version, @company, and @description often appear inconsistently or with unclear provenance, especially when creating and modifying classes.
  • Business comments: line-ending /* ... */, mixed languages, and inconsistent blank lines make code review harder.
  • Versioning: it is unclear whether a change should be 1.0, 1.1, or 2.0, which can create misleading version numbers.
  • Encoding: a BOM can cause Java compilation to report illegal character: '\ufeff'.

How It Works

The skill turns docs/JAVA_COMMENT_RULES.md into an execution checklist:

  1. For new classes, complete the /** ... */ comment and fill the template fields.
  2. For existing classes, preserve @createTime and historical @modifyRecord entries, and update @description with the current change.
  3. Before changing @version, inspect Git for a release branch or release tag, then compare the same-path class file. If missing, use 1.0; if present with no new method, bump the minor version; if a new method signature is added, bump the major version.
  4. Business code comments should be Chinese block comments placed above the target line, not at line endings.
  5. Apply blank-line rules: if the comment is the first line inside { ... }, place it directly below {; otherwise keep one blank line above it.
  6. Keep files as UTF-8 without BOM and verify that no line-ending block comments remain.

Boundaries

  • It supports adding, adjusting, reviewing, and standardizing Java comments, but does not replace the full project specification.
  • @author, @registerPosition, and @modifier should be left blank when unknown, or inferred carefully from context.
  • @version depends on Git/release availability; fallback reasoning is only an approximation.
  • A new method is detected by method signatures; field, import, comment, or internal-logic changes do not count as new methods.

Use Cases

  • Fill Java class metadata with a standard template.
  • Keep history and append current change notes.
  • Move line comments above code and fix blanks.
  • Use Git release comparison to bump versions.

Best For

  • Java engineers enforcing consistent comment style in code review
  • Developers maintaining service-class versions and change history
  • Maintainers cleaning legacy line comments and blank lines
  • Java engineers using Git release data to bump versions