Skill Press

No. 584 · java-docs

Java Documentation (Javadoc) Best Practices

A field guide from GitHub Awesome Copilot contributors

GitHub Awesome Copilot contributors

When to use it

Ensure that Java types are documented with Javadoc comments and follow best practices for documentation.

Rank
No. 584 of 971
Installs
Not listed yet
Built for
GitHub Copilot
Runs in
GitHub Copilot
Length
297 words · 1 min
Files
2
License
MIT

Get this skill

Download the skill folder (.zip, 2 KB) ↓ · SKILL.md only ↓

Agent prompt

Paste into a coding agent with terminal access. Check the upstream requirements for the skill you’re installing.

Prompt
Install the "java-docs" Agent Skill by GitHub Awesome Copilot contributors, from https://github.com/github/awesome-copilot.

1. Fetch the whole folder skills/java-docs — SKILL.md plus every script, reference, and asset beside it, not just SKILL.md. For example:
   skill_checkout=$(mktemp -d)
   git init "$skill_checkout"
   git -C "$skill_checkout" fetch --depth 1 https://github.com/github/awesome-copilot.git 1683f50e94c9fd489191f73d7c8f7e2bd871bd0c
   git -C "$skill_checkout" checkout --detach FETCH_HEAD
2. Copy it into your skills directory as a folder named "java-docs":
   - Claude Code: ~/.claude/skills/java-docs/ (all projects) or .claude/skills/java-docs/ (this project only)
   - Another agent: the directory you load Agent Skills from (folders containing a SKILL.md)
3. Check that java-docs/SKILL.md exists and its frontmatter says name: java-docs.
4. Read SKILL.md, then tell me in two or three sentences what the skill does and when it will trigger, and list any dependencies it mentions (Python packages, npm packages, CLIs) that aren't installed yet. Don't install them without asking.

skills CLI

One command; the skills.sh installer detects your agents (Claude Code, Cursor, Codex, and more).

Terminal
npx skills add https://github.com/github/awesome-copilot/tree/1683f50e94c9fd489191f73d7c8f7e2bd871bd0c/skills/java-docs --skill java-docs

Contents

  1. Principles
  2. Conventions
  3. Verify

The skill, in full

Principles

  • Document only what the code actually does: read the implementation, callers and tests first. Never invent behaviour, thresholds, thread-safety, nullability or exceptions you have not verified; if unsure, leave it out or ask.
  • Keep the existing documentation style of the project (language, tag order, comment form /** */ vs ///). Do not rewrite existing comments, or mass-document a codebase, unless the user asks; limit changes to the requested scope.
  • Check the JDK level (maven.compiler.release, toolchain, java -version) before using newer features, and stay within it.

Conventions

  • @since only with the real version in which the API was introduced; @deprecated with a reason and replacement, together with @Deprecated.
  • @author and @version only if the project already uses them.
  • Code blocks, by JDK level:
    • Any JDK: <pre>{@code ... }</pre> (escape @ at line start, balance braces).
    • JDK 18+: {@snippet : ... } for inline code, or {@snippet file="Example.java" region="demo"} with files in snippet-files/ (preferred for examples; javadoc does not compile or validate the snippet source, so compile and test the files in a separate build/test source set if you need that guarantee). Use // @highlight substring="x" and // @replace markup as needed.
    • JDK 23+ only (JEP 467): Markdown doc comments with ///, using [Type#member] for links and fenced code blocks. Use them only if the project already does or the user asks, and the build runs a JDK 23+ javadoc.

Verify

  • Run mvn -q javadoc:javadoc (or ./gradlew javadoc) and for single files javadoc -Xdoclint:all -d target/javadoc-check <files>; fix every warning/error you introduced (missing @param, bad HTML, unresolved {@link}, unknown tags).
  • Report what was documented and the commands run; state any claims you could not verify from the code.

More in Writing & Documents

All Writing & Documents skills →

More from GitHub Awesome Copilot contributors

From github/awesome-copilot at 1683f50, MIT. Install counts from skills.sh.