本文へスキップ
Skillpedia
一般的なプログラミング33k · #8853

commit-smart

できること

このスキルは、実際のコードの変更から、エージェントがGitのコミットメッセージを書くのに役立ちます。一貫性があり、意味のあるコミット履歴を持ちたい開発者向けです。

使う場面

  • ✓変更の準備ができており、そのためにわかりやすいコミットメッセージを書いてほしいとき。
  • ✓規則を覚えずに、Conventional Commitsの形式に従いたいとき。
  • ✓関連するファイルを、論理的なコミットにまとめたいとき。

スキルのリンク

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/git/commit-smart/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/git/commit-smart/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“ステージされた変更を確認し、なぜその変更をしたのかを説明する、Conventional Commitsのコミットメッセージを作ってください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、git statusとステージされた差分を確認し、変更されたファイルからコミットの種類とスコープを選びます。変更の理由に焦点を当てたメッセージを書きます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Smart Commit

Create meaningful conventional commits by analyzing your actual changes.

Workflow

Step 1: Assess the working tree

Run these commands to understand the current state:

git status
git diff --stat
git diff --cached --stat

Step 2: Handle unstaged changes

If nothing is staged (git diff --cached is empty):

  1. Show the user what files have changed
  2. Suggest what to stage based on logical grouping (e.g., "these 3 files are all related to the auth refactor")
  3. Ask if they want to stage all, or select specific files
  4. Stage the approved files with git add <files>

If changes are already staged, proceed to analysis.

Step 3: Analyze the diff

Read the full staged diff:

git diff --cached

Determine the commit type from the changes:

Signal Type
New files with new functionality feat
New test files or test additions test
Changes to existing logic fixing incorrect behavior fix
Structural changes without behavior change refactor
package.json, tsconfig, CI config changes chore
Build/bundler config changes build
README, docs, comments only docs
Formatting, whitespace, semicolons only style
Performance improvements perf

Determine the scope from the primary directory or module affected:

  • src/api/ -> api
  • src/components/auth/ -> auth
  • tests/ -> tests
  • Root config files -> omit scope
  • Multiple unrelated areas -> omit scope

Step 4: Check for user overrides

If the user provided arguments via $ARGUMENTS:

  • Single word (e.g., fix) -> use as commit type
  • Two words (e.g., refactor api) -> use as type and scope
  • Otherwise -> use auto-detected values

Step 5: Compose the commit message

Format: type(scope): imperative short description

Rules:

  • Subject line max 72 characters
  • Use imperative mood ("add", "fix", "refactor", not "added", "fixes")
  • Don't end with a period
  • Body explains WHY this change was made, not what changed (the diff shows what)
  • If changes are trivial (typo fix, formatting), skip the body

Example:

feat(auth): add JWT refresh token rotation

Tokens were expiring mid-session for users with slow connections.
Rotating refresh tokens extends the session without compromising
security, since each refresh token can only be used once.

Step 6: Confirm and commit

Show the user the proposed commit message and ask for confirmation.

If confirmed, run:

git commit -m "<message>"

Then verify with:

git log --oneline -1

Show the committed hash and message.

Tips

  • Run after completing a logical unit of work, not after every file change
  • If the diff is too large for one commit, suggest splitting into multiple commits
  • For breaking changes, add ! after the scope: feat(api)!: change response format
  • The body should answer "if someone reads this commit in 6 months, will they understand WHY?"
よくある質問

Conventional Commitとは何ですか?

featやfixなどの種類で始まり、任意でスコープを付ける、標準的なメッセージの形式です。

何もステージされていない場合はどうなりますか?

変更されたファイルを表示し、論理的なまとめ方を提案して、どのファイルをステージするかを尋ねます。

種類を自分で選べますか?

はい。fixやrefactor apiなどの種類とスコープを指定して、メッセージを誘導できます。

詳細

作者による元の説明

Analyze staged/unstaged changes and create semantic conventional commits with context about WHY, not just WHAT. Auto-detects commit type and scope from the diff. Supports optional type/scope arguments. Usage - /commit-smart, /commit-smart fix, /commit-smart refactor api

repo: davila7/claude-code-templates

人気

GitHubのスター
33k
ランキング
#8853
ライセンス
MIT
更新日
2026/11/2

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル