CUI JavaDoc Documentation Skill
Standards for writing high-quality JavaDoc documentation in CUI Java projects, ensuring consistency, completeness, and maintainability.
Workflow
Step 1: Load Applicable JavaDoc Standards
CRITICAL: Load current JavaDoc standards to use as enforcement criteria.
Always load foundational JavaDoc standards:
Read: standards/javadoc-core.md
This provides core JavaDoc principles, mandatory documentation requirements, basic tag usage, tag order, anti-patterns, and maintenance guidelines that apply to all JavaDoc documentation.
Conditional loading based on documentation context:
A. If documenting classes, interfaces, packages, enums, or annotations:
Read: standards/javadoc-class-documentation.md
Provides comprehensive standards for package-info.java files, class/interface documentation, abstract classes, enums, annotations, inheritance, serialization, and generic types.
B. If documenting methods or fields:
Read: standards/javadoc-method-documentation.md
Covers method documentation (public, private, overridden), field documentation, constructors, special method patterns (builders, factories, fluent APIs), generic methods, and varargs.
C. If adding code examples or complex formatting:
Read: standards/javadoc-code-examples.md
Provides standards for inline code ({@code}, {@literal}), code blocks (<pre><code>), links ({@link}), HTML formatting, tables, lists, and complete code examples.
Extract key requirements from all loaded standards
Store in working memory for use during task execution
Step 2: Analyze Existing Documentation (if applicable)
If working with existing JavaDoc:
Identify documentation gaps:
- Check which public/protected APIs lack documentation
- Identify incomplete parameter/return/exception documentation
- Find "stating the obvious" documentation that should be improved or removed
- Locate outdated documentation that doesn't match current code
Assess documentation quality:
- Review clarity and usefulness of descriptions
- Check if examples are complete and compilable
- Verify all {@link} references are valid
- Assess tag order and completeness
- Check for proper HTML tag closure
Review consistency:
- Verify consistent terminology across related classes
- Check consistent tag ordering
- Ensure uniform documentation style
- Validate similar APIs are documented similarly
Step 3: Write/Update JavaDoc According to Standards
When writing or updating JavaDoc:
Apply core principles:
- Start with clear purpose statement (what and why)
- Avoid stating the obvious
- Focus on behavior, not implementation
- Document contracts, not code details
- Keep documentation synchronized with code
Use proper tag structure (if applicable):
- Document all parameters with validation rules (@param)
- Document return values with guarantees (@return)
- Document all exceptions with conditions (@throws)
- Add cross-references with @see
- Include version information (@since for public APIs)
- Provide migration path for deprecated APIs (@deprecated)
- Follow standard tag order
Apply class-level documentation (if applicable):
- Create or update package-info.java files
- Document class purpose and behavior
- Include thread-safety statements
- Provide usage examples for complex classes
- Document inheritance relationships
- Document serialization if applicable
Apply method-level documentation (if applicable):
- Document all public/protected methods
- Include parameter constraints and validation rules
- Document return value guarantees and null handling
- Document exception conditions
- Show examples for complex methods
- Document overridden methods if they add behavior
- Use builders/factories/fluent API patterns appropriately
Add code examples and formatting (if applicable):
- Use
{@code} for inline code
- Use
{@literal} for special characters
- Use
{@link} for class/method references
- Create complete, compilable code blocks with
<pre><code>
- Include error handling in examples
- Use HTML formatting (lists, paragraphs, headings) appropriately
- Ensure all HTML tags are properly closed
Step 4: Verify Documentation Quality
Before completing the task:
Verify standards compliance:
Verify completeness:
Generate and review JavaDoc:
# Generate JavaDoc to check for warnings/errors
./mvnw javadoc:javadoc
# Check generated HTML for formatting
open target/site/apidocs/index.html
Verify formatting:
Step 5: Report Results
Provide summary of:
- Documentation created/updated: List classes, methods, packages documented
- Standards applied: Which standards were followed
- Examples added: Code examples and usage patterns included
- Links created: Cross-references and @see tags added
- Any deviations: Document and justify any standard deviations
Quality Verification
Documentation Completeness Checklist
Content Quality Checklist
Format Quality Checklist
Generation Verification
Common Patterns and Examples
Basic Method Documentation
/**
* Validates the JWT token signature and expiration time against the configured
* issuer and clock skew tolerance.
*
* @param token the JWT token to validate, must not be null or empty
* @return validation result containing status and any error messages, never null
* @throws IllegalArgumentException if token is null or empty
* @since 1.2.0
*/
public ValidationResult validate(String token) {
// Implementation
}
Class Documentation with Example
/**
* Validates JWT tokens according to RFC 7519 specifications, verifying
* signature, expiration, and issuer claims.
*
* <p>This validator supports both symmetric (HS256) and asymmetric (RS256)
* signature algorithms.
*
* <p><b>Thread Safety:</b> This class is immutable and thread-safe.
*
* <p>Example usage:
* <pre><code>
* JwtTokenValidator validator = JwtTokenValidator.builder()
* .issuer("https://auth.example.com")
* .clockSkewSeconds(30)
* .build();
*
* ValidationResult result = validator.validate(jwtToken);
* if (!result.isValid()) {
* log.warn("Token validation failed: {}", result.getErrors());
* }
* </code></pre>
*
* @see TokenValidator
* @see ValidationResult
* @since 1.2.0
*/
public class JwtTokenValidator implements TokenValidator {
// Implementation
}
Package Documentation (package-info.java)
/**
* Provides token validation and authentication services for OAuth2 and JWT tokens.
*
* <h2>Key Components</h2>
* <ul>
* <li>{@link de.cuioss.portal.authentication.TokenValidator} - Main validation interface</li>
* <li>{@link de.cuioss.portal.authentication.JwtTokenParser} - JWT token parsing</li>
* <li>{@link de.cuioss.portal.authentication.OAuth2TokenValidator} - OAuth2 validation</li>
* </ul>
*
* <h2>Usage Example</h2>
* <pre><code>
* TokenValidator validator = new JwtTokenValidator(issuerConfig);
* ValidationResult result = validator.validate(bearerToken);
* if (result.isValid()) {
* // Process authenticated request
* }
* </code></pre>
*
* @since 1.0.0
* @author CUI Team
*/
package de.cuioss.portal.authentication;
Builder Pattern Documentation
/**
* Sets the token issuer URL.
*
* @param issuer the issuer URL (must be valid HTTPS URL)
* @return this builder for method chaining
* @throws IllegalArgumentException if issuer is null or not a valid HTTPS URL
*/
public Builder issuer(String issuer) {
// Implementation
return this;
}
/**
* Builds and returns a configured JWT token validator.
*
* @return a new JwtTokenValidator instance with the configured settings, never null
* @throws IllegalStateException if required settings (issuer, publicKey) are not set
*/
public JwtTokenValidator build() {
// Implementation
}
Deprecated API Documentation
/**
* Validates a token using legacy validation rules.
*
* @param token the token to validate
* @return true if valid, false otherwise
* @deprecated since 2.0.0, use {@link #validate(String)} instead which
* returns detailed validation results and supports modern
* token formats. This method will be removed in 3.0.0.
*/
@Deprecated
public boolean validateLegacy(String token) {
// Implementation
}
Common Documentation Tasks
Task: Document a new public class
- Load javadoc-core.md and javadoc-class-documentation.md
- Add class-level JavaDoc with purpose, thread-safety, and example
- Document all public constructors
- Document all public methods with params/returns/exceptions
- Add @since tag with current version
- Generate JavaDoc and verify
Task: Add code examples to existing documentation
- Load javadoc-core.md and javadoc-code-examples.md
- Identify methods that need examples (complex APIs, common use cases)
- Write complete, compilable examples with error handling
- Use proper
<pre><code> formatting
- Ensure examples follow project coding standards
- Generate JavaDoc and verify examples render correctly
Task: Update documentation for API changes
- Load javadoc-core.md and javadoc-method-documentation.md
- Review changed methods/classes
- Update parameter/return/exception documentation
- Add @deprecated tags if removing APIs
- Update @since tags if adding new parameters
- Verify all {@link} references still valid
- Generate JavaDoc and check for warnings
Error Handling
If encountering issues:
- JavaDoc generation errors: Review error messages, fix broken {@link} references and unclosed HTML tags
- Unclear documentation purpose: Review core principles, focus on behavior not implementation
- Missing standards information: Ask user for clarification on specific APIs or patterns
- Complex APIs to document: Break down into steps, provide comprehensive examples
- Deprecated API migration: Document clear migration path with code examples
References
- Core JavaDoc Standards: standards/javadoc-core.md
- Class Documentation: standards/javadoc-class-documentation.md
- Method Documentation: standards/javadoc-method-documentation.md
- Code Examples and Formatting: standards/javadoc-code-examples.md
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: cui-javadoc3description: CUI JavaDoc documentation standards for Java classes, methods, and code examples Use when this capability is needed.4---56# CUI JavaDoc Documentation Skill78Standards for writing high-quality JavaDoc documentation in CUI Java projects, ensuring consistency, completeness, and maintainability.910## Workflow1112### Step 1: Load Applicable JavaDoc Standards1314**CRITICAL**: Load current JavaDoc standards to use as enforcement criteria.15161. **Always load foundational JavaDoc standards**:17 ```18 Read: standards/javadoc-core.md19 ```20 This provides core JavaDoc principles, mandatory documentation requirements, basic tag usage, tag order, anti-patterns, and maintenance guidelines that apply to all JavaDoc documentation.21222. **Conditional loading based on documentation context**:2324 **A. If documenting classes, interfaces, packages, enums, or annotations**:25 ```26 Read: standards/javadoc-class-documentation.md27 ```28 Provides comprehensive standards for package-info.java files, class/interface documentation, abstract classes, enums, annotations, inheritance, serialization, and generic types.2930 **B. If documenting methods or fields**:31 ```32 Read: standards/javadoc-method-documentation.md33 ```34 Covers method documentation (public, private, overridden), field documentation, constructors, special method patterns (builders, factories, fluent APIs), generic methods, and varargs.3536 **C. If adding code examples or complex formatting**:37 ```38 Read: standards/javadoc-code-examples.md39 ```40 Provides standards for inline code (`{@code}`, `{@literal}`), code blocks (`<pre><code>`), links (`{@link}`), HTML formatting, tables, lists, and complete code examples.41423. **Extract key requirements from all loaded standards**43444. **Store in working memory** for use during task execution4546### Step 2: Analyze Existing Documentation (if applicable)4748If working with existing JavaDoc:49501. **Identify documentation gaps**:51 - Check which public/protected APIs lack documentation52 - Identify incomplete parameter/return/exception documentation53 - Find "stating the obvious" documentation that should be improved or removed54 - Locate outdated documentation that doesn't match current code55562. **Assess documentation quality**:57 - Review clarity and usefulness of descriptions58 - Check if examples are complete and compilable59 - Verify all {@link} references are valid60 - Assess tag order and completeness61 - Check for proper HTML tag closure62633. **Review consistency**:64 - Verify consistent terminology across related classes65 - Check consistent tag ordering66 - Ensure uniform documentation style67 - Validate similar APIs are documented similarly6869### Step 3: Write/Update JavaDoc According to Standards7071When writing or updating JavaDoc:72731. **Apply core principles**:74 - Start with clear purpose statement (what and why)75 - Avoid stating the obvious76 - Focus on behavior, not implementation77 - Document contracts, not code details78 - Keep documentation synchronized with code79802. **Use proper tag structure** (if applicable):81 - Document all parameters with validation rules (@param)82 - Document return values with guarantees (@return)83 - Document all exceptions with conditions (@throws)84 - Add cross-references with @see85 - Include version information (@since for public APIs)86 - Provide migration path for deprecated APIs (@deprecated)87 - Follow standard tag order88893. **Apply class-level documentation** (if applicable):90 - Create or update package-info.java files91 - Document class purpose and behavior92 - Include thread-safety statements93 - Provide usage examples for complex classes94 - Document inheritance relationships95 - Document serialization if applicable96974. **Apply method-level documentation** (if applicable):98 - Document all public/protected methods99 - Include parameter constraints and validation rules100 - Document return value guarantees and null handling101 - Document exception conditions102 - Show examples for complex methods103 - Document overridden methods if they add behavior104 - Use builders/factories/fluent API patterns appropriately1051065. **Add code examples and formatting** (if applicable):107 - Use `{@code}` for inline code108 - Use `{@literal}` for special characters109 - Use `{@link}` for class/method references110 - Create complete, compilable code blocks with `<pre><code>`111 - Include error handling in examples112 - Use HTML formatting (lists, paragraphs, headings) appropriately113 - Ensure all HTML tags are properly closed114115### Step 4: Verify Documentation Quality116117Before completing the task:1181191. **Verify standards compliance**:120 - [ ] All public/protected APIs documented121 - [ ] No "stating the obvious" documentation122 - [ ] Proper tag order followed123 - [ ] All parameters/returns/exceptions documented124 - [ ] @since tags for public APIs125 - [ ] Migration paths for deprecated APIs1261272. **Verify completeness**:128 - [ ] Class purpose clearly stated129 - [ ] Thread-safety documented where relevant130 - [ ] Null handling documented131 - [ ] Usage examples for complex APIs132 - [ ] All {@link} references valid1331343. **Generate and review JavaDoc**:135 ```bash136 # Generate JavaDoc to check for warnings/errors137 ./mvnw javadoc:javadoc138139 # Check generated HTML for formatting140 open target/site/apidocs/index.html141 ```1421434. **Verify formatting**:144 - [ ] All HTML tags properly closed145 - [ ] Code blocks render correctly146 - [ ] Links work correctly147 - [ ] Examples are readable and correctly formatted148149### Step 5: Report Results150151Provide summary of:1521531. **Documentation created/updated**: List classes, methods, packages documented1542. **Standards applied**: Which standards were followed1553. **Examples added**: Code examples and usage patterns included1564. **Links created**: Cross-references and @see tags added1575. **Any deviations**: Document and justify any standard deviations158159## Quality Verification160161### Documentation Completeness Checklist162163- [ ] All public classes/interfaces documented164- [ ] All public/protected methods documented165- [ ] Package-info.java files present166- [ ] All parameters documented with constraints167- [ ] All return values documented168- [ ] All exceptions documented with conditions169- [ ] @since tags present for public APIs170171### Content Quality Checklist172173- [ ] Clear purpose statements (no "stating the obvious")174- [ ] Focus on behavior/contracts, not implementation175- [ ] Examples are complete and compilable176- [ ] Examples show error handling177- [ ] Examples follow project coding standards178- [ ] No outdated documentation179- [ ] Consistent terminology used180181### Format Quality Checklist182183- [ ] Proper tag order (param, return, throws, see, since, deprecated)184- [ ] All {@link} references valid185- [ ] HTML tags properly closed186- [ ] Code formatted with {@code} or <pre><code>187- [ ] Lists use proper HTML tags188- [ ] Paragraphs separated with <p>189190### Generation Verification191192- [ ] JavaDoc generation succeeds: `./mvnw javadoc:javadoc`193- [ ] No warnings or errors in output194- [ ] Generated HTML displays correctly195- [ ] Links navigate correctly196- [ ] Code examples render properly197198## Common Patterns and Examples199200### Basic Method Documentation201202```java203/**204 * Validates the JWT token signature and expiration time against the configured205 * issuer and clock skew tolerance.206 *207 * @param token the JWT token to validate, must not be null or empty208 * @return validation result containing status and any error messages, never null209 * @throws IllegalArgumentException if token is null or empty210 * @since 1.2.0211 */212public ValidationResult validate(String token) {213 // Implementation214}215```216217### Class Documentation with Example218219```java220/**221 * Validates JWT tokens according to RFC 7519 specifications, verifying222 * signature, expiration, and issuer claims.223 *224 * <p>This validator supports both symmetric (HS256) and asymmetric (RS256)225 * signature algorithms.226 *227 * <p><b>Thread Safety:</b> This class is immutable and thread-safe.228 *229 * <p>Example usage:230 * <pre><code>231 * JwtTokenValidator validator = JwtTokenValidator.builder()232 * .issuer("https://auth.example.com")233 * .clockSkewSeconds(30)234 * .build();235 *236 * ValidationResult result = validator.validate(jwtToken);237 * if (!result.isValid()) {238 * log.warn("Token validation failed: {}", result.getErrors());239 * }240 * </code></pre>241 *242 * @see TokenValidator243 * @see ValidationResult244 * @since 1.2.0245 */246public class JwtTokenValidator implements TokenValidator {247 // Implementation248}249```250251### Package Documentation (package-info.java)252253```java254/**255 * Provides token validation and authentication services for OAuth2 and JWT tokens.256 *257 * <h2>Key Components</h2>258 * <ul>259 * <li>{@link de.cuioss.portal.authentication.TokenValidator} - Main validation interface</li>260 * <li>{@link de.cuioss.portal.authentication.JwtTokenParser} - JWT token parsing</li>261 * <li>{@link de.cuioss.portal.authentication.OAuth2TokenValidator} - OAuth2 validation</li>262 * </ul>263 *264 * <h2>Usage Example</h2>265 * <pre><code>266 * TokenValidator validator = new JwtTokenValidator(issuerConfig);267 * ValidationResult result = validator.validate(bearerToken);268 * if (result.isValid()) {269 * // Process authenticated request270 * }271 * </code></pre>272 *273 * @since 1.0.0274 * @author CUI Team275 */276package de.cuioss.portal.authentication;277```278279### Builder Pattern Documentation280281```java282/**283 * Sets the token issuer URL.284 *285 * @param issuer the issuer URL (must be valid HTTPS URL)286 * @return this builder for method chaining287 * @throws IllegalArgumentException if issuer is null or not a valid HTTPS URL288 */289public Builder issuer(String issuer) {290 // Implementation291 return this;292}293294/**295 * Builds and returns a configured JWT token validator.296 *297 * @return a new JwtTokenValidator instance with the configured settings, never null298 * @throws IllegalStateException if required settings (issuer, publicKey) are not set299 */300public JwtTokenValidator build() {301 // Implementation302}303```304305### Deprecated API Documentation306307```java308/**309 * Validates a token using legacy validation rules.310 *311 * @param token the token to validate312 * @return true if valid, false otherwise313 * @deprecated since 2.0.0, use {@link #validate(String)} instead which314 * returns detailed validation results and supports modern315 * token formats. This method will be removed in 3.0.0.316 */317@Deprecated318public boolean validateLegacy(String token) {319 // Implementation320}321```322323## Common Documentation Tasks324325### Task: Document a new public class3263271. Load javadoc-core.md and javadoc-class-documentation.md3282. Add class-level JavaDoc with purpose, thread-safety, and example3293. Document all public constructors3304. Document all public methods with params/returns/exceptions3315. Add @since tag with current version3326. Generate JavaDoc and verify333334### Task: Add code examples to existing documentation3353361. Load javadoc-core.md and javadoc-code-examples.md3372. Identify methods that need examples (complex APIs, common use cases)3383. Write complete, compilable examples with error handling3394. Use proper `<pre><code>` formatting3405. Ensure examples follow project coding standards3416. Generate JavaDoc and verify examples render correctly342343### Task: Update documentation for API changes3443451. Load javadoc-core.md and javadoc-method-documentation.md3462. Review changed methods/classes3473. Update parameter/return/exception documentation3484. Add @deprecated tags if removing APIs3495. Update @since tags if adding new parameters3506. Verify all {@link} references still valid3517. Generate JavaDoc and check for warnings352353## Error Handling354355If encountering issues:3563571. **JavaDoc generation errors**: Review error messages, fix broken {@link} references and unclosed HTML tags3582. **Unclear documentation purpose**: Review core principles, focus on behavior not implementation3593. **Missing standards information**: Ask user for clarification on specific APIs or patterns3604. **Complex APIs to document**: Break down into steps, provide comprehensive examples3615. **Deprecated API migration**: Document clear migration path with code examples362363## References364365* Core JavaDoc Standards: standards/javadoc-core.md366* Class Documentation: standards/javadoc-class-documentation.md367* Method Documentation: standards/javadoc-method-documentation.md368* Code Examples and Formatting: standards/javadoc-code-examples.md369370---371> Converted and distributed by [TomeVault](https://tomevault.io/claim/cuioss) — claim your Tome and manage your conversions.372<!-- tomevault:4.0:skill_md:2026-04-14 -->