java-docs
它能做什么
这个智能体可以帮你为 Java 代码添加解释性注释,也就是 Javadoc。这些注释能让你和其他人更容易理解代码。
适用场景
- ✓当你编写一个新的 Java 函数时。
- ✓当你想解释代码中某一部分的作用时。
- ✓当你把代码分享给其他程序员时。
技能链接
https://github.com/github/awesome-copilot/blob/main/skills/java-docs/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“给这个 Java 类及其方法添加 Javadoc 注释。”
每周 5 个新技能,1 分钟读完。
工作原理
它会分析你的 Java 代码,并自动插入 Javadoc 注释。它遵循最佳实践,确保注释清晰且有用。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Java Documentation (Javadoc) Best Practices
- Public and protected members should be documented with Javadoc comments.
- It is encouraged to document package-private and private members as well, especially if they are complex or not self-explanatory.
- The first sentence of the Javadoc comment is the summary description. It should be a concise overview of what the method does and end with a period.
- Use
@paramfor method parameters. The description starts with a lowercase letter and does not end with a period. - Use
@returnfor method return values. - Use
@throwsor@exceptionto document exceptions thrown by methods. - Use
@seefor references to other types or members. - Use
{@inheritDoc}to inherit documentation from base classes or interfaces.- Unless there is major behavior change, in which case you should document the differences.
- Use
@param <T>for type parameters in generic types or methods. - Use
{@code}for inline code snippets. - Use
<pre>{@code ... }</pre>for code blocks. - Use
@sinceto indicate when the feature was introduced (e.g., version number). - Use
@versionto specify the version of the member. - Use
@authorto specify the author of the code. - Use
@deprecatedto mark a member as deprecated and provide an alternative.
常见问题
什么是 Javadoc 注释?
这是写在 Java 代码中的特殊文字,用来说明代码的作用、用法、接收的信息以及返回的结果。它们还可以用来自动生成文档。
为什么要使用 Javadoc?
它能帮你更快理解代码,让与其他开发者的协作更轻松,也是制作专业软件文档的必要条件。
所有代码都需要写文档吗?
代码中的 public 和 protected 部分必须写文档。其他部分如果比较复杂或不够直观,则建议也加上文档。
详情
作者的原始描述
Ensure that Java types are documented with Javadoc comments and follow best practices for documentation.
repo: github/awesome-copilot
热度
- GitHub 星标
- 40k
- 排名
- #7254
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
acquire-codebase-knowledge
40k帮你的智能体理解并编写现有代码项目的文档。它有助于新成员快速上手,或者快速了解项目架构。
acreadiness-assess
40k让你的智能体评估一个项目对 AI 的准备程度,并生成报告。它有助于了解项目在使用 AI 工具方面的准备情况。
acreadiness-generate-instructions
40k帮你的智能体根据评估结果编写 AI 工具的指令文件。它有助于改善 AI 与代码的交互方式,并弥补已发现的不足。
acreadiness-policy
40k让你的智能体协助制定或应用 AI 项目评估的政策。它有助于规范项目的评估方式,并确保合规。