Java Checkstyle / Spotless

SkillFiles & storage

A skill that runs `mvn spotless:apply` to fix Java checkstyle and formatting failures, then verifies the result. It is meant to be invoked after you author or modify any `.java` files, or when CI reports a "Java checkstyle failed" or "Fix Java checkstyle" issue on a pull request. It can also run in check-only mode to confirm the tree is clean without changing files.

Then ask your AI: use the Java Checkstyle / Spotless skill

Details

Instructions available. Your AI can read the instructions. Execution depends on the setup they require.

Have a Java project that uses the Spotless Maven plugin for formatting.

What your AI can do with it

  • Run `mvn spotless:apply` at the repo root to reformat all Java modules
  • Scope the fix to one Maven module with `-pl <module>`
  • Run `mvn spotless:check` to verify formatting without writing files
  • Review what changed with `git status --short` and `git diff --stat`
  • Commit a purely mechanical reformat as a `Fix Java checkstyle` commit
  • Surface plugin errors instead of hand-editing formatting around them

Getting started

  1. Have a Java project that uses the Spotless Maven plugin for formatting.
  2. Make sure Maven is available and the project builds from the repository root.
  3. Invoke the skill after editing `.java` files, or when CI reports a checkstyle failure.
  4. Optionally pass `-pl <module>` to scope the run, or `--check` to verify only.
  5. Review the changed files with git before deciding whether to commit.

What this skill tells your AI

The instructions your AI receives, as published by open-metadata/openmetadata in skills/java-checkstyle/SKILL.md and read by Ahel’s review.

OpenMetadata enforces Java formatting via the Spotless Maven plugin. Every CI build runs mvn spotless:check and fails the PR if any file is not formatted. This skill keeps the fix on a single, consistent command so reviewers never have to ask for it manually again.

When to activate

  • The user asks to "fix checkstyle", "fix Java formatting", "apply spotless", "run spotless", "format Java", or similar.
  • CI posts a Java checkstyle failed / Fix Java checkstyle comment on a PR (the project's bot phrases the instruction as "Please run mvn spotless:apply in the root of your repository and commit the changes to this PR").
  • After you have finished authoring or editing any .java files — before opening a PR or pushing a commit that touches Java.

Arguments

  • No arguments: run mvn spotless:apply at the repo root across all modules.
  • -pl <module>: scope to a single Maven module (e.g. -pl openmetadata-service). Useful when only one module changed and you want a faster run.
  • --check: run mvn spotless:check instead of apply. Use to confirm the tree is clean without touching files (e.g. to verify before push).

Process

Step 1: Run Spotless

From the repo root:

mvn spotless:apply                 # default — formats everything
# or
mvn -pl <module> spotless:apply    # scoped to one module
# or
mvn spotless:check                 # verify only, don't write

Spotless is fast (seconds, no compilation). If it fails with a plugin error (not a formatting diff), surface the error and stop — do not try to hand-edit formatting around the failure.

Step 2: Check what changed

git status --short
git diff --stat

Expect reformatting in .java files only. If Spotless touches pom.xml or other non-Java files, that's also fine — Spotless is configured for those too in this repo.

Step 3: Commit

Do not fold the reformat into an unrelated commit. If the user asked you to commit, follow their preference (fold into the in-progress commit, or make a separate one). Otherwise, when you are confident the change is a purely mechanical formatting reformat, you may commit it on its own as a Fix Java checkstyle commit — this matches the repo's existing history for bot-triggered formatting-only commits. If you are unsure whether the diff is purely mechanical, do NOT auto-commit: surface the changed-file list and let the user decide.

Notes

  • Spotless config lives in the root pom.xml (spotless-maven-plugin section) — googleJavaFormat + removeUnusedImports. Do not redefine formatting rules inline in source files.
  • If Spotless keeps rewriting a change you just made, re-read the config — Spotless is the source of truth, not the IDE.
  • CI enforcement lives in .github/workflows/java-checkstyle.yml: the java-checkstyle job runs mvn spotless:apply and fails (git diff-files) if the tree was not already formatted, posting the "Please run mvn spotless:apply" comment.

Out of scope

  • UI / TypeScript formatting — use the ui-checkstyle skill (ESLint + Prettier + organize-imports); this skill is Java-only.
  • Python formatting — use make py_format (ruff lint-fix + format; see ingestion/Makefile). (Note: this is ruff, not black/isort/pycln.)

Signals

GitHub stars
15k
Forks
2k
Last commit
Oct 2026

Questions

What does this skill do?
It runs `mvn spotless:apply` to reformat Java files that fail the project's checkstyle rules, reviews what changed with git, and can commit the reformat as a `Fix Java checkstyle` commit.
When should I invoke it?
After authoring or modifying any `.java` files, or when CI reports a "Java checkstyle failed" or "Fix Java checkstyle" issue on a pull request.
Can I scope the fix to one module?
Yes. Pass `-pl <module>` to run Spotless on a single Maven module, which is useful when only one module changed.
Advanced
Item type
skill
Key
java-checkstyle
Source
github.com/open-metadata/openmetadata