What problem does it solve?
Poorly documented or inconsistent JavaDoc makes APIs difficult to understand and use, leading to developer frustration and integration errors. This Skill provides a comprehensive set of standards for writing high-quality JavaDoc, ensuring clarity, completeness, and consistency across all CUI Java projects, making your APIs easier to consume.
Core Features & Use Cases
- Standardized Documentation: Enforces core principles like clarity, completeness, and consistency, avoiding "stating the obvious" and focusing on behavior.
- Class & Method Documentation: Guides the documentation of packages, classes, interfaces, enums, annotations, and all public/protected methods with detailed parameter, return, and exception descriptions.
- Rich Code Examples: Provides patterns for inline code, multi-line code blocks, cross-references, and HTML formatting (tables, lists) to enhance readability.
- Null-Safety Integration: Guides documentation for
@NullMarked and @Nullable annotations, clarifying null-safety contracts.
- Use Case: When developing a new Java library or API, use this skill to ensure every public class and method is meticulously documented with clear purpose statements, usage examples, and precise null-safety contracts, making your API a joy to use and reducing support overhead.
Quick Start
Document a Class
- Add class-level JavaDoc with purpose and behavior
- Document thread-safety if applicable
- Add usage example for complex classes
- Document all public methods
- Include parameter constraints and return guarantees
- Document all exceptions
- Add @see links to related classes
- Add @since tag for version
- Verify:
mvn javadoc:javadoc
Add Code Examples
- Write complete, compilable examples
- Use
<pre><code class="language-java"> blocks
- Include typical usage scenarios
- Show error handling if applicable
- Verify examples in unit tests
- Keep examples concise (< 10 lines preferred)