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

git-conventional-commits

gitの変更内容を解析して、機能追加やバグ修正などの変更の種類を自動で判断し、構造化されたコミットメッセージを生成することで、より分かりやすいコミット履歴を作成するSkill。

📜 元の英語説明(参考)

Generates conventional commit messages from staged git changes by analyzing diffs, classifying change types (feat, fix, refactor, docs, test, chore, ci, perf, style, build), and composing structured commit messages with optional scope and breaking change notation. Use when committing code, writing commit messages, preparing git commits, or when the user asks for help with commit messages.

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

一言でいうと

gitの変更内容を解析して、機能追加やバグ修正などの変更の種類を自動で判断し、構造化されたコミットメッセージを生成することで、より分かりやすいコミット履歴を作成するSkill。

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

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して git-conventional-commits.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → git-conventional-commits フォルダができる
  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 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Git Conventional Commits

概要

Conventional Commits 仕様に従って、構造化されたコミットメッセージを生成します。 形式は type(scope): description で、オプションで本文とフッターを含めることができます。 このスキルは、エージェントが一貫性があり、解析可能なコミットメッセージを生成し、セマンティックバージョニングツール、変更履歴、および CI パイプラインで動作することを保証します。

どのような時に使うか

  • ステージングされた変更を git リポジトリにコミットするとき
  • ユーザーがコミットメッセージの作成を手伝ってほしいと頼んだとき
  • 機能、修正、またはリファクタリングを実装した後にコミットを準備するとき
  • ユーザーが「これをコミットして」、「コミットメッセージを書いて」などと言ったとき
  • コミット前にステージングされた変更を確認するとき

以下の場合は使用しないでください:

  • ユーザーが明示的に独自のコミットメッセージを提供し、git commit を実行するだけの場合
  • リポジトリが非 Conventional Commit 形式を使用している場合(最初に .commitlintrcCONTRIBUTING.md、または以前のコミット履歴を確認してください)
  • ステージングされた変更がない場合(git diff --cached が空の場合)

ワークフロー

1. ステージングされた差分を読み取る

git diff --cached を実行して、コミットされる内容を正確に確認します。何もステージングされていない場合は、ユーザーに伝え、停止します。

また、ファイルレベルの概要については、git diff --cached --stat を実行します。これはスコープを特定するのに役立ちます。

なぜこれが重要なのか: 差分は真実です。何が変更されたかを推測せずに、必ず読み取ってください。

2. 変更タイプを分類する

差分を分析し、1 つの主要なタイプを選択します。最初に一致するルールを使用します。

タイプ どのような時に使うか
feat ユーザーに見える新しい機能を追加します(新しいエンドポイント、UI 要素、コマンド)
fix バグを修正します — 壊れていたものが動作するようになります
refactor 動作を変更せずにコードを再構築します(名前の変更、抽出、再編成)
docs ドキュメントのみの変更(README、JSDoc、コメント、ドキュメンテーション文字列)
test テストファイルのみが変更されました(テストの追加、更新、または修正)
perf 動作の変更なしにパフォーマンスが向上
style フォーマットのみ(空白、セミコロン、linting)— ロジックの変更はありません
build ビルドシステムまたは依存関係の変更(package.json、Dockerfile、Makefile)
ci CI/CD 構成の変更(GitHub Actions、Jenkins、CircleCI)
chore 上記に当てはまらないメンテナンス作業(gitignore、エディタ構成)

曖昧な場合の決定ルール:

  • 関数を含む新しいファイル → feat (新しい機能)、chore ではない
  • リファクタリングも行うバグ修正 → fix (主要な意図が重要)
  • 機能とともに追加されたテスト → feat (機能が主な変更)
  • 脆弱性を修正するための依存関係の更新 → fixbuild ではない
  • パブリック API メソッドの名前変更 → refactorBREAKING CHANGE フッター付き

3. スコープを特定する

スコープは、影響を受けるモジュール、コンポーネント、または領域です。括弧で囲みます: type(scope): ...

スコープを決定する方法:

  • すべての変更が 1 つのディレクトリ/モジュールにある場合 → その名前を使用します (例: authapiparser)
  • 変更がファイルにまたがる単一の機能である場合 → 機能名を使用します (例: loginsearch)
  • 変更が広すぎて名前を付けられない場合 → スコープを省略します: type: description

スコープは、単一の小文字の単語またはハイフンで区切られたフレーズである必要があります。ファイルパスをスコープとして使用しないでください。

4. 件名行を記述する

件名行は最も重要な部分です。次のルールを厳守してください。

  1. 命令形を使用する — 「add feature」ではなく「added feature」または「adds feature」。文を完成させるように記述します: 「適用すると、このコミットは ___ になります。」
  2. 50 文字以下 — 厳守してください。type(scope): を含む最初の行全体をカウントします。たとえば、feat(auth): add login endpoint は 31 文字です。50 文字を超える場合は、説明を短くするか、詳細を本文に移動します。
  3. 最後にピリオドを付けない — 文字を無駄にし、慣習的ではありません。
  4. コロンの後の最初の文字は小文字feat(auth): add login endpointfeat(auth): Add login endpoint ではない。
  5. 具体的にする — 「fix bug」ではなく「fix null pointer in user lookup」。
  6. 出力する前に確認する — 件名行の文字数をカウントします。50 に近い場合は、再度カウントします。オーバーするリスクを冒すよりも、45 に近い方が良いです。

5. 本文を記述する (必要な場合)

件名行だけでは変更が行われた理由を説明できない場合は、本文を追加します。件名行とは空白行で区切ります。

以下の場合に本文を含めます:

  • 変更が明白でない場合 (なぜこのアプローチなのか?)
  • 重要なコンテキストがある場合 (関連する問題、設計上の決定)
  • 差分が大きい場合 (何が変更されたか、なぜ変更されたかを要約する)

本文のルール:

  • 1 行あたり 72 文字で折り返す
  • 動機を説明し、以前の動作との対比を示す
  • 複数の関連する変更については、箇条書きを使用する

以下の場合に本文をスキップします:

  • 変更が自明である場合 (例: fix(typo): correct spelling in README)
  • 件名行が意図を完全に捉えている場合

6. 破壊的な変更のフッターを追加する (必要な場合)

コミットが破壊的な変更を導入する場合 (パブリック API の削除/名前変更、コンシューマーが依存する動作の変更)、フッターを追加します:

BREAKING CHANGE: <何が壊れて、移行パスはどうなるかの説明>

ルール:

  • BREAKING CHANGE は大文字で、コロンとスペースが続く必要があります
  • 何が壊れるのか、および移行方法を説明する
  • または、タイプ/スコープの後に ! を追加します: feat(api)!: remove v1 endpoints
  • 両方の表記法を組み合わせて、可視性を最大限に高めることができます

例 1: 簡単な機能の追加

差分:


diff --git a/src/utils/validators.ts b/src/utils/validators.ts
index 1a2b3c4..5d6e7f8 100644
--- a/src/utils/validators.ts
+++ b/src/utils/validators.ts
@@ -15,6 +15,18 @@ export function validateEmail(email: string): boolean {
   return EMAIL_REGEX.test(email);
 }

+export function validatePhoneNumber(phone: string): boolean {


(原文はここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Git Conventional Commits

Overview

Generate structured commit messages following the Conventional Commits specification. The format is type(scope): description with an optional body and footer. This skill ensures agents produce consistent, parseable commit messages that work with semantic versioning tools, changelogs, and CI pipelines.

When to use

  • When committing staged changes to a git repository
  • When the user asks for help writing a commit message
  • When preparing a commit after implementing a feature, fix, or refactor
  • When the user says "commit this", "write a commit message", or similar
  • When reviewing staged changes before committing

Do NOT use when:

  • The user explicitly provides their own commit message and just wants you to run git commit
  • The repository uses a non-conventional commit format (check for .commitlintrc, CONTRIBUTING.md, or prior commit history first)
  • There are no staged changes (git diff --cached is empty)

Workflow

1. Read the staged diff

Run git diff --cached to see exactly what will be committed. If nothing is staged, tell the user and stop.

Also run git diff --cached --stat for a file-level summary. This helps identify scope.

Why this matters: The diff is the ground truth. Never guess what changed — read it.

2. Classify the change type

Analyze the diff and select ONE primary type. Use the first matching rule:

Type When to use
feat Adds new functionality visible to users (new endpoint, UI element, command)
fix Corrects a bug — something that was broken now works
refactor Restructures code without changing behavior (rename, extract, reorganize)
docs Only documentation changes (README, JSDoc, comments, docstrings)
test Only test files changed (adding, updating, or fixing tests)
perf Performance improvement with no behavior change
style Formatting only (whitespace, semicolons, linting) — no logic changes
build Build system or dependency changes (package.json, Dockerfile, Makefile)
ci CI/CD configuration changes (GitHub Actions, Jenkins, CircleCI)
chore Maintenance tasks that don't fit above (gitignore, editor config)

Decision rules for ambiguous cases:

  • New file with a function → feat (new capability), not chore
  • Bug fix that also refactors → fix (the primary intent matters)
  • Test added alongside a feature → feat (the feature is the main change)
  • Dependency update to fix a vulnerability → fix, not build
  • Renaming a public API method → refactor with BREAKING CHANGE footer

3. Identify the scope

The scope is the module, component, or area affected. It goes in parentheses: type(scope): ...

How to determine scope:

  • If all changes are in one directory/module → use that name (e.g., auth, api, parser)
  • If changes span a single feature across files → use the feature name (e.g., login, search)
  • If changes are too broad to name → omit the scope: type: description

Scope should be a single lowercase word or hyphenated phrase. Never use file paths as scope.

4. Write the subject line

The subject line is the most important part. Follow these rules strictly:

  1. Use imperative mood — "add feature" not "added feature" or "adds feature". Write as if completing the sentence: "If applied, this commit will ___."
  2. 50 characters or fewer — Hard limit. Count the ENTIRE first line including type(scope):. For example, feat(auth): add login endpoint is 31 characters. If you're over 50, shorten the description or move details to the body.
  3. No period at the end — It wastes a character and is unconventional.
  4. Lowercase first letter after the colonfeat(auth): add login endpoint not feat(auth): Add login endpoint.
  5. Be specific — "fix null pointer in user lookup" not "fix bug".
  6. Verify before outputting — Count the characters of your subject line. If it's close to 50, recount. It's better to be at 45 than to risk going over.

5. Write the body (if needed)

Add a body when the subject line alone doesn't explain WHY the change was made. Separate from subject with a blank line.

Include a body when:

  • The change is non-obvious (why this approach?)
  • There's important context (related issue, design decision)
  • The diff is large (summarize what changed and why)

Body rules:

  • Wrap at 72 characters per line
  • Explain motivation and contrast with previous behavior
  • Use bullet points for multiple related changes

Skip the body when:

  • The change is self-explanatory (e.g., fix(typo): correct spelling in README)
  • The subject line fully captures the intent

6. Add breaking change footer (if needed)

If the commit introduces a breaking change (removes/renames a public API, changes behavior that consumers depend on), add a footer:

BREAKING CHANGE: <description of what breaks and migration path>

Rules:

  • BREAKING CHANGE must be uppercase, followed by a colon and space
  • Describe what breaks AND how to migrate
  • Alternatively, add ! after the type/scope: feat(api)!: remove v1 endpoints
  • Both notations can be used together for maximum visibility

Examples

Example 1: Simple feature addition

Diff:

diff --git a/src/utils/validators.ts b/src/utils/validators.ts
index 1a2b3c4..5d6e7f8 100644
--- a/src/utils/validators.ts
+++ b/src/utils/validators.ts
@@ -15,6 +15,18 @@ export function validateEmail(email: string): boolean {
   return EMAIL_REGEX.test(email);
 }

+export function validatePhoneNumber(phone: string): boolean {
+  // E.164 format: +[country code][number], 7-15 digits
+  const E164_REGEX = /^\+[1-9]\d{6,14}$/;
+  if (!phone) return false;
+  return E164_REGEX.test(phone);
+}

Output:

feat(validators): add phone number validation

Support E.164 format phone number validation for international
numbers. Returns false for empty strings and invalid formats.

Example 2: Bug fix with breaking change

Diff:

diff --git a/src/api/users.ts b/src/api/users.ts
--- a/src/api/users.ts
+++ b/src/api/users.ts
@@ -8,8 +8,8 @@ import { db } from '../db';
-export async function getUser(id: string): Promise<User | null> {
-  return db.users.findOne({ id });
+export async function getUser(id: string): Promise<User> {
+  const user = db.users.findOne({ id });
+  if (!user) throw new NotFoundError(`User ${id} not found`);
+  return user;
 }

Output:

fix(api): throw NotFoundError instead of returning null

getUser() previously returned null for missing users, which caused
silent failures downstream. Now throws NotFoundError with the user
ID for proper error handling.

BREAKING CHANGE: getUser() no longer returns null. Callers using
null checks must switch to try/catch with NotFoundError.

Example 3: Multi-file refactor

Diff (abbreviated):

diff --git a/src/services/payment.ts b/src/services/payment-processor.ts
similarity index 85%
rename from src/services/payment.ts
rename to src/services/payment-processor.ts

diff --git a/src/services/order.ts b/src/services/order.ts
-import { processPayment } from './payment';
+import { processPayment } from './payment-processor';

diff --git a/src/routes/checkout.ts b/src/routes/checkout.ts
-import { processPayment } from '../services/payment';
+import { processPayment } from '../services/payment-processor';

Output:

refactor(services): rename payment module to payment-processor

Rename for clarity since this module handles payment processing
specifically, not payment models or types. Updated all import
paths across order service and checkout routes.

Common mistakes

Mistake Fix
Using past tense ("added feature") Use imperative mood ("add feature") — pretend the sentence starts with "This commit will..."
Subject line over 50 characters Shorten aggressively. Move details to the body.
Wrong type for ambiguous changes Ask: "What is the PRIMARY intent?" A fix that refactors is still a fix.
Using file paths as scope Use the module/feature name instead: auth not src/middleware/auth.ts
Missing BREAKING CHANGE footer Any public API change (signature, return type, removed method) needs this footer
Vague subject ("fix bug", "update code") Be specific: "fix null pointer in user lookup", "update rate limit to 100 req/s"
Capitalizing first word after colon Lowercase: feat: add thing not feat: Add thing
Adding a period at the end No period. feat: add thing not feat: add thing.
Combining unrelated changes in one commit Each commit should be one logical change. Suggest splitting if the diff has unrelated changes.

Quick reference

<type>(<scope>): <subject>     ← 50 chars max for full line
                                ← blank line
<body>                          ← 72 chars per line, explain WHY
                                ← blank line
<footer>                        ← BREAKING CHANGE: description

Types: feat | fix | refactor | docs | test | perf | style | build | ci | chore

Imperative mood test: "If applied, this commit will <subject>"

Scope: Single lowercase word for the affected module. Omit if too broad.

Key principles

  1. The diff is the source of truth — Always read git diff --cached before writing. Never assume what changed based on conversation context alone.
  2. Imperative mood, always — "add", "fix", "remove", "update" — never past tense or third person. This matches git's own conventions (Merge branch, Revert commit).
  3. One logical change per commit — If the diff contains unrelated changes, suggest the user split them into separate commits before writing the message.
  4. Subject line ≤ 50 characters — This is a hard limit, not a guideline. It ensures readability across all git tooling. Move details to the body.
  5. Breaking changes must be explicit — Any change to a public API (signature, return type, removed export) requires a BREAKING CHANGE: footer. This drives semantic versioning — missing it causes silent breaking releases.