AI Skill Report Card
Writing Conventional Commits
Quick Start
Bashfeat(auth): 添加用户登录功能 实现基于JWT的用户认证系统,包括登录、注册和token刷新功能
Recommendation▾
Add the 8 commit types explicitly in the workflow or reference section (feat, fix, docs, style, refactor, perf, test, chore) rather than just mentioning '8个类型'
Workflow
- 确定变更类型 - 从8个类型中选择最适合的
- 识别影响范围 - 确定scope(可选但推荐)
- 写简洁主题 - 中文描述,不超过50字
- 添加详细说明 - body部分解释原因(可选)
- 标注破坏性变更 - 如有Breaking Change必须说明
Progress:
- 选择type类型
- 确定scope范围
- 编写subject主题
- 添加body说明(如需要)
- 检查格式规范
Recommendation▾
Include a complete format template showing the structure: type(scope): subject\n\nbody\n\nfooter
Examples
Example 1:
Input: 修复了用户头像上传失败的问题
Output: fix(user): 修复头像上传失败问题
Example 2: Input: 新增了商品搜索功能,支持按分类和价格筛选 Output:
feat(product): 添加商品搜索功能
支持按分类、价格区间和关键词进行商品筛选,提升用户购物体验
Example 3:
Input: 重构了数据库连接模块,提升了性能
Output: refactor(db): 重构数据库连接模块以提升性能
Example 4:
Input: 更新了API文档
Output: docs(api): 更新接口文档
Recommendation▾
Add examples of breaking changes with BREAKING CHANGE footer since it's mentioned but not demonstrated
Best Practices
-
Type选择原则:
- 用户可见的新功能用
feat - 修复任何bug用
fix - 纯文档变更用
docs - 代码重构用
refactor
- 用户可见的新功能用
-
Scope命名:
- 使用项目中的模块名:
auth,user,product,api - 保持一致性,建立团队约定
- 可以省略,但建议添加
- 使用项目中的模块名:
-
Subject撰写:
- 使用祈使句:"添加"而不是"已添加"
- 首字母无需大写
- 描述做了什么,而不是为什么
-
Body使用时机:
- 复杂变更需要解释背景
- Breaking changes必须说明
- 包含重要的技术决策
Common Pitfalls
- ❌ 主题超过50字:
feat(user): 添加用户管理系统包括用户注册登录权限管理角色分配等完整功能模块 - ❌ 类型错误:
update(api): 修复接口bug(应该用fix) - ❌ 中英混杂:
fix(user): fix用户登录bug - ❌ 句号结尾:
feat(auth): 添加登录功能。 - ❌ scope大写:
feat(API): 添加新接口 - ❌ 过于简单:
fix: 修复(缺少具体描述)