[ PROMPT_NODE_24818 ]
Git Commit Helper
[ SKILL_DOCUMENTATION ]
# Git 提交助手
## 快速开始
分析暂存的更改并生成提交信息:
bash
# 查看暂存的更改
git diff --staged
# 基于更改生成提交信息
# (Claude 将分析 diff 并建议一条信息)
## 提交信息格式
遵循 Conventional Commits 格式:
():
[optional body]
[optional footer]
### 类型
- **feat**: 新功能
- **fix**: 错误修复
- **docs**: 文档更改
- **style**: 代码样式更改(格式化、缺少分号等)
- **refactor**: 代码重构
- **test**: 添加或更新测试
- **chore**: 维护任务
### 示例
**功能提交:**
feat(auth): add JWT authentication
Implement JWT-based authentication system with:
- Login endpoint with token generation
- Token validation middleware
- Refresh token support
**错误修复:**
fix(api): handle null values in user profile
Prevent crashes when user profile fields are null.
Add null checks before accessing nested properties.
**重构:**
refactor(database): simplify query builder
Extract common query patterns into reusable functions.
Reduce code duplication in database layer.
## 分析更改
审查正在提交的内容:
bash
# 显示已更改的文件
git status
# 显示详细更改
git diff --staged
# 显示统计信息
git diff --staged --stat
# 显示特定文件的更改
git diff --staged path/to/file
## 提交信息指南
**建议:**
- 使用祈使语气(“add feature” 而不是 “added feature”)
- 第一行保持在 50 个字符以内
- 首字母大写
- 摘要末尾不加句号
- 在正文中解释“为什么”而不仅仅是“是什么”
**禁止:**
- 使用模糊的信息,如“update”或“fix stuff”
- 在摘要中包含技术实现细节
- 在摘要行中编写段落
- 使用过去时
## 多文件提交
当提交多个相关更改时:
refactor(core): restructure authentication module
- Move auth logic from controllers to service layer
- Extract validation into separate validators
- Update tests to use new structure
- Add integration tests for auth flow
Breaking change: Auth service now requires config object
## 作用域示例
**前端:**
- `feat(ui): add loading spinner to dashboard`
- `fix(form): validate email format`
**后端:**
- `feat(api): add user profile endpoint`
- `fix(db): resolve connection pool leak`
**基础设施:**
- `chore(ci): update Node version to 20`
- `feat(docker): add multi-sta