AgentSkillsCN

commit

在创建 Git 提交时强制遵循 Conventional Commits 格式。每当您需要撰写提交信息时,都可使用此技能。触发关键词包括:“commit”、“git commit”、“コミット”、“変更をコミット”。

SKILL.md
--- frontmatter
name: commit
description: Enforces Conventional Commits format when creating git commits. Use this skill whenever you need to create a commit message. Triggers on "commit", "git commit", "コミット", "変更をコミット".

Conventional Commit

Enforces Conventional Commits format for all git commit messages. This skill applies to both AI agents and human users.

Commit Message Format

code
<type>[optional scope][optional !]: <description>

[optional body]

[optional footer(s)]

Types (Required)

TypeDescription
featA new feature
fixA bug fix
docsDocumentation only changes
styleChanges that do not affect the meaning of the code (white-space, formatting, etc.)
refactorA code change that neither fixes a bug nor adds a feature
perfA code change that improves performance
testAdding missing tests or correcting existing tests
buildChanges that affect the build system or external dependencies
ciChanges to CI configuration files and scripts
choreOther changes that don't modify src or test files
revertReverts a previous commit

Scope (Optional)

Scope provides additional context. Determine scope by checking recent commits:

bash
git log --oneline -10

Common scope patterns:

  • Feature/module name: feat(auth):, fix(api):
  • File/directory: docs(readme):, refactor(utils):
  • Component: style(button):, test(login):

Breaking Changes

Add ! before the colon for breaking changes:

code
feat(api)!: change authentication endpoint

Or add BREAKING CHANGE: in the footer.

Examples

Basic (No Scope)

code
feat: add user registration form
fix: resolve memory leak in event handler
docs: update installation instructions

With Scope

code
feat(auth): implement OAuth2 login
fix(api): handle null response from server
refactor(utils): simplify date formatting logic

With Body (Japanese)

code
feat(検索): 全文検索機能を追加

Elasticsearchを使用した全文検索機能を実装。
日本語形態素解析にはkuromojiを使用。

Breaking Change

code
feat(api)!: change response format to JSON:API

BREAKING CHANGE: API responses now follow JSON:API specification.
Clients need to update their response parsers.

Validation

To validate a commit message before committing:

bash
bash /mnt/skills/user/conventional-commit/scripts/validate-commit.sh "feat: add new feature"

For AI Agents

When creating commits:

  1. Always use Conventional Commits format
  2. Check recent commits for scope patterns: git log --oneline -10
  3. Use the appropriate type based on the change
  4. Do NOT use emojis in commit messages
  5. Write clear, concise descriptions
  6. Add body for complex changes
  7. Mark breaking changes with ! or BREAKING CHANGE:

Language

  • Use the same language as the codebase or user's preference
  • Japanese descriptions are fully supported
  • Keep type prefixes in English (feat, fix, etc.)

Git Hooks (Optional)

To enforce validation via git hooks, add to .git/hooks/commit-msg:

bash
#!/bin/bash
bash /mnt/skills/user/conventional-commit/scripts/validate-commit.sh "$(cat $1)" || exit 1