java-code-quality

Configure Spotless formatting, Checkstyle analysis, Git hooks, and CI quality gates for Spring Boot projects.

Updated Apr 18, 2026
One-click install
npx skills add https://github.com/heiherilala-vawd/ompany-Management --skill java-code-quality-heiherilala-vawd
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: java-code-quality
Source: https://github.com/heiherilala-vawd/ompany-Management/tree/main/.agents/skills/java-code-quality
Command: npx skills add https://github.com/heiherilala-vawd/ompany-Management --skill java-code-quality-heiherilala-vawd

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Java teams often struggle with inconsistent code formatting and style violations slipping into the codebase. This Skill sets up a complete code quality toolchain so formatting and static analysis are enforced automatically at commit time and in CI. ## Core Features & Use Cases - Spotless Auto-Formatting: Applies google-java-format, removes unused imports, trims trailing whitespace, and excludes generated code directories. - Checkstyle Static Analysis: Configures a Google Java Style-based ruleset with naming, indentation, Javadoc, and import-order checks, producing XML and HTML reports. - Git Pre-Commit Hook: Runs Spotless and Checkstyle locally before every commit, blocking non-conforming code. - GitHub Actions CI: Adds a workflow that runs spotlessCheck, checkstyleMain, and a full build on every push and pull request. - Use Case: A Spring Boot team wants every pull request to pass formatting and style checks automatically, so reviewers focus on logic instead of style nits. ## Quick Start Set up Spotless, Checkstyle, a pre-commit hook, and a GitHub Actions quality workflow for my Spring Boot Gradle project.

Frequently Asked Questions about java-code-quality

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

FAQPage Schema
How do I set up Spotless and Checkstyle in a Gradle Spring Boot project?

Add the com.diffplug.spotless plugin and the built-in checkstyle plugin to your Gradle Kotlin DSL build file. Configure Spotless with googleJavaFormat and point Checkstyle at a rules XML file, then run ./gradlew spotlessApply and checkstyleMain.

How to enforce code formatting before every Git commit in Java?

Create a pre-commit hook in .git/hooks that runs ./gradlew spotlessApply followed by checkstyleMain, exiting with an error if either fails. Make it executable with chmod +x so it runs automatically on every commit.

What is the difference between Spotless and Checkstyle?

Spotless automatically reformats code to match a style like google-java-format, fixing violations for you. Checkstyle only analyzes code against rules such as naming and indentation and reports violations without modifying files.

Does Spotless work with generated Java code in Gradle?

Spotless can exclude generated sources using targetExclude patterns such as **/build/**, **/generated/**, and **/gen/**. This prevents the formatter from modifying auto-generated client or build output code.

Why does my Checkstyle build fail on Google Java Style rules?

Failures usually come from line length over 100 characters, wrong indentation, missing Javadoc on public methods, or incorrect import order. Run ./gradlew spotlessApply first to fix formatting, then address remaining rule violations manually.