← ClaudeAtlas

java-clean-commentslisted

Enforces comment and Javadoc hygiene in Java — no commented-out code, no author or ticket metadata, no comments restating the code, and Javadoc that documents contracts rather than repeating signatures. Use when writing or reviewing Java comments and Javadoc, and when the code shows commented-out blocks, TODO or FIXME banners, @author or date tags, boilerplate Javadoc, or documentation that no longer matches the method.
CasLubbers/code-design-skills · ★ 1 · Data & Documents · score 62
Install: claude install-skill CasLubbers/code-design-skills
# Clean comments in Java A comment is a failure to express the idea in code. Sometimes it is the right failure — but try the code first. ## Prefer code that needs no comment ```java // Bad // Check if the employee is eligible for full benefits if (employee.flags() == HOURLY_FLAG && employee.age() > 65) { ... } // Good if (employee.isEligibleForFullBenefits()) { ... } ``` ```java // Bad int t = 86_400; // seconds in a day // Good static final int SECONDS_PER_DAY = 86_400; ``` ## Delete commented-out code ```java // Bad public void process(Order order) { validate(order); // legacy path, keep for now // if (order.isLegacy()) { // legacyProcessor.handle(order); // return; // } save(order); } ``` Nobody dares delete it later because nobody knows if it matters. Git has it. Delete it. ## No metadata ```java // Bad /** * @author j.smith * @since 2019-04-03 * Modified by: a.jones (JIRA-4821) */ ``` Version control owns authorship, dates, and ticket history, and keeps them accurate — comments drift immediately. `@since` on a public API version (`@since 2.4`) is legitimate; a calendar date is not. ## No redundant Javadoc ```java // Bad — every line restates the signature /** * Gets the name. * @param id the id * @return the name */ public String getName(String id) ``` Javadoc that only echoes the signature adds lines and hides the ones that matter. Write it when there is a contract to state: ```java /** * Transfers funds betwe