Agent Skillsopen-metadata/OpenMetadata › java-checkstyle

java-checkstyle

GitHub

用于自动修复Java代码的Checkstyle格式问题。通过执行mvn spotless:apply命令格式化文件,支持指定模块或仅检查模式。适用于用户请求格式化、CI报告失败或修改Java文件后提交前,确保代码符合OpenMetadata项目的规范。

.claude/skills/java-checkstyle/SKILL.md open-metadata/OpenMetadata

Trigger Scenarios

用户请求修复checkstyle或格式化Java CI报告Java checkstyle失败 完成Java文件编写或修改后

Install

npx skills add open-metadata/OpenMetadata --skill java-checkstyle -g -y
More Options

Non-standard path

npx skills add https://github.com/open-metadata/OpenMetadata/tree/main/.claude/skills/java-checkstyle -g -y

Use without installing

npx skills use open-metadata/OpenMetadata@java-checkstyle

指定 Agent (Claude Code)

npx skills add open-metadata/OpenMetadata --skill java-checkstyle -a claude-code -g -y

安装 repo 全部 skill

npx skills add open-metadata/OpenMetadata --all -g -y

预览 repo 内 skill

npx skills add open-metadata/OpenMetadata --list

SKILL.md

Frontmatter
{
    "name": "java-checkstyle",
    "description": "Run `mvn spotless:apply` to fix Java checkstyle \/ formatting failures and verify the result. Invoke after authoring or modifying any `.java` files, or when CI reports a \"Java checkstyle failed\" or \"Fix Java checkstyle\" issue on a PR.",
    "allowed-tools": [
        "Bash",
        "Read",
        "Grep",
        "Glob"
    ],
    "argument-hint": "[-pl <module>] [--check]",
    "user-invocable": true
}

Java Checkstyle / Spotless

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").
  • After the assistant has 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: Stage and commit (only if the user asked to commit)

Do NOT auto-commit. Report the changed file list to the user and let them decide whether to fold the formatting into the in-progress commit or make a separate "Fix Java checkstyle" commit. Follow the repo convention: the existing branch history already uses Fix Java checkstyle as the commit title for bot-triggered formatting-only commits.

Notes

  • Spotless config lives in the root pom.xml (spotless-maven-plugin section). Do not redefine formatting rules inline in source files.
  • If Spotless keeps rewriting a change the user just made, re-read the config — Spotless is the source of truth, not the IDE.
  • The analogous UI command is yarn pretty (see the test-locally skill / CLAUDE.md for the UI lint flow); this skill is Java-only.

Version History

  • a1e7b7a Current 2026-07-24 20:48

Same Skill Collection

.agents/skills/java-checkstyle/SKILL.md
.agents/skills/ui-checkstyle/SKILL.md
.claude/skills/playwright-validation/SKILL.md
.claude/skills/playwright/SKILL.md
.claude/skills/writing-playwright-tests/SKILL.md
skills/code-review/SKILL.md
skills/connector-audit/SKILL.md
skills/connector-building/SKILL.md
skills/connector-review/SKILL.md
skills/connector-standards/SKILL.md
skills/dev-setup/SKILL.md
skills/java-checkstyle/SKILL.md
skills/openmetadata-workflow/SKILL.md
skills/planning/SKILL.md
skills/playwright-validation/SKILL.md
skills/playwright/SKILL.md
skills/pr-checklist/SKILL.md
skills/systematic-debugging/SKILL.md
skills/tdd/SKILL.md
skills/test-enforcement/SKILL.md
skills/test-locally/SKILL.md
skills/ui-checkstyle/SKILL.md
skills/verification/SKILL.md
skills/writing-playwright-tests/SKILL.md
.claude/skills/ui-checkstyle/SKILL.md
.claude/skills/ui-core-components/SKILL.md
skills/ui-core-components/SKILL.md

Metadata

Files
0
Version
a1e7b7a
Hash
342309b2
Indexed
2026-07-24 20:48

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-21 06:30
浙ICP备14020137号-1 $방문자$