be-clean-code

Audit Java source files for DRY, KISS, YAGNI, naming, and structure violations.

1|Updated Feb 19, 2026
One-click install
npx skills add https://github.com/ohmyhotelco/hare-cc-plugins --skill be-clean-code-ohmyhotelco
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: be-clean-code
Source: https://github.com/ohmyhotelco/hare-cc-plugins/tree/main/backend-webflux-plugin/skills/be-clean-code
Command: npx skills add https://github.com/ohmyhotelco/hare-cc-plugins --skill be-clean-code-ohmyhotelco

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Manually reviewing Java code for code smells like duplicated logic, god classes, deep nesting, and unused methods is slow and inconsistent. This Skill performs a static heuristic audit of Java source files and produces a fixed-shape report of findings with exact file and line references, ready to paste into a ticket or PR comment. ## Core Features & Use Cases - Five rule categories: Scans for DRY violations (duplicate blocks, copy-pasted validation), KISS issues (deep nesting, long methods, unnecessary abstractions), YAGNI problems (unused methods/fields/imports, over-engineering), naming issues, and structure problems (god classes over 300 lines, long parameter lists). - Framework-aware exclusions: Knows not to flag Spring Data R2DBC repositories, MyBatis mapper interfaces, record-based constructor injection, and generated code, reducing false positives. - Uncertainty labeling: Findings that static text analysis cannot prove (e.g., reflectively-invoked methods) are marked as needing human judgment rather than asserted as violations. - Use Case: Before merging a pull request, run the audit on the changed package to catch a 4-level nested conditional and an unused field, then paste the formatted report directly into the PR comment. ## Quick Start Ask the assistant to run a clean code audit on a specific Java package such as src/main/java/com/example/booking/ and review the categorized findings report.

Frequently Asked Questions about be-clean-code

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check Java code for DRY, KISS, and YAGNI violations?▼

Run the audit against a file or directory path and it scans for duplicate code blocks, deeply nested conditionals, long methods, unused methods and fields, and generic naming. Findings are reported per category with exact file and line references.

How to detect god classes and long methods in Java?▼

The audit flags classes exceeding 300 lines and methods exceeding 30 lines as structure and KISS violations respectively. Exclusions apply for generated code, enum-heavy constant classes, and single large switch mappings that are linear rather than complex.

Does static code analysis work with Spring Data and MyBatis?▼

Yes, the audit explicitly excludes framework patterns from its rules. R2DBC repository interfaces, MyBatis mapper interfaces, and record-based constructor injection on Router, Handler, and CommandExecutor classes are not flagged despite matching raw patterns like single-implementation interfaces.

Why are some unused method findings marked as uncertain?▼

Grep can only prove no call site exists within the scanned scope, not across the whole codebase. Methods invoked reflectively, via Spring wiring, or through framework contracts are labeled as needing human judgment rather than confirmed violations.

What are the limitations of static text-based code review?▼

This approach reads source text only and does not run the build, tests, or bytecode analysis. Indentation-based counts can misjudge non-standard formatting, and it cannot confirm dead code the way a coverage report or IDE find-usages can.