How this command is triggered — by the user, by Claude, or both
Slash command
/smart-commit:commitFiles this command reads when invoked
The summary Claude sees in its command listing — used to decide when to auto-load this command
--- description: git diff を解析してコミットメッセージを LLM が生成し、Co-Authored-By を付与してコミットする。 argument-hint: [-m "message"] [--push] allowed-tools: [Bash, Read, Glob, Grep, AskUserQuestion] --- # smart-commit: スマートコミットスキル あなたはスマートコミットスキルです。 git の変更差分を解析し、適切なコミットメッセージを生成して、Co-Authored-By を付与した上でコミットを実行します。 ## 引数の解析 `$ARGUMENTS` を確認する: - `-m "message"` または `-m 'message'` → 手動メッセージモード(メッセージ生成スキップ) - `--push` → コミット後に push も実行(確認あり) - 引数なし → 自動メッセージ生成モード ## STEP 1: git リポジトリ確認 失敗した場合(exit code != 0): 「現在のディレクトリは git リポジトリではありません。」と表示して終了。 ## STEP 2: git status 確認 変更が一切...
あなたはスマートコミットスキルです。 git の変更差分を解析し、適切なコミットメッセージを生成して、Co-Authored-By を付与した上でコミットを実行します。
$ARGUMENTS を確認する:
-m "message" または -m 'message' → 手動メッセージモード(メッセージ生成スキップ)--push → コミット後に push も実行(確認あり)git rev-parse --is-inside-work-tree 2>/dev/null
失敗した場合(exit code != 0): 「現在のディレクトリは git リポジトリではありません。」と表示して終了。
git status --short
変更が一切ない場合(出力が空): 「コミットする変更がありません。」と表示して終了。
git diff --staged --stat
staged changes がある(出力が空でない)→ staged を対象にする。 staged changes がない → 以下を確認する:
git add -A を実行してからコミットへ(全変更を staging)git diff --staged
(STEP 3 で全変更を対象にした場合も、add 後なので staged になっている)
差分が非常に大きい場合(10,000行超)は先頭5,000行のみ使用し、「差分が大きいため一部のみ解析します」と通知。
git log --oneline -5 2>/dev/null
コミット履歴があれば、使用言語(日本語/英語)とプレフィックスのスタイルを参考にする。 履歴がない場合は英語でデフォルトスタイルを使用。
-m "message" が指定されている場合 → STEP 7 をスキップし、そのメッセージを使用(STEP 8へ)
STEP 4 の差分と STEP 5 のスタイルを基に、以下の形式でコミットメッセージを生成:
<type>: <50文字以内の1行要約>
<必要な場合のみ: 変更の詳細を箇条書きで。72文字で折り返し>
type プレフィックス:
| type | 用途 |
|---|---|
| feat | 新機能追加 |
| fix | バグ修正 |
| refactor | リファクタリング |
| docs | ドキュメント変更 |
| test | テスト追加・修正 |
| chore | ビルド・設定変更 |
| style | コードスタイル変更 |
| perf | パフォーマンス改善 |
ガイドライン:
生成(または手動指定)したコミットメッセージの末尾に以下を追加:
Co-Authored-By: Claude <[email protected]>
最終的なコミットメッセージ全体をユーザーに表示する。
以下の形式で表示:
以下のコミットメッセージでコミットしますか?
---
<生成したコミットメッセージ(Co-Authored-By含む)>
---
[y] コミット [e] メッセージを編集 [n] キャンセル
git commit -m "$(cat <<'EOF'
<コミットメッセージ>
EOF
)"
成功した場合: コミット結果(hash、タイトル)を表示 失敗した場合: エラーメッセージを表示して終了
--push が指定されていた場合:
現在のブランチ名を確認:
git branch --show-current
「現在のブランチ <branch> を push しますか? (y/N): 」と確認
git push origin <branch> を実行(結果を表示)| エラー | 対処 |
|---|---|
| git コマンドが存在しない | 「git がインストールされていません。」と案内 |
| git リポジトリでない | 「現在のディレクトリは git リポジトリではありません。」と案内 |
| コミット失敗(pre-commit hook等) | エラー全文を表示し「コミットに失敗しました。エラーを確認してください。」と案内 |
| push 失敗 | エラー全文を表示 |
npx claudepluginhub skaji18/claude-plugins --plugin smart-commit/commit-generatorGenerates a conventional commit message for staged changes, shows it for approval, commits, and optionally pushes to remote.
/commitAnalyzes current git diff, generates 3 conventional commit message options (concise, detailed, comprehensive), presents for user selection, and executes git commit.
/commitStages and commits changes from the current session with a conventional commit message and co-author attribution.
/commitStages changes and commits locally using Conventional Commits format. Analyzes git status/diffs, drafts typed message with scope, confirms with user before git add and commit.
/git-commitCreates conventional git commits with emojis, auto-stages unstaged files if needed, analyzes diffs, detects multiple logical changes, and suggests splitting into atomic commits.