git-commit について
Java プロジェクト向けに Conventional Commits 形式のコミットメッセージを作成するスキルです。ステージ済みの変更から種別とスコープを選び、簡潔な件名と任意の本文を作成します。
主な機能
- 01ステージ済み変更の分析
- 02コミット種別とスコープの選択
- 03規約に沿った件名の作成
- 04任意の本文と課題参照の追加
- 05破壊的変更フッターへの対応
活用シーン
- 01コード変更後のメッセージ作成
- 02PR 作成前のコミット準備
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ decebals/ claude-code-java --skill git-commitインストール後、Claude Code で/git-commitを入力して読み込まれたか確認します。
同梱ファイルREADME.md
詳細
Git Commit Message Skill
Java プロジェクト向けに、規約に沿った情報量のあるコミットメッセージを生成します。
使用するタイミング
- コードを変更した後
- ユーザーが「これをコミットして」/「変更をコミットして」/「コミットを作成して」と言ったとき
- PR を作成する前
形式の標準
Conventional Commits 形式を使用します。
<type>(<scope>): <subject>
<body>
<footer>
タイプ(Java のコンテキスト)
- feat:新機能(新しい API、新しい機能)
- fix:バグ修正
- refactor:コードのリファクタリング(機能の変更なし)
- test:テストの追加/更新
- docs:ドキュメントのみ
- perf:パフォーマンスの改善
- build:Maven/Gradle の変更
- chore:保守作業(依存関係の更新など)
スコープの例(Java 固有)
- モジュール名:
core、api、plugin-loader - コンポーネント:
PluginManager、ExtensionFactory - 領域:
lifecycle、dependencies、security
件名のルール
- 命令形にする:「Add support」であり、「Added support」ではありません
- 末尾にピリオドを付けない
- 最大 50 文字
- タイプの後は小文字にする
本文(任意ですが推奨)
- 方法ではなく、何を、なぜ行うのかを説明します
- 72 文字で折り返します
- Issue を参照します:「Fixes #123」/「Relates to #456」
例
簡単な修正
fix(plugin-loader): prevent NPE when plugin directory is missing
Check for null before accessing plugin directory to avoid
NullPointerException during initialization.
Fixes #234
破壊的変更を伴う機能
feat(api): add support for plugin dependencies versioning
BREAKING CHANGE: PluginDescriptor now requires semantic versioning
format (x.y.z) instead of free-form version strings.
Closes #567
リファクタリング
refactor(core): extract plugin validation logic
Move validation logic from PluginManager to separate
PluginValidator class for better testability and separation
of concerns.
テストの追加
test(plugin-loader): add integration tests for plugin loading
Add comprehensive integration tests covering:
- Loading from directory
- Loading from JAR
- Error handling for invalid plugins
ビルド/依存関係の更新
build(deps): upgrade Spring Boot to 3.2.1
Update Spring Boot from 3.1.0 to 3.2.1 for security patches
and performance improvements.
ワークフロー
git diff --stagedを使って変更を分析します- 変更されたファイルからスコープを特定します
- 変更の内容に基づいてタイプを決定します
- 形式に従ってメッセージを生成します
- コミットを実行します:
git commit -m "message"
トークンの最適化
- ステージされた変更は一度だけ読み込みます:
git diff --staged --statと対象ファイルの差分 - 必要でない限り、ファイル全体を読み込まないでください
- 本文は簡潔にし、最大 2~3 行を目安にします
- 複数の小さな変更は、論理的な単位でまとめてコミットします
アンチパターン
❌ 避けるべきこと:
- 「fix stuff」/「update code」/「changes」
- 「WIP」コミット(明示的に依頼された場合を除く)
- 関連のない変更を混在させること(コミットを分けてください)
- メッセージに技術的な実装の詳細を書きすぎること
✅ 良いコミット:
- 論理的にまとまった変更を 1 つ含む
- 明確で検索しやすい件名
- 該当する場合は Issue を参照する
- ビジネス上の価値を説明する
GitHub との連携
コミット後に、次のステップを提案します:
- 「変更をプッシュしますか?」
- 「Issue #X の PR を作成しますか?」
- 「次のタスクに進みますか?」
Java プロジェクトでよく使われるパターン
新機能の追加
feat(extension): add support for prioritized extensions
Allow extensions to specify priority order for execution.
Extensions with higher priority run first.
Closes #123
バグの修正
fix(classloader): resolve resource lookup in nested JARs
ClassLoader.getResource() was failing for resources in
JARs loaded from plugin JARs (nested JARs). Fixed by
implementing proper resource resolution chain.
Fixes #456
依存関係の更新
build(deps): bump slf4j from 1.7.30 to 2.0.9
Updates SLF4J to latest stable version. No API changes
required as we use only stable APIs.
ドキュメントの改善
docs(readme): add plugin development quickstart guide
Add step-by-step guide for creating first plugin:
- Project setup
- Implementing Plugin interface
- Building and testing
パフォーマンスの最適化
perf(plugin-loader): cache plugin descriptors
Cache parsed plugin descriptors to avoid repeated I/O
and parsing. Reduces plugin loading time by ~40%.
Related to #789
複数ファイルにまたがる変更
変更が複数のコンポーネントにまたがる場合:
refactor(core): reorganize plugin lifecycle management
- Extract lifecycle state machine to separate class
- Move validation logic to validators package
- Update tests to reflect new structure
This refactoring improves testability and separation
of concerns without changing external APIs.
Related to #111, #222
破壊的変更
必ず BREAKING CHANGE フッターを使用します:
feat(api)!: replace Plugin.start() with Plugin.initialize()
BREAKING CHANGE: The Plugin.start() method has been renamed
to Plugin.initialize() for better semantic clarity. All
plugin implementations must update their code.
Migration guide: Replace @Override start() with @Override
initialize() in all Plugin implementations.
Closes #999
クイックリファレンスカード
| 変更タイプ | タイプ | スコープの例 |
|---|---|---|
| 新機能 | feat | api、core、loader |
| バグ修正 | fix | plugin-loader、lifecycle |
| リファクタリング | refactor | core、utils |
| テスト | test | integration、unit |
| ドキュメント | docs | readme、javadoc |
| ビルド | build | maven、deps |
| パフォーマンス | perf | classloader、cache |
| 保守 | chore | ci、tooling |
参考資料
コメント
Markdown 対応