git-commit-helper について
開発者向けの Git コミットメッセージ生成スキルです。ステージ済みの差分から Conventional Commits 形式のメッセージを提案し、タイプ、スコープ、本文、破壊的変更の注記にも対応します。
主な機能
- 01ステージ済み差分の分析
- 02Conventional Commits 形式の生成
- 03コミットタイプとスコープの選択
- 04件名、本文、フッターの作成
- 05カスタムタイプとテンプレートへの対応
活用シーン
- 01ステージ済み変更のメッセージ作成
- 02曖昧または不統一なコミット文の改善
- 03チーム向けタイプと形式の設定
- 04prepare-commit-msg フックによるコミット支援
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ alirezarezvani/ claude-code-tresor --skill git-commit-helperインストール後、Claude Code で/git-commit-helperを入力して読み込まれたか確認します。
同梱ファイルREADME.md
詳細
Git コミットヘルパースキル
git diff から Conventional Commit 形式のコミットメッセージを生成します。
起動するタイミング
- ✅ メッセージを指定せずに
git commitを実行したとき - ✅ ユーザーから「コミットメッセージは何にすればよいですか?」と尋ねられたとき
- ✅ ステージされた変更があるとき
- ✅ ユーザーがコミットまたは Conventional Commits に言及したとき
- ✅ コミットを作成する前
生成する内容
Conventional Commit 形式
<type>(<scope>): <subject>
<body>
<footer>
タイプ:
feat:新機能fix:バグ修正docs:ドキュメントの変更style:コードスタイルの変更(フォーマット、ロジックの変更なし)refactor:コードのリファクタリングperf:パフォーマンスの改善test:テストの追加または修正build:ビルドシステムの変更ci:CI/CD の変更chore:保守作業
例
機能の追加
# You staged:
git add auth.service.ts login.component.tsx
# I analyze diff and suggest:
feat(auth): add JWT-based user authentication
- Implement login/logout functionality
- Add token management service
- Include auth guards for protected routes
- Add unit tests for auth service
Closes #42
バグ修正
# You staged:
git add UserList.tsx
# I suggest:
fix(components): resolve memory leak in UserList
Fixed subscription not being cleaned up in useEffect,
causing memory leak when component unmounts.
Closes #156
破壊的変更
# You staged:
git add api/users.ts
# I suggest:
feat(api): update user API response format
Changed response structure to include metadata
for better pagination and filtering support.
BREAKING CHANGE: User API now returns { data, metadata }
instead of direct array. Update client code accordingly.
ドキュメントの更新
# You staged:
git add README.md docs/api.md
# I suggest:
docs: update API documentation with authentication examples
- Add authentication flow diagrams
- Include cURL examples for protected endpoints
- Document error responses
分析プロセス
ステップ 1:ステージされた変更を確認する
git diff --staged --name-only
git diff --staged
ステップ 2:変更を分類する
- 新規ファイル → feat
- 変更されたファイル → fix、refactor、または feat
- 削除されたファイル → chore または refactor
- テストファイル → test
- ドキュメント → docs
ステップ 3:内容を分析する
- 何が変更されましたか?
- なぜ変更されましたか?
- どのような影響がありますか?
- 破壊的変更はありますか?
ステップ 4:メッセージを生成する
件名:
- 最大 50 文字
- 命令形(「added」ではなく「add」)
- 末尾にピリオドを付けない
- タイプの後は小文字にする
本文:
- 方法ではなく、何を変更したか、なぜ変更したかを説明する
- 72 文字で折り返す
- 複数の変更には箇条書きを使用する
フッター:
- 破壊的変更:
BREAKING CHANGE: description - Issue の参照:
Closes #123、Fixes #456
メッセージの構成要素
タイプの選択
feat: New functionality
- New components, features, capabilities
fix: Bug fixes
- Resolving issues, fixing bugs
refactor: Code improvements
- No functional changes, better code structure
perf: Performance
- Speed improvements, optimization
docs: Documentation
- README, comments, guides
test: Testing
- Adding or fixing tests
style: Formatting
- Code style, linting, formatting
chore: Maintenance
- Dependencies, build config, tooling
スコープの選択
よく使われるスコープ:
- コンポーネント名:
feat(UserCard): ... - モジュール:
fix(auth): ... - パッケージ:
chore(api): ... - 領域:
docs(readme): ...
件名のガイドライン
✅ 良い例:
add user authenticationfix memory leak in componentupdate API documentation
❌ 悪い例:
added user authentication(過去形)fixes bug(曖昧すぎる)Update API docs.(末尾にピリオド)
高度な例
複数の変更
# Multiple files in auth feature
feat(auth): implement complete authentication system
- Add JWT token generation and validation
- Implement password hashing with bcrypt
- Create login/logout API endpoints
- Add auth middleware for protected routes
- Include refresh token functionality
Closes #42, #43, #44
リファクタリング
# Code restructuring
refactor(api): extract database logic into repository pattern
Moved database queries from controllers to repository classes
for better separation of concerns and testability.
No functional changes or API modifications.
パフォーマンスの改善
# Optimization
perf(queries): optimize user data fetching
- Implement query batching to eliminate N+1 queries
- Add database indices on frequently queried columns
- Cache user profile data with 5-minute TTL
Performance improvement: 80ms → 12ms average response time
Git との連携
Pre-commit フック
pre-commit フックと一緒に使うと便利です:
#!/bin/sh
# .git/hooks/prepare-commit-msg
# If no commit message provided, trigger skill
if [ -z "$2" ]; then
# Skill suggests message based on staged changes
echo "# Suggested commit message (edit as needed)" > "$1"
fi
コミットの修正
# Poor initial message
git commit -m "fix stuff"
# Amend with better message
# I suggest improved message based on changes
git commit --amend
サンドボックスとの互換性
サンドボックスなしで動作: ✅ はい サンドボックスありで動作: ✅ はい
次の場合はネットワークアクセスが必要になることがあります:
- GitHub API から Issue の詳細を取得する
- Issue 番号が有効か確認する
サンドボックス設定(任意):
{
"network": {
"allowedDomains": [
"api.github.com"
]
}
}
カスタマイズ
カスタムコミットタイプ
会社固有のタイプを追加するには、SKILL.md を編集します:
deploy: Deployment
migrate: Database migrations
hotfix: Production hotfixes
カスタムスコープ
プロジェクト構成を認識できるようにスキルをトレーニングします:
Common scopes: auth, api, ui, database, admin, mobile
メッセージテンプレート
チームに合わせてメッセージ形式をカスタマイズします:
# Standard format
feat(scope): subject
# Your custom format
[JIRA-123] feat(scope): subject
より良いメッセージを作成するためのヒント
- 具体的にする:「fix bug」ではなく「fix login button」
- 命令形を使う:「added」や「adds」ではなく「add」
- 背景を含める:この変更が必要だった理由
- Issue を参照する:必ず Issue 番号を含める
- 破壊的変更:必ずフッターに記載する
よくあるパターン
フロントエンドの変更
feat(ui): add responsive navigation menu
fix(components): resolve prop validation warning
style(css): update button hover effects
バックエンドの変更
feat(api): add user pagination endpoint
fix(database): resolve connection pool exhaustion
perf(queries): add database indices for user lookups
インフラストラクチャの変更
ci: add automated deployment pipeline
build: update dependencies to latest versions
chore(docker): optimize container image size
関連ツール
- code-reviewer スキル:コミット前にコードをレビューします
- @docs-writer サブエージェント:コミットから変更履歴を生成します
- /review コマンド:コミット前のコードレビュー
連携
code-reviewer との連携
# 1. Write code
# 2. code-reviewer flags issues
# 3. Fix issues
# 4. Stage changes
# 5. I generate commit message
git commit # Uses my suggested message
/review コマンドとの連携
# 1. Make changes
/review --scope staged # Review before commit
# 2. Address findings
# 3. Stage final changes
# 4. I generate commit message
git commit
詳細情報
コメント
Markdown 対応