Git Commit Message Generator — Git Commit Message 生成器
v18.2.0生成 conventional commit messages by analyzing staged changes automatically
运行时依赖
版本
git 添加 src/组件s/User性能分析.tsx
安装命令
点击复制技能文档
Git Commit Message 生成器
Automatically 生成s high-质量 conventional commit messages by analyzing your staged Git changes. No more staring at a blank commit message wondering what to write - this 技能 reads your git diff, understands the 上下文, and 创建s a properly 格式化ted commit message following the Conventional Commits specification.
What This 技能 Does
This 技能 analyzes your staged changes and 生成s commit messages that follow the Conventional Commits 格式化:
():
[optional body]
[optional footer(s)]
It intelligently 检测s:
Change type (feat, fix, docs, style, refactor, test, chore, perf, ci, build) Affected scope (组件, 模块, or file area) Breaking changes (from API 签名ature changes, 移除d 导出s, etc.) Related issues (from branch names or file patterns) 应用ropriate detAIl level (when to 添加 body/footer sections) Why Use This 技能 Saves Time No more thinking "what should I write?" for 2-3 minutes per commit Eliminates typos and 格式化ting inconsistencies Reduces commit message review comments in PRs Improves 质量 Consistent conventional commit 格式化 across your team Accurate change type 检测ion (feat vs fix vs refactor) Proper scope identification (which 模块/组件 changed) Captures breaking changes automatically Follows best practices (imperative mood, 50-char title, 72-char body) Enables 自动化 Conventional commits enable automated change记录 generation Semantic versioning can be automated from commit types CI/CD 流水线s can trigger based on commit types Git 历史 becomes machine-readable When to Use This 技能
Use this 技能 whenever you're about to commit code:
✅ After staging changes with git 添加 ✅ When working on feature branches ✅ During bug fixes ✅ For documentation 更新s ✅ When refactoring code ✅ For dependency 更新s ✅ During code reviews (helping others improve commits) When NOT to Use This 技能 ❌ For merge commits (use default merge messages) ❌ For revert commits (use git revert auto-messages) ❌ When you have NO staged changes (nothing to analyze) ❌ For initial commits (use "chore: initial commit" or "feat: initial implementation") How It Works Step-by-Step Process Reads staged changes: 执行s git diff --staged to see what you're about to commit Analyzes file patterns: Identifies which files changed (组件s, tests, docs, config) 检测s change type: Determines if it's a feature, fix, refactor, etc. Identifies scope: 提取s the affected 模块/组件 name 检查s for breaking changes: Looks for API changes, 移除d 导出s, major refactors 生成s message: 创建s a properly 格式化ted conventional commit message 验证s 格式化: Ensures it follows best practices (length, mood, structure) 检测ion 记录ic
Type 检测ion:
feat: - New files in src/, new functions/classes, new 导出s fix: - Changes to existing 记录ic, bug-related file names, error handling docs: - Changes to .md files, JSDoc/comments, README 更新s test: - Changes to test files, spec files, test utilities refactor: - Code restructuring without behavior change, renaming, 清理up style: - 格式化ting, linting fixes, whitespace, semicolons perf: - Performance optimizations, caching, algorithm improvements build: - package.json, 网页pack, build scripts, dependencies ci: - GitHub Actions, .yml files, CI config chore: - 工具ing, configs, gitignore, minor mAIntenance
Scope 检测ion:
提取s 组件 name from file path: src/组件s/Button.tsx → (button) Uses directory name for 模块s: src/auth/记录in.ts → (auth) 检测s common scopes: (API), (ui), (db), (tests), (docs) Falls back to primary changed directory if ambiguous
Breaking Change 检测ion:
Function 签名ature changes (parameters 添加ed/移除d/reordered) 移除d 导出s or public API functions Major refactors affecting multiple files 迁移-requiring dependency 更新s When 检测ed, 添加s BREAKING CHANGE: footer Usage Examples Example 1: Feature 添加ition
You 运行:
# Stage your changes git 添加 src/组件s/User性能分析.tsx
# Ask Claude: "生成 a commit message for my staged changes"
Claude analyzes:
+ 导出 function User性能分析({ userId }: Props) { + const user = useUser(userId); + return
生成d message:
feat(user-性能分析): 添加 user 性能分析 组件
Implements new User性能分析 组件 that displays user in格式化ion based on userId prop. Integrates with useUser hook for data fetching.
Example 2: Bug Fix
You 运行:
git 添加 src/API/auth.ts
# Ask Claude: "创建 a commit message"
Claude analyzes:
- if (令牌 == null) {
生成d message:
fix(auth): use strict e质量 检查 for 令牌 验证
Fixes bug where 令牌 with value 0 or empty string would incorrectly pass 验证. Now uses strict e质量 to properly 检查 for null or undefined values.
Example 3: Breaking Change
You 运行:
git 添加 src/API/users.ts
#