git addやgit commitを行う際に呼び出してください。変更を適切な粒度に分割してコミットします。
Changes are grouped into logical commits using Conventional Commits format. Uses git-sequential-stage to analyze diffs and stage hunks individually for precise, meaningful commits.
/plugin marketplace add syou6162/claude-code-commands/plugin install syou6162-plugin@syou6162-marketplacesonnet大きな変更を論理的な単位に分割してコミットしてください。git diffを分析して意味のある最小単位を特定し、git-sequential-stageツールで段階的にステージングします。
&&や;で繋ぐなど、手順にない方法でコマンドを実行してはいけないgit add . / git add -A の使用は禁止ですgit-sequential-stageを使用してhunk単位でステージングすることpre-commitの事前実行
.pre-commit-config.yamlが存在する場合は、事前に実行してください:
pre-commit run --all-files
差分を取得
最初に必ずintent-to-addで新規ファイルを追加してください:
git ls-files --others --exclude-standard | xargs -r git add -N
差分を取得してください:
git diff HEAD | tee .claude_work/current_changes.patch
変更内容を分析
hunk単位で変更を分析し、最初のコミットに含めるhunkを決定してください:
各ファイルのhunk数を確認してください:
git-sequential-stage count-hunks
分析例:
# 分析結果例
# - コミット1(fix):
# - src/calculator.py: hunk 1, 3, 5(ゼロ除算エラーの修正)
# - src/utils.py: hunk 2(関連するユーティリティ関数の修正)
# - コミット2(refactor):
# - src/calculator.py: hunk 2, 4(計算ロジックの最適化)
コミットメッセージの形式(Conventional Commits形式):
feat: 新機能fix: バグ修正refactor: リファクタリングdocs: ドキュメントtest: テストstyle: フォーマットperf: パフォーマンス改善build: ビルドシステムや外部依存関係の変更ci: CI設定ファイルやスクリプトの変更revert: コミットの取り消しchore: その他分析が完了したら、コミット用のメッセージを作成してください:
コミットメッセージの作成方法:
.claude_work/commit_message.txt にコミットメッセージを書くことcatとheredocを使ってファイルに書き込む(例:cat <<EOF > .claude_work/commit_message.txt)git commit -mで直接メッセージを指定する# Writeツールで .claude_work/commit_message.txt にコミットメッセージを書く
# 例:
# fix: ゼロ除算エラーを修正
#
# 計算処理で分母が0の場合の適切なエラーハンドリングを追加
ステージングとコミット
<decision-criteria name="wildcard-usage">ワイルドカード(*)の使用判断:
| 状況 | 判断 | 理由 |
|---|---|---|
| ファイル内のすべての変更が意味的に一体 | * 使用 | 単一の目的で分割不要 |
| 新規ファイル追加 | * 使用 | すべて新規のため |
| ドキュメントファイルの変更 | * 使用 | 通常は単一目的 |
| 異なる目的の変更が混在 | hunk番号指定 | バグ修正とリファクタリング等を分離 |
| hunk数が不明 | まず確認 | 盲目的な*使用は厳禁 |
重要: 「hunkを数えるのが面倒」という理由での*使用は厳禁
# パターン1: 部分的な変更をステージング(hunk番号指定)
git-sequential-stage stage -patch=".claude_work/current_changes.patch" -hunk="src/calculator.py:1,3,5"
# パターン2: ファイル全体をステージング(意味的に一体の変更の場合)
git-sequential-stage stage -patch=".claude_work/current_changes.patch" -hunk="tests/test_calculator.py:*"
# パターン3: 複数ファイルの場合(混在使用)
git-sequential-stage stage -patch=".claude_work/current_changes.patch" -hunk="src/calculator.py:1,3,5" -hunk="src/utils.py:2" -hunk="docs/CHANGELOG.md:*"
# コミット実行(手順3で作成したコミットメッセージを使用)
# 注意: ファイルパスは .claude_work/commit_message.txt であり、/tmp ではない
git commit -F .claude_work/commit_message.txt
</example>
残りの変更を処理
残りの変更があるかを確認してください:
git diff HEAD
判断フロー:
パッチファイルの再生成:
git diff HEAD | tee .claude_work/current_changes.patch > /dev/null
最終確認
すべての変更がコミットされたか確認してください:
git diff HEAD
git status
Use this agent when analyzing conversation transcripts to find behaviors worth preventing with hooks. Examples: <example>Context: User is running /hookify command without arguments user: "/hookify" assistant: "I'll analyze the conversation to find behaviors you want to prevent" <commentary>The /hookify command without arguments triggers conversation analysis to find unwanted behaviors.</commentary></example><example>Context: User wants to create hooks from recent frustrations user: "Can you look back at this conversation and help me create hooks for the mistakes you made?" assistant: "I'll use the conversation-analyzer agent to identify the issues and suggest hooks." <commentary>User explicitly asks to analyze conversation for mistakes that should be prevented.</commentary></example>