Git 提交信息与 PR 描述规范
git-message-style
Vlad 个人编写提交信息和 PR 描述的约定——主题格式、正文规则、词汇用法和 PR 正文结构。在 Vlad 的个人仓库(而非有自身约定的团队仓库)中编写提交信息或 PR 描述时使用。
- License 许可
- MIT
- 所属仓库
- gurdiga/dotfiles
- 最近更新
- 2026-10-10
- Stars
- ★ 3
- Forks
- 0
01 前言 Front Matter
- name
- git-message-style
- description
- Vlad's personal conventions for writing commit messages and PR descriptions — subject shape, body rules, vocabulary, and PR body structure. Use when writing a commit message or a PR description in one of Vlad's personal repos (not a team repo with its own convention).
03 SKILL.md 正文
Commit Messages
Where a repo has its own convention — a repo-local CLAUDE.md, or a house style plainly visible in git log — that wins. What follows is my default, measured over my own projects; don't impose it on a team repo.
Do not include the "? Generated with Claude Code" footer in commit messages.
Include Co-Authored-By: Claude <model> <noreply@anthropic.com> as a trailer, naming the model that actually wrote the commit. GitHub squash merges silently drop these, so a trailerless commit on a default branch is not proof of unassisted authorship.
When a tool or a person found the problem a commit fixes but wrote none of the fix, credit them with a Reported-by: trailer, above Co-Authored-By. For a finding from a Codex review that is Reported-by: Codex <noreply@openai.com>: the standard Name <email> form, with the identity the codex CLI itself uses for commit attribution. Not Co-Authored-By, which claims authorship, and not Reviewed-by, which says the reviewer approved this very patch. The trailer replaces a prose line such as “Found by a Codex review”.
When squash-merging a PR, keep the (#N) suffix GitHub puts on the subject — Close the SSRF in checkFeedUrl (#11) — because GitHub autolinks it, and that is the shortest way back from git log to the PR. Overriding the subject with gh pr merge --squash --subject drops it, so append it by hand; the trailer has to be passed explicitly there too.
Shape
- Usually the subject line and nothing else. Fewer than one commit in ten of mine has a body. Add one only when there is a why the diff cannot show. The trailer is not body prose.
- Keep the subject near 30 characters. Fifty is a ceiling nobody approaches, not a target.
- Prefix with a scope and a colon about half the time. The scope names whatever changed: a directory (
web-ui/shared:), a container (smtp-in:), a function (makeRssItem:), a filename (docker-compose.yml:), a Make target (make backup:), or a feature by its display name. Nesting is fine:delmon: heartbeat: add lineCountDiff. - Lowercase after the scope.
web-ui: no demoAccountNote, notweb-ui: No demoAccountNote. - Never end the subject with a period.
- Write a fragment, not a sentence. Telegraphic noun phrases (
app: no NPM_VERSION) and the literal command that was run (npm i cheerio@latest,mv {parse,make}Date) are as common as verb-initial subjects.
Bodies, when there is one
-
Blank line after the subject, then a subordinate clause finishing the subject as one sentence.
Because …is the usual opener;Otherwise …gives the same construction from the failure side. -
Rationale, never enumeration. The subject says what changed; the body says why, or what breaks otherwise, or which obvious alternative was rejected. Don't list the files touched.
-
Prose, not bullets. Pasted evidence — terminal output, error text — is exempt from this and from the wrap: introduce it with a line ending in a colon and paste it verbatim, unreflowed.
-
Wrap the body at 72 columns, counting characters, not bytes — em dashes and curly quotes are multi-byte, so
wc -cand macOSawkboth overstate, and a byte-based reflow mangles lines that were already fine. Thecommit-msghook ingit-hooks/enforces this. To check a message by hand, which should print nothing:git log -1 --format=%B | perl -CSD -ne 'chomp; printf "%d: %s\n", length($_), $_ if length($_) > 72' -
First person is normal. This is a personal log, not a changelog entry.
Vocabulary
- Curly apostrophes; no em dashes.
- My idioms:
intro Xfor a new function or module (never "introduce"),mv A Bfor a rename,no Xfor a removal,sketchfor exploratory work,tweakfor a small adjustment, a(2)/(3)suffix for a fix that needed retrying. - No Conventional Commits, no
[bracket]prefixes, no changelog verbs (refactor,chore,feat,implement,enhance,ensure) — in my own projects; team repos may require exactly these. - Don't reach for
Housekeeping. A dead habit of mine that still litters my older history.
Examples
The modal commit — a scoped, lowercase subject and nothing else:
logrotate: dateext
Co-Authored-By: Claude <model> <noreply@anthropic.com>
The rare body, in full:
make certbot-report update
Because logs are now rotated monthly.
Co-Authored-By: Claude <model> <noreply@anthropic.com>
Pull Request Descriptions
A PR body is a different register from a commit message: the commit is a note to my future self with the diff attached, the PR is a letter to someone who hasn’t looked yet. Longer and more explanatory than a commit — but that’s a default, not licence to pad.
- Always write a body, even if it is one line.
- Aim short — a paragraph or two. A couple of hundred characters of prose is typical for me; four thousand is not thorough, it’s unreadable.
- Follow the repo’s PR template if it has one, and add nothing beyond it. Where there is none, don’t invent a reusable one — no standing
## Summary/## Test planscaffolding. If a header earns its place, make it specific to that PR and use it only there. - Lead with rationale in prose: why this, what breaks otherwise, which obvious alternative was rejected and why. Never enumerate the files changed — the diff does that.
- Prose over bullets in the explanatory part. Bullets are for genuinely parallel items, not for chopping an argument into fragments.
- Paste evidence verbatim — terminal output, error text, logs — after a lead-in line ending in a colon, in a fenced block, unreformatted.
- Don’t open with
Because …— that construction belongs in commit bodies. - Backticks around identifiers are welcome here, unlike in commit subjects.
- Go light on decoration: curly quotes as everywhere else; em dashes about one PR in ten, not one per paragraph; bold and tables roughly one PR in twenty.
weis fine here, where commits useI.- Titles: capitalized, around 40 characters, no terminal period. Follow the repo’s prefix convention; where there is none, brackets are status labels (
[WIP],[POC]), not area tags.
04 同仓库更多 Skills
Claude Code 技能编写
write-skill
创建或改进 Claude Code Agent Skill(SKILL.md)。当用户要求将某个工作流沉淀为技能、创建可重用技能,或将我们刚一起完成的工作变成技能时使用。
SSH 持久连接复用
ssh-controlmaster
当对同一远程主机运行多个命令时,通过 ControlMaster 使用持久 SSH 连接,以避免重复的认证开销。在要对一台主机连续运行多个 ssh 命令时使用。
会话复盘与 CLAUDE.md 优化
reflect
分析当前项目最近的会话记录,并提出 CLAUDE.md 改进建议。每月手动调用一次,或在完成大量工作后调用。
方案质询与决策压力测试
grill-me
就某个计划或设计对用户进行不懈的追问,直到达成共识,解决决策树的每个分支。当用户想要对计划进行压力测试、接受对其设计的质询,或提到 "grill me" 时使用。
Ruby Gem 安全漏洞修复
gem-security-update
修复 Ruby gems 的 Dependabot 安全告警。当用户分享 GitHub Dependabot URL、要求修复 gem 漏洞,或提到需要版本升级的 gem CVE 时使用。
对话导出为 Markdown
export-conversation
将当前对话导出为 markdown 文件。当用户要求将对话"导出"、"保存"或"写入"文件,或说出"export this conversation to X.md"之类的话时使用。