creating-git-commit

p-chan's avatarfrom p-chan

Git リポジトリのスタイルに合わせてコミットを作成します。ユーザーがコミットを求めたときや、エージェントがコミットするときに必ず使用してください。

⭐8stars🔀0forks📁View on GitHub🕐Updated Jan 4, 2026

When & Why to Use This Skill

This Claude skill automates the creation of Git commit messages by analyzing repository history to ensure consistency in language, style, and scope. It streamlines the development workflow by generating professional, context-aware commit messages that match existing project conventions like Conventional Commits or gitmoji.

Use Cases

  • Standardizing Commit Messages: Automatically generate commit messages that follow the 'feat:', 'fix:', or 'docs:' format by analyzing the project's previous 100 commits.
  • Multi-language Support: Maintain consistency in repositories by detecting whether the project uses English or Japanese for its history and generating new messages accordingly.
  • Gitmoji Integration: Identify and apply the correct gitmoji (Unicode or Shortcode) to maintain a visually organized and expressive commit history.
  • Automated Scoping: Detect relevant project scopes (e.g., 'auth', 'api', 'ui') from the git log to ensure detailed and structured commit metadata.
  • Seamless Agentic Workflow: Enable AI agents to perform self-contained code changes and commits without manual intervention while adhering to the user's preferred coding style.
namecreating-git-commit
descriptionGit リポジトリのスタイルに合わせてコミットを作成します。ユーザーがコミットを求めたときや、エージェントがコミットするときに必ず使用してください。
allowed-toolsBash(git diff:*), Bash(git log:*), Bash(sed:*), Bash(tr:*), Bash(sort:*), Bash(xargs:*)

Git コミット作成

ワークフロー

1. 情報収集

ステージングされた変更がある場合:

git diff --staged
git log --oneline -10

ステージングされた変更がない場合:

git diff
git log --oneline -10

2. 判定

過去のコミット履歴から以下を判定します。判定不可の場合はユーザーに確認してください。

言語判定

言語 パターン
日本語 日本語が含まれる
英語 英語のみが含まれる
その他 上記以外

スタイル判定

スタイル パターン
Conventional Commits feat:, fix: 等
gitmoji 絵文字で始まる
シンプル形式 上記以外

gitmoji の場合、絵文字の形式(Unicode / Shortcode)も判定してください。

スコープ判定

過去 10 件にスコープ(例: feat(auth): や ✨ (auth):)が含まれているかを判定します。

含まれている場合、以下のコマンドでスコープ一覧を取得します:

git log --oneline -100 | sed -n 's/^[a-f0-9]* [^(:]*(\([^)]*\)):.*/\1/p' | tr ',' '\n' | sed 's/^ *//' | sort -u | xargs | sed 's/ /, /g'

3. コミットメッセージ生成

判定結果に基づいてコミットメッセージを生成します。

  • タイトル(1行目): What(何をしたか)を簡潔に、50 文字以内
  • ボディ(本文): Why(なぜしたか)を必要に応じて補足
  • コード参照: コードやパスを表す場合はバッククォートで囲む
  • 言語: 判定した言語に合わせる
  • スタイル: 判定したスタイルに従う(Conventional Commits / gitmoji)
  • スコープ: スコープ一覧から適切なものを選択(該当する場合)

4. コミット作成

生成したメッセージを表示し、コミットを作成します。