关于 commit
commit 是为 Sentry 项目规定提交信息格式的技能,涵盖标题结构、类型、主题与正文规则、问题引用方式,以及常见变更示例。
主要功能
- 01必需标题格式与可选范围
- 02提交类型定义
- 03主题和正文撰写规则
- 04问题引用页脚格式
- 05撤销与破坏性变更示例
适用场景
- 01撰写 Sentry 错误修复提交
- 02描述带范围的功能变更
- 03在提交页脚引用问题
- 04规范撤销或破坏性变更格式
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ davila7/ claude-code-templates --skill commit安装后在 Claude Code 中输入/commit确认已加载。
详细介绍
Sentry 提交信息
为 Sentry 项目创建提交时,请遵循以下约定。
格式
<type>(<scope>): <subject>
<body>
<footer>
标题为必填项。范围(Scope)为可选项。所有行必须保持在 100 个字符以内。
提交类型
| 类型 | 用途 |
|---|---|
feat | 新功能 |
fix | 缺陷修复 |
ref | 重构(不改变行为) |
perf | 性能改进 |
docs | 仅文档 |
test | 新增或修正测试 |
build | 构建系统或依赖 |
ci | CI 配置 |
chore | 维护任务 |
style | 代码格式化(不改变逻辑) |
meta | 仓库元数据 |
license | 许可证变更 |
主题行规则
- 使用祈使语气、一般现在时:"Add feature" 而非 "Added feature"
- 首字母大写
- 结尾不加句号
- 最多 70 个字符
正文指南
- 解释是什么和为什么,而非如何做
- 使用祈使语气和一般现在时
- 包含变更的动机
- 在相关时与之前的行为进行对比
页脚:问题引用
在页脚中使用以下模式引用问题:
Fixes GH-1234
Fixes #1234
Fixes SENTRY-1234
Refs LINEAR-ABC-123
Fixes在合并时关闭该问题Refs仅链接而不关闭
示例
简单修复
fix(api): Handle null response in user endpoint
The user API could return null for deleted accounts, causing a crash
in the dashboard. Add null check before accessing user properties.
Fixes SENTRY-5678
带范围的功能
feat(alerts): Add Slack thread replies for alert updates
When an alert is updated or resolved, post a reply to the original
Slack thread instead of creating a new message. This keeps related
notifications grouped together.
Refs GH-1234
重构
ref: Extract common validation logic to shared module
Move duplicate validation code from three endpoints into a shared
validator class. No behavior change.
破坏性变更
feat(api)!: Remove deprecated v1 endpoints
Remove all v1 API endpoints that were deprecated in version 23.1.
Clients should migrate to v2 endpoints.
BREAKING CHANGE: v1 endpoints no longer available
Fixes SENTRY-9999
回滚格式
revert: feat(api): Add new endpoint
This reverts commit abc123def456.
Reason: Caused performance regression in production.
原则
- 每个提交应当是单一、稳定的变更
- 提交应当可独立审查
- 每次提交后,仓库应处于可正常工作状态
参考
评论
支持 Markdown