commit-work
它能做什么
这项技能帮你的智能体准备易于审查的 git 提交。适合希望每次提交只包含预定改动,并且提交信息清楚描述这些改动的开发者。
适用场景
- ✓当你想提交工作成果,并需要先审查改动并正确暂存时。
- ✓当你的改动混合了几项无关任务,应拆分为独立的提交时。
- ✓当你想要 Conventional Commits 格式的提交信息的时候。
技能链接
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/productivity/commit-work/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我提交改动,但把重构和新功能拆分成两个独立的提交,并写清楚提交信息。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会检查工作区,判断每次提交的起点和终点,只暂存应属于该提交的内容,检查暂存差异中是否有机密信息或调试代码,然后编写提交信息。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Commit work
Goal
Make commits that are easy to review and safe to ship:
- only intended changes are included
- commits are logically scoped (split when needed)
- commit messages describe what changed and why
Inputs to ask for (if missing)
- Single commit or multiple commits? (If unsure: default to multiple small commits when there are unrelated changes.)
- Commit style: Conventional Commits are required.
- Any rules: max subject length, required scopes.
Workflow (checklist)
- Inspect the working tree before staging
git statusgit diff(unstaged)- If many changes:
git diff --stat
- Decide commit boundaries (split if needed)
- Split by: feature vs refactor, backend vs frontend, formatting vs logic, tests vs prod code, dependency bumps vs behavior changes.
- If changes are mixed in one file, plan to use patch staging.
- Stage only what belongs in the next commit
- Prefer patch staging for mixed changes:
git add -p - To unstage a hunk/file:
git restore --staged -porgit restore --staged <path>
- Prefer patch staging for mixed changes:
- Review what will actually be committed
git diff --cached- Sanity checks:
- no secrets or tokens
- no accidental debug logging
- no unrelated formatting churn
- Describe the staged change in 1-2 sentences (before writing the message)
- "What changed?" + "Why?"
- If you cannot describe it cleanly, the commit is probably too big or mixed; go back to step 2.
- Write the commit message
- Use Conventional Commits (required):
type(scope): short summary- blank line
- body (what/why, not implementation diary)
- footer (BREAKING CHANGE) if needed
- Prefer an editor for multi-line messages:
git commit -v - Use
references/commit-message-template.mdif helpful.
- Use Conventional Commits (required):
- Run the smallest relevant verification
- Run the repo's fastest meaningful check (unit tests, lint, or build) before moving on.
- Repeat for the next commit until the working tree is clean
Deliverable
Provide:
- the final commit message(s)
- a short summary per commit (what/why)
- the commands used to stage/review (at minimum:
git diff --cached, plus any tests run)
常见问题
如果一个文件的改动属于两次提交怎么办?
这项技能使用分块暂存,让你只暂存文件中的部分改动。
提交前它会检查什么?
它会检查机密信息或令牌、误留的调试日志,以及无关的格式改动。
它使用哪种提交格式?
Conventional Commits,这是这项技能要求的格式。
详情
作者的原始描述
Create high-quality git commits: review/stage intended changes, split into logical commits, and write clear commit messages (including Conventional Commits). Use when the user asks to commit, craft a commit message, stage changes, or split work into multiple commits.
热度
- GitHub 星标
- 33k
- 排名
- #8878
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
owasp-security
33k教你的智能体掌握面向网页应用、API、移动端、容器和 AI 智能体的 OWASP 安全指南,以便发现常见弱点并提出修复建议。
agent-management
33k让你的智能体使用 AI Maestro 命令行工具创建、列出、休眠、唤醒、重命名和删除 AI 智能体,管理每个智能体的生命周期。
agent-messaging
33k让你的智能体使用智能体消息协议,在 AI 智能体之间发送、接收和回复带签名的消息,大部分在你自己的电脑上完成。
docs-search
33k让你的智能体搜索自动生成的代码文档,查找函数签名、类定义和注释,从而在修改代码之前核对真实的 API。