/java-skills:java-code-commentsfrom java-skills
Adds Java code comments following industry standards and JavaDoc best practices. Handles class-level, method-level, and field-level comments for common Java component types like Controller, Service, Entity, DTO, and Mapper.
Ships in java-skills. 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.
ALWAYS use this skill when the user mentions:
Trigger phrases include:
Component types this skill handles:
CRITICAL: This skill should be triggered when the user wants to add comments to Java code, regardless of the component type or complexity.
This skill follows a systematic 4-step workflow:
CRITICAL: Before adding any comments, you MUST:
Scan all Java files in the project:
.java files in the current directory and subdirectoriesRead related documentation:
Understand the context:
Identify patterns:
Output: A summary of your understanding of the codebase, including:
CRITICAL: You MUST ask the user to confirm which component types need comments.
Present a checklist of common Java component types and ask the user to select:
请确认需要进行代码注释的分类(可多选):
- [ ] Controller(控制器)
- [ ] Service(服务接口)
- [ ] ServiceImpl(服务实现)
- [ ] Application Service(应用服务,DDD架构)
- [ ] Domain Service(领域服务,DDD架构)
- [ ] Feign Service Interface(Feign远程服务接口)
- [ ] Mapper(数据访问层)
- [ ] Model(数据模型)
- [ ] Entity(实体类)
- [ ] BO(业务对象)
- [ ] DTO(数据传输对象)
- [ ] VO(视图对象)
- [ ] DAO(数据访问对象)
- [ ] Repository(仓储)
- [ ] Configuration(配置类)
- [ ] Component(组件类)
- [ ] Utility(工具类)
- [ ] Exception(异常类)
- [ ] 其他(请 specify)
Also ask about comment types:
Wait for user confirmation before proceeding to the next step.
CRITICAL: After user confirms component types, create a detailed todo list.
For each component type selected by the user:
Scan the codebase to find all matching classes:
*Controller.java, *Service.java)For each class, identify:
Generate a structured todo list in the following format:
## Todo List: Java Code Comments
### Controller 层
- [ ] UserController
- [ ] 类注释
- [ ] createUser() - 方法注释
- [ ] updateUser() - 方法注释
- [ ] deleteUser() - 方法注释
- [ ] userId - 属性注释
### Service 层
- [ ] UserService
- [ ] 类注释
- [ ] findUserById() - 方法注释
- [ ] saveUser() - 方法注释
### ServiceImpl 层
- [ ] UserServiceImpl
- [ ] 类注释
- [ ] findUserById() - 方法注释
- [ ] saveUser() - 方法注释
### Mapper 层
- [ ] UserMapper
- [ ] 类注释
- [ ] selectById() - 方法注释
### Model/Entity 层
- [ ] User
- [ ] 类注释
- [ ] id - 属性注释
- [ ] username - 属性注释
- [ ] email - 属性注释
Important:
CRITICAL: Add comments in the specified order and update todo list after each completion.
Order of execution:
For each item in the todo list:
Process one class at a time:
Class-level comment format (Standard JavaDoc):
/**
* [Class description]
*
* <p>This class [purpose and responsibility]
*
* @author [Author name if available]
* @since [Version or date if available]
*/
public class UserController {
Class-level comment format (Java Coding Standards - strict):
/**
* <p>[Class description]</p>
*
* <p>This class [purpose and responsibility]</p>
*
* @author [Author name if available]
* @since [Version or date if available]
*/
public class UserController {
Specialized class comment formats (Java Coding Standards - strict):
Application Service:
/**
* {服务名称}应用服务
*
* <p>{详细描述服务的业务功能、职责和应用场景}</p>
* <p>主要功能包括:</p>
* <ul>
* <li>{功能点1}</li>
* <li>{功能点2}</li>
* <li>{功能点3}</li>
* </ul>
*
* @author system
* @since 2025-01-21
*/
public class UserApplicationService {
Domain Service:
/**
* {服务名称}领域服务
*
* <p>{详细描述服务的领域职责和业务逻辑}</p>
* <p>主要功能包括:</p>
* <ul>
* <li>{功能点1}</li>
* <li>{功能点2}</li>
* </ul>
*
* @author system
* @since 2025-01-21
*/
public class UserDomainService {
Feign Service Interface:
/**
* {服务名称}Feign远程服务接口
*
* <p>通过Feign调用{目标服务}的远程接口</p>
* <p>主要功能:</p>
* <ul>
* <li>{接口功能1}</li>
* <li>{接口功能2}</li>
* </ul>
*
* @author system
* @since 2025-01-21
*/
public interface UserFeignService {
Method-level comment format (Standard JavaDoc):
/**
* [Method description]
*
* @param [paramName] [parameter description]
* @return [return value description]
* @throws [ExceptionType] [exception description]
*/
public UserDTO createUser(@RequestBody UserCreateRequest request) {
Method-level comment format (Java Coding Standards - strict):
/**
* <p>[Method description]</p>
*
* <p>[Detailed description]</p>
*
* @param [paramName] [paramType] [parameter description]
* @return [returnType] [return value description]
* @exception [full.package.ExceptionType] [exception description]
*/
public UserDTO createUser(@RequestBody UserCreateRequest request) {
Field-level comment format (Standard JavaDoc):
/**
* [Field description]
*/
private Long userId;
Field-level comment format (Java Coding Standards - strict):
/**
* <p>[Field description]</p>
*
* <p>[Detailed description if needed]</p>
*/
private Long userId;
After completing each class:
[x]Example progress update:
## Progress Update
✅ Completed: UserController
- [x] 类注释
- [x] createUser() - 方法注释
- [x] updateUser() - 方法注释
- [x] deleteUser() - 方法注释
- [x] userId - 属性注释
🔄 In Progress: UserService
- [x] 类注释
- [ ] findUserById() - 方法注释
- [ ] saveUser() - 方法注释
IMPORTANT: Comment Format Standards
This skill follows two standards:
The Java Coding Standards require:
<p> tags: <p>description</p>@param paramName paramType description@return returnType description@exception java.lang.Exception descriptionClass Comments Should Include:
<p> tags if following Java Coding Standards)Method Comments Should Include:
<p> tags if following Java Coding Standards)Field Comments Should Include:
<p> tags if following Java Coding Standards)For different component types, use appropriate templates from the templates/ directory:
templates/controller-comment-template.md - Controller class commentstemplates/service-comment-template.md - Service interface commentstemplates/serviceimpl-comment-template.md - Service implementation commentstemplates/application-service-comment-template.md - Application Service comments (DDD)templates/domain-service-comment-template.md - Domain Service comments (DDD)templates/feign-service-comment-template.md - Feign Service Interface commentstemplates/mapper-comment-template.md - Mapper commentstemplates/entity-comment-template.md - Entity class commentstemplates/dto-comment-template.md - DTO class commentsNote: All reference documents are located within this skill's directory structure.
When to use Java Coding Standards format:
<p> tags for descriptionsSee the examples/ directory for complete examples:
examples/controller-example.md - Controller commenting exampleexamples/service-example.md - Service commenting exampleexamples/entity-example.md - Entity commenting exampleexamples/full-workflow-example.md - Complete workflow exampleEnglish keywords: java, code comments, javadoc, documentation, class comments, method comments, field comments, code annotation, code documentation, java documentation, add comments, generate comments, document code, code comments java, java code comments, controller comments, service comments, mapper comments, entity comments, dto comments
Chinese keywords (中文关键词): Java 代码注释, 添加注释, 生成注释, 代码注释, 文档注释, JavaDoc, 类注释, 方法注释, 属性注释, 字段注释, 给代码添加注释, 代码文档, Java 文档, 注释生成, 一句话添加注释, Controller 注释, Service 注释, Mapper 注释, Entity 注释, DTO 注释, 代码注解
LICENSE.txt (opens in a new tab)agents/openai.yaml (opens in a new tab)examples/controller-example.md (opens in a new tab)examples/entity-example.md (opens in a new tab)examples/full-workflow-example.md (opens in a new tab)examples/service-example.md (opens in a new tab)reference/java-coding-standards.md (opens in a new tab)reference/java-component-types.md (opens in a new tab)reference/javadoc-standards.md (opens in a new tab)templates/application-service-comment-template.md (opens in a new tab)templates/controller-comment-template.md (opens in a new tab)templates/domain-service-comment-template.md (opens in a new tab)templates/entity-comment-template.md (opens in a new tab)templates/feign-service-comment-template.md (opens in a new tab)templates/mapper-comment-template.md (opens in a new tab)templates/service-comment-template.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
39 skills in this plugin
/caffeine-patternsCaffeine JVM 本地缓存技能。覆盖本地缓存 vs 远程缓存(Redis)选择决策树、expireAfterWrite vs expireAfterAccess vs refreshAfterWrite 三种过期策略对比与组合规则(refresh < expire)、CacheLoader加载与reload异步刷新模式、Spring Cache @Cacheable集成、maximumSize驱逐策略、recordStats缓存统计。 纠正 LLM:用 ConcurrentHashMap+手动过期、所有缓存走Redis、refreshAfterWrite > expireAfterWrite导致永远不刷新、CacheLoader返回null导致缓存穿透。/commons-patternsApache Commons 最佳实践模式。从官方文档提炼,覆盖 Commons Lang3(StringUtils千面判空/isEmpty vs isBlank/Validate抛NullPointerException迁移)、Commons IO(IOUtils.toString大文件陷阱/FileUtils.lineIterator逐行读模式/FilenameUtils.normalize路径规范化)、Commons Collections4(CollectionUtils.union/intersection/subtract集合运算)。 纠正 LLM 误用:混淆 StringUtils.isBlank vs isEmpty、IOUtils.toString 读大文件OOM、不知道 LineIterator 逐行读模式、用 lang 而非 lang3 包名。/Generated from the plugin's indexed repository (full-stack-skills/java-skills) — no native marketplace selected
npx claudepluginhub p/full-statck-skills-java-skills