Agent skill
precommit
Format, validate checkstyle, and run tests before committing — in the correct order
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/precommit
SKILL.md
Pre-commit Check: Format → Validate → Test
Run this before every commit to catch format and checkstyle issues early.
$ARGUMENTS is an optional module name (e.g. jhelm-core). If omitted, runs against all modules.
Step 1: Auto-format
Single module:
./mvnw spring-javaformat:apply -pl $ARGUMENTS
All modules:
./mvnw spring-javaformat:apply
Step 2: Validate (checkstyle)
Single module:
./mvnw validate -pl $ARGUMENTS 2>&1 | grep -E "^\[ERROR\]|violations"
All modules:
./mvnw validate 2>&1 | grep -E "^\[ERROR\]|violations"
If violations remain after auto-format, invoke the /checkstyle skill to fix them manually. Do not proceed to Step 3 until validate passes cleanly.
Step 3: Run tests
Single module:
./mvnw test -pl $ARGUMENTS 2>&1 | tail -20
All modules (full build):
./mvnw install 2>&1 | tail -20
Outcome
Report a summary:
| Step | Result |
|---|---|
| Format | Applied / Already clean |
| Checkstyle | 0 violations / N violations (list them) |
| Tests | X passed, 0 failures / list failures |
If everything is green, the working tree is ready to commit. If anything fails, fix it before committing.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?