Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计通过

java-code-commentsJava 代码 comments

Agent Skill

用于辅助 Java 项目开发、面向对象设计、Spring 生态、Maven 或 Gradle 依赖和后端工程实践。它适合让 Agent 分析类结构、设计接口、整理服务分层、生成测试或检查常见代码坏味道。使用时需要结合项目已有架构、包结构和依赖版本,不应只按通用教程改代码;涉及数据库、事务、并发或框架配置时,应先确认运行环境和回归测试范围。

总安装

1,947

周安装

78

GitHub Stars

347

下载量

630
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:java-code-comments(Java 代码 comments)
来源仓库:https://github.com/teachingai/full-stack-skills
仓库路径:skills/java-code-comments
安装命令:
npx skills add https://github.com/teachingai/full-stack-skills --skill java-code-comments
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/teachingai/full-stack-skills --skill java-code-comments

简介

用于辅助 Java 项目开发、面向对象设计和 Spring 生态集成。

  • 适合分析类结构、设计接口、整理服务分层或生成测试代码。
  • 使用时需结合项目已有架构、包结构和依赖版本,避免仅按教程修改代码。
  • 涉及数据库、事务或并发配置时,应先确认运行环境和回归测试范围。
  • java-code-comments 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

When to use this skill

ALWAYS use this skill when the user mentions:

  • Adding comments to Java code
  • Documenting Java classes, methods, or fields
  • Generating JavaDoc comments
  • Improving code documentation
  • Code annotation or code commenting
  • 给 Java 代码添加注释
  • 生成 Java 文档注释
  • 代码注释
  • 添加注释

Trigger phrases include:

  • "给这段代码添加注释" (add comments to this code)
  • "生成 JavaDoc" (generate JavaDoc)
  • "添加类注释" (add class comments)
  • "添加方法注释" (add method comments)
  • "添加属性注释" (add field comments)
  • "代码注释" (code comments)
  • "文档注释" (documentation comments)
  • "一句话给 Java 代码添加注释" (add comments to Java code with one sentence)

Component types this skill handles:

  • Controller (REST controllers, Spring MVC controllers)
  • Service (business service interfaces)
  • ServiceImpl (service implementations)
  • Application Service (DDD application services, orchestrating domain logic)
  • Domain Service (DDD domain services, domain business logic)
  • Feign Service Interface (Feign remote service interfaces)
  • Mapper (MyBatis mappers, data access layer)
  • Model (data models, domain models)
  • Entity (JPA entities, database entities)
  • BO (Business Object, business logic objects)
  • DTO (Data Transfer Object)
  • VO (Value Object, View Object)
  • DAO (Data Access Object)
  • Repository (Spring Data repositories)
  • Configuration (Spring configuration classes)
  • Component (Spring components)
  • Utility (utility classes)
  • Exception (custom exception classes)

How to use this skill

CRITICAL: This skill should be triggered when the user wants to add comments to Java code, regardless of the component type or complexity.

Workflow Overview

This skill follows a systematic 4-step workflow:

  1. Scan and Understand - Scan the entire codebase and related documentation to gain comprehensive understanding
  2. Confirm Component Types - Ask user to confirm which component types need comments
  3. Create Todo List - Generate a detailed todo list with class names and method names
  4. Execute Commenting - Add comments in order: class comments → method comments → field comments, updating todo list after each completion

Step-by-Step Process

Step 1: Scan and Understand the Codebase

CRITICAL: Before adding any comments, you MUST:

  1. Scan all Java files in the project:

- Read all .java files in the current directory and subdirectories - Understand the project structure and architecture - Identify relationships between classes (dependencies, inheritance, composition)

  1. Read related documentation:

- README.md files - API documentation - Architecture documentation - Business requirements documents (if available)

  1. Understand the context:

- What does each class do? - What is the purpose of each method? - What do fields represent? - How do components interact with each other?

  1. Identify patterns:

- Naming conventions used in the project - Existing comment styles (if any) - Architecture patterns (MVC, DDD, etc.) - Framework usage (Spring, MyBatis, etc.)

Output: A summary of your understanding of the codebase, including:

  • Project structure overview
  • Key components identified
  • Architecture patterns detected
  • Existing documentation status

Step 2: Confirm Component Types

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:

  • 类注释(Class-level comments)
  • 方法注释(Method-level comments)
  • 属性注释(Field-level comments)

Wait for user confirmation before proceeding to the next step.

Step 3: Create Todo List

CRITICAL: After user confirms component types, create a detailed todo list.

For each component type selected by the user:

  1. Scan the codebase to find all matching classes:

- Use file search to find classes matching the pattern (e.g., *Controller.java, *Service.java) - List all classes that need comments

  1. For each class, identify:

- Class name - Methods that need comments - Fields that need comments

  1. 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:

  • Organize by component type
  • List all classes that match the selected types
  • Include all methods and fields that need comments
  • Use checkboxes for tracking progress

Step 4: Execute Commenting Work

CRITICAL: Add comments in the specified order and update todo list after each completion.

Order of execution:

  1. Class-level comments (类注释) - First
  2. Method-level comments (方法注释) - Second
  3. Field-level comments (属性注释) - Third

For each item in the todo list:

  1. Process one class at a time:

- Start with class-level comment - Then process all methods in that class - Finally process all fields in that class - Update the todo list after completing each class

  1. 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 {
  2. 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) {
  3. 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;
  4. After completing each class:

- Update the todo list: mark completed items with [x] - Show progress to the user - Continue to the next class

Example progress update:

## Progress Update

✅ Completed: UserController
  - [x] 类注释
  - [x] createUser() - 方法注释
  - [x] updateUser() - 方法注释
  - [x] deleteUser() - 方法注释
  - [x] userId - 属性注释

🔄 In Progress: UserService
  - [x] 类注释
  - [ ] findUserById() - 方法注释
  - [ ] saveUser() - 方法注释

Comment Quality Guidelines

IMPORTANT: Comment Format Standards

This skill follows two standards:

  1. Standard JavaDoc (default): See javadoc-standards.md (within this skill)
  2. Java Coding Standards (strict): See java-coding-standards.md (within this skill)

The Java Coding Standards require:

  • Description must be wrapped in <p> tags: <p>description</p>
  • Parameter types must be declared: @param paramName paramType description
  • Return types must be declared: @return returnType description
  • Exception types must be declared with full package name: @exception java.lang.Exception description

Class Comments Should Include:

  • Clear description of the class purpose (wrapped in <p> tags if following Java Coding Standards)
  • Main responsibilities
  • Usage examples (if complex)
  • Related classes or components
  • Author and version (if available)

Method Comments Should Include:

  • Clear description of what the method does (wrapped in <p> tags if following Java Coding Standards)
  • All parameters with descriptions and types
  • Return value description with type
  • Exceptions that may be thrown (with full package names)
  • Usage examples (for complex methods)
  • Side effects (if any)

Field Comments Should Include:

  • Clear description of what the field represents (wrapped in <p> tags if following Java Coding Standards)
  • Data type and constraints (if applicable)
  • Default values (if applicable)
  • Relationships to other fields (if applicable)

Best Practices

  1. Be concise but complete: Comments should be clear and informative without being verbose
  2. Use JavaDoc format: Follow standard JavaDoc conventions
  3. Maintain consistency: Use consistent style across all comments
  4. Update todo list: Always update the todo list after completing each item
  5. One class at a time: Process one complete class before moving to the next
  6. Respect existing code: Don't modify code logic, only add comments
  7. Context-aware: Comments should reflect the actual code behavior and business context

Comment Templates

For different component types, use appropriate templates from the templates/ directory:

  • templates/controller-comment-template.md - Controller class comments
  • templates/service-comment-template.md - Service interface comments
  • templates/serviceimpl-comment-template.md - Service implementation comments
  • templates/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 comments
  • templates/mapper-comment-template.md - Mapper comments
  • templates/entity-comment-template.md - Entity class comments
  • templates/dto-comment-template.md - DTO class comments

Comment Standards Reference

Note: All reference documents are located within this skill's directory structure.

When to use Java Coding Standards format:

  • When the project explicitly follows 《JAVA 编程规范》
  • When the project requires strict format with <p> tags for descriptions
  • When parameter and return types must be explicitly declared in comments

Examples

See the examples/ directory for complete examples:

  • examples/controller-example.md - Controller commenting example
  • examples/service-example.md - Service commenting example
  • examples/entity-example.md - Entity commenting example
  • examples/full-workflow-example.md - Complete workflow example

Keywords

English 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 注释, 代码注解

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

27.09%
按下载量换算171

Antigravity

26.51%
按下载量换算167

OpenCode

17.37%
按下载量换算109

Gemini CLI

14.32%
按下载量换算90

Cursor

7.61%
按下载量换算48

Codex

3.34%
按下载量换算21

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills