跳到正文
Skillpedia
技术文档40k · #7254

java-docs

它能做什么

这个智能体可以帮你为 Java 代码添加解释性注释,也就是 Javadoc。这些注释能让你和其他人更容易理解代码。

适用场景

  • ✓当你编写一个新的 Java 函数时。
  • ✓当你想解释代码中某一部分的作用时。
  • ✓当你把代码分享给其他程序员时。

技能链接

https://github.com/github/awesome-copilot/blob/main/skills/java-docs/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/github/awesome-copilot/blob/main/skills/java-docs/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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 @param for method parameters. The description starts with a lowercase letter and does not end with a period.
  • Use @return for method return values.
  • Use @throws or @exception to document exceptions thrown by methods.
  • Use @see for 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 @since to indicate when the feature was introduced (e.g., version number).
  • Use @version to specify the version of the member.
  • Use @author to specify the author of the code.
  • Use @deprecated to 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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能