jpskill.com
✍️ ライティング コミュニティ

gen-commit-msg

会話の流れと簡単なGitの情報を基に、短く分かりやすいコミットメッセージを自動で作成し、開発者が変更履歴をスムーズに管理できるように支援するSkill。

📜 元の英語説明(参考)

Generate concise commit messages based on conversation context and minimal git inspection.

🇯🇵 日本人クリエイター向け解説

一言でいうと

会話の流れと簡単なGitの情報を基に、短く分かりやすいコミットメッセージを自動で作成し、開発者が変更履歴をスムーズに管理できるように支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o gen-commit-msg.zip https://jpskill.com/download/9209.zip && unzip -o gen-commit-msg.zip && rm gen-commit-msg.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9209.zip -OutFile "$d\gen-commit-msg.zip"; Expand-Archive "$d\gen-commit-msg.zip" -DestinationPath $d -Force; ri "$d\gen-commit-msg.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して gen-commit-msg.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → gen-commit-msg フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Commitメッセージ生成 Skill

概要

この Skill は、簡潔で意味のある commit メッセージを生成します。

  1. 最優先: 会話のコンテキスト(編集されたファイル、議論された変更)を使用します。
  2. フォールバック: コンテキストがない場合は git diff を実行します。
  3. メッセージを簡潔かつ焦点が絞られた状態に保ちます。

どのような時に使うか

  • 会話で議論された変更を実装した後
  • 実際に行われた作業を反映した commit メッセージが必要な場合
  • 手動でメッセージを作成せずに、すばやく commit したい場合

使い方

変更を加えた後、この Skill を呼び出すだけです。この Skill は以下を行います。

  1. 会話のコンテキストから何が変更されたかを確認します。
  2. コンテキストがない場合: git diff --cached を実行して変更を分析します。
  3. 簡潔な commit メッセージを生成します。
  4. commit 前にユーザーに確認を求めます。

Commit メッセージのフォーマット

<type>: <短い要約 (<=50 文字)>

[オプションの本文: 何を/なぜ行ったかの簡潔な説明, <=3 行]

[オプションのフッター: 破壊的な変更、issue 参照]

Type プレフィックス

  • feat: 新機能
  • fix: バグ修正
  • refactor: 動作変更なしのコード構造変更
  • perf: パフォーマンス改善
  • docs: ドキュメントのみ
  • style: フォーマット、空白
  • test: テストの追加/更新
  • chore: ビルド、ツール、依存関係
  • build: ビルドシステム変更
  • ci: CI/CD 変更

実装ガイドライン

ステップ 1: 会話のコンテキストを確認する

コンテキストがある場合:

  • この会話で Write/Edit ツールを使用してファイルが編集された場合
  • ユーザーが何を変更したかを説明した場合
  • 機能/修正について議論された場合

コンテキストがない場合:

  • ユーザーが事前の議論なしに「変更を commit して」と言うだけの場合
  • この会話以外で変更が行われた場合
  • ユーザーが手動でファイルを変更した場合

ステップ 2: 変更情報を取得する

コンテキストがある場合:

  • 既知のファイルの編集と変更を使用します。
  • git diff を完全にスキップします。

コンテキストがない場合:

# ステータス付きの変更されたファイルのリストを取得
git diff --cached --name-status

# ファイルレベルの統計情報を取得
git diff --cached --stat

# 実際に行われた変更を取得 (何が行われたかを理解するため)
git diff --cached

# 代替案: 何もステージングされていない場合は、作業ディレクトリを確認
git status --short
git diff --stat
git diff

ステップ 3: 簡潔なメッセージを生成する

原則:

  • 簡潔さ: 要約 <=50 文字、本文 <=3 行
  • どのようにではなく、何を: 実装ではなく、結果を説明します。
  • 命令形: add, fix, update (added, fixed ではない)

良い例:

feat: add scroll limit config commands

Add get-scroll-settings and set-scroll-limit commands
to es_tool.sh for managing ES scroll configuration.
fix: ensure bulk requests end with newline

ES bulk API requires NDJSON format with trailing newline.
refactor: translate es_tool comments to English

悪い例:

feat: implement comprehensive elasticsearch scroll configuration management system

This commit adds a full suite of commands for managing scroll-related
settings in Elasticsearch including viewing current configuration,
modifying document count limits, enabling/disabling rejection behavior...
[冗長すぎる]

ステップ 4: 提示と確認

# 何が commit されるかを表示
git status --short

# メッセージを提示
echo "Proposed commit message:"
echo "----------------------------------------"
echo "<generated_message>"
echo "----------------------------------------"
echo ""
read -p "Commit these changes? (y/n): " response

ステップ 5: Commit を実行

重要: commit メッセージはクリーンでプロフェッショナルでなければなりません。以下を含めないでください。

  • 🤖 Generated with [Claude Code] マーカー
  • Co-Authored-By: Claude 属性
  • その他のツールで生成されたメタデータまたは署名

これらは価値を追加せず、commit 履歴を乱雑にします。

# 生成されたメッセージで commit (余分なメタデータなし)
git commit -m "$(cat <<'EOF'
<generated_message>
EOF
)"

# 結果を表示
git log -1 --oneline

意思決定フロー

START
  |
  v
変更に関する会話のコンテキストはありますか?
  |
  +-- YES --> コンテキストを使用してメッセージを生成
  |            (git diff をスキップ)
  |
  +-- NO --> git diff を実行して変更を分析
              |
              v
            変更はステージングされていますか?
              |
              +-- YES --> git diff --cached
              |
              +-- NO --> git diff (作業ディレクトリ)
  |
  v
簡潔な commit メッセージを生成
  |
  v
ユーザーに提示して確認
  |
  v
ユーザーが確認しますか?
  |
  +-- YES --> git commit
  |
  +-- NO --> 終了 (commit しない)
  |
  v
END

例 1: コンテキストあり (Git Diff なし)

会話:

User: health check コマンドを es_tool.sh に追加
Assistant: [es_tool.sh を編集し、check-health, check-shards などを追加]
User: commit を作成

Skill の実行:

  1. コンテキストあり: es_tool.sh を編集、health check コマンドを追加

  2. git diff をスキップ

  3. 生成:

    feat: add cluster health check commands
    
    Implements check-health, check-shards, explain-allocation,
    and fix-red-shards for ES cluster diagnostics.

例 2: コンテキストなし (Git Diff を使用)

会話:

User: commit メッセージを生成

Skill の実行:

  1. コンテキストなし

  2. git diff --cached を実行:

    diff --git a/script/es_tool.sh b/script/es_tool.sh
    @@ -841,7 +841,7 @@ execute_http_request() {
    -            content_type="text/plain"
    +            content_type="application/x-ndjson"
    +            # Ensure body ends with newline
    +            if [[ "$body" != *$'\n' ]]; then
    +                body="${body}"$'\n'
    +            fi
  3. 分析: bulk request の content-type を変更、改行を追加

  4. 生成:

    fix: correct bulk request content-type
    
    Use application/x-ndjson and ensure trailing newline
    for ES bulk API NDJSON format compliance.

例 3: ユーザーがコンテキストを提供

会話:

User: bulk API の改行問題の修正を commit

Skill の実行:

  1. ユーザーからのコンテキスト: "bulk API の改行問題の修正"
  2. 簡単なチェック: git diff --cached --name-only (ファイル名のみ)
    script/es_tool.sh
  3. 生成 (最小限の diff が必要):

(原文はここで切り詰められています)

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Generate Commit Message Skill

Overview

This skill generates concise, meaningful commit messages by:

  1. First priority: Use conversation context (files edited, changes discussed)
  2. Fallback: Run git diff when context is unavailable
  3. Keep messages brief and focused

When to Use

  • After implementing changes discussed in the conversation
  • When you want a commit message that reflects the actual work done
  • To quickly commit without manual message writing

Usage

Simply invoke this skill after making changes. The skill will:

  1. Check conversation context for what was changed
  2. If no context: run git diff --cached to analyze changes
  3. Generate a concise commit message
  4. Prompt for user confirmation before committing

Commit Message Format

<type>: <brief summary (<=50 chars)>

[Optional body: concise explanation of what/why, <=3 lines]

[Optional footer: Breaking changes, issue refs]

Type Prefixes

  • feat: New feature
  • fix: Bug fix
  • refactor: Code restructure without behavior change
  • perf: Performance improvement
  • docs: Documentation only
  • style: Formatting, whitespace
  • test: Add/update tests
  • chore: Build, tools, dependencies
  • build: Build system changes
  • ci: CI/CD changes

Implementation Guidelines

Step 1: Check Conversation Context

Has context if:

  • Files were edited via Write/Edit tools in this conversation
  • User described what was changed
  • Features/fixes were discussed

No context if:

  • User just says "commit my changes" without prior discussion
  • Changes were made outside this conversation
  • Files were modified manually by user

Step 2: Get Change Information

If context available:

  • Use known file edits and changes
  • Skip git diff entirely

If no context:

# Get list of changed files with status
git diff --cached --name-status

# Get file-level stats
git diff --cached --stat

# Get actual changes (for understanding what was done)
git diff --cached

# Alternative: if nothing staged, check working directory
git status --short
git diff --stat
git diff

Step 3: Generate Concise Message

Principles:

  • Brevity: Summary <=50 chars, body <=3 lines
  • What, not how: Describe the outcome, not implementation
  • Imperative mood: add, fix, update (not added, fixed)

Good Examples:

feat: add scroll limit config commands

Add get-scroll-settings and set-scroll-limit commands
to es_tool.sh for managing ES scroll configuration.
fix: ensure bulk requests end with newline

ES bulk API requires NDJSON format with trailing newline.
refactor: translate es_tool comments to English

Bad Examples:

feat: implement comprehensive elasticsearch scroll configuration management system

This commit adds a full suite of commands for managing scroll-related
settings in Elasticsearch including viewing current configuration,
modifying document count limits, enabling/disabling rejection behavior...
[TOO VERBOSE]

Step 4: Present and Confirm

# Show what will be committed
git status --short

# Present message
echo "Proposed commit message:"
echo "----------------------------------------"
echo "<generated_message>"
echo "----------------------------------------"
echo ""
read -p "Commit these changes? (y/n): " response

Step 5: Execute Commit

CRITICAL: The commit message MUST be clean and professional. DO NOT include:

  • 🤖 Generated with [Claude Code] markers
  • Co-Authored-By: Claude attributions
  • Any other tool-generated metadata or signatures

These add no value and clutter the commit history.

# Commit with generated message (NO extra metadata)
git commit -m "$(cat <<'EOF'
<generated_message>
EOF
)"

# Show result
git log -1 --oneline

Decision Flow

START
  |
  v
Do we have conversation context about changes?
  |
  +-- YES --> Use context to generate message
  |            (Skip git diff)
  |
  +-- NO --> Run git diff to analyze changes
              |
              v
            Are changes staged?
              |
              +-- YES --> git diff --cached
              |
              +-- NO --> git diff (working directory)
  |
  v
Generate concise commit message
  |
  v
Present to user for confirmation
  |
  v
User confirms?
  |
  +-- YES --> git commit
  |
  +-- NO --> Exit (no commit)
  |
  v
END

Examples

Example 1: With Context (No Git Diff)

Conversation:

User: Add health check commands to es_tool.sh
Assistant: [edits es_tool.sh, adds check-health, check-shards, etc.]
User: Create a commit

Skill execution:

  1. Context available: Edited es_tool.sh, added health check commands

  2. Skip git diff

  3. Generate:

    feat: add cluster health check commands
    
    Implements check-health, check-shards, explain-allocation,
    and fix-red-shards for ES cluster diagnostics.

Example 2: No Context (Use Git Diff)

Conversation:

User: Generate commit message

Skill execution:

  1. No context available

  2. Run git diff --cached:

    diff --git a/script/es_tool.sh b/script/es_tool.sh
    @@ -841,7 +841,7 @@ execute_http_request() {
    -            content_type="text/plain"
    +            content_type="application/x-ndjson"
    +            # Ensure body ends with newline
    +            if [[ "$body" != *$'\n' ]]; then
    +                body="${body}"$'\n'
    +            fi
  3. Analyze: Changed content-type for bulk requests, added newline

  4. Generate:

    fix: correct bulk request content-type
    
    Use application/x-ndjson and ensure trailing newline
    for ES bulk API NDJSON format compliance.

Example 3: User Provides Context

Conversation:

User: Commit the fix for the bulk API newline issue

Skill execution:

  1. Context from user: "fix for bulk API newline issue"

  2. Quick check: git diff --cached --name-only (just filenames)

    script/es_tool.sh
  3. Generate (minimal diff needed):

    fix: ensure bulk requests end with newline
    
    Add trailing newline to bulk request body for
    ES NDJSON format requirements.

Best Practices

DO:

  • Use conversation context when available
  • Run git diff when context is missing
  • Keep summary under 50 characters
  • Use imperative mood (add, fix, update)
  • Focus on WHAT and WHY
  • Confirm with user before committing

DON'T:

  • Skip git diff when you have no context
  • Write verbose explanations
  • Describe HOW code was implemented
  • Auto-commit without confirmation
  • Use past tense (added, fixed, updated)

Git Tags

When user requests creating a tag (for CI/CD pipeline trigger, release, etc.):

  1. Check existing tag format first:

    git tag --sort=-creatordate | head -5
  2. Keep format consistent - DO NOT add 'v' prefix unless project already uses it:

    • If existing: 0.4.0, 0.3.0 → use 0.4.1 (no 'v')
    • If existing: v0.4.0, v0.3.0 → use v0.4.1 (with 'v')
  3. Never assume tag format - always verify from existing tags

Notes

  • Optimizes for speed by using context when available
  • Falls back to git diff when needed for accuracy
  • Generates concise but informative messages
  • Always confirms before committing
  • Works in both interactive and standalone scenarios