$npx -y skills add ducpm2303/claude-java-plugins --skill java-commitGenerates a Conventional Commits message for staged Java changes. Use when user asks to "write a commit message", "help me commit", "what should my commit say", "summarize my changes", "draft a commit", or "create commit message".
| 1 | Generate a git commit message for the current Java changes. Use the Conventional Commits format tailored to Java/Spring projects. |
| 2 | |
| 3 | ## Step 1 — Gather context |
| 4 | Run (or ask Claude to run): `git diff --staged --stat` to see which files changed. |
| 5 | If nothing is staged, check `git diff --stat` for unstaged changes. |
| 6 | |
| 7 | ## Step 2 — Analyse the changes |
| 8 | Based on the changed files, determine: |
| 9 | - **Type of change**: feat, fix, refactor, test, docs, chore, perf, security |
| 10 | - **Scope**: the Java package, module, or layer affected (e.g., `service`, `controller`, `repository`, `security`) |
| 11 | - **What changed**: specific class names, method names, or behaviours |
| 12 | |
| 13 | ## Step 3 — Generate commit message |
| 14 | |
| 15 | Use this format: |
| 16 | ``` |
| 17 | <type>(<scope>): <imperative summary under 72 chars> |
| 18 | |
| 19 | [optional body — what changed and why, not how] |
| 20 | |
| 21 | [optional footer — breaking changes, issue references] |
| 22 | ``` |
| 23 | |
| 24 | ### Java-specific type rules: |
| 25 | - `feat`: new class, method, endpoint, or feature |
| 26 | - `fix`: bug fix in logic, null check, exception handling |
| 27 | - `refactor`: extract method, rename, restructure — no behaviour change |
| 28 | - `perf`: N+1 fix, index added, caching, virtual threads |
| 29 | - `test`: new or updated JUnit/Mockito/Testcontainers tests |
| 30 | - `security`: OWASP fix, auth change, secret handling improvement |
| 31 | - `chore`: dependency update, build config, version bump |
| 32 | |
| 33 | ### Java-specific scope examples: |
| 34 | - `user-service`, `order-controller`, `payment-repository` |
| 35 | - `auth`, `security`, `jpa`, `api`, `dto` |
| 36 | - `pom`, `gradle`, `ci` |
| 37 | |
| 38 | ### Examples: |
| 39 | ``` |
| 40 | feat(user-service): add findByEmail with case-insensitive search |
| 41 | |
| 42 | Adds UserService.findByEmail() using Spring Data derived query. |
| 43 | Returns Optional<User> to handle missing users without null checks. |
| 44 | ``` |
| 45 | ``` |
| 46 | fix(order-controller): return 404 when order not found instead of 500 |
| 47 | |
| 48 | Previously threw NullPointerException when order ID did not exist. |
| 49 | Now throws ResourceNotFoundException mapped to 404 by GlobalExceptionHandler. |
| 50 | ``` |
| 51 | ``` |
| 52 | perf(product-repository): fix N+1 query with @EntityGraph on findAll |
| 53 | |
| 54 | Each product was triggering a separate query for its category. |
| 55 | Added @EntityGraph(attributePaths = "category") to load in one JOIN. |
| 56 | ``` |
| 57 | ``` |
| 58 | refactor(auth-service): replace field injection with constructor injection |
| 59 | |
| 60 | Removes @Autowired field injection on JwtTokenProvider and UserDetailsService. |
| 61 | Constructor injection makes dependencies explicit and improves testability. |
| 62 | ``` |
| 63 | |
| 64 | ## Step 4 — Output |
| 65 | Provide: |
| 66 | 1. The commit message (ready to copy) |
| 67 | 2. The git command: `git commit -m "$(cat <<'EOF'\n[message]\nEOF\n)"` |
| 68 | |
| 69 | If multiple logical changes are staged together, suggest splitting into separate commits. |