commit-craft
它能做什么
这项技能把大量混杂的修改规划成一系列小而专注的 git 提交。适合希望提交内容便于审查、回滚和理解的开发者。
适用场景
- ✓当你有大量混合的修改、想按逻辑分组提交的时候。
- ✓当你即将推送、想检查暂存的修改中是否含有密钥或 .env 文件的时候。
- ✓当你需要为某项修改撰写清晰、规范的提交信息时。
技能链接
https://github.com/alirezarezvani/claude-skills/blob/main/engineering/commit-craft/skills/commit-craft/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的仓库里有大量混合修改。请把它们拆分为清晰的提交,并检查暂存区没有敏感内容。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会把文件按逻辑分组为提交,并建议它们的顺序,然后对暂存的内容进行密钥检查,并检查提交信息格式。每组何时暂存和提交由你决定。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Commit Craft
Portability: 3 stdlib Python scripts that call
gitread-only. No network. The scripts never stage, commit or push. You do, one group at a time, after the gate passes.
Agents leave large mixed diffs: a feature, a reformat, a dependency bump and a
stray .env, all in one tree. Committed as one blob, that diff cannot be
reviewed, reverted or bisected. This skill turns it into a series where each
commit is one logical change, builds on its own, holds no secrets and says why.
Workflow
# 1 - Plan: which commits, in which order, staged how?
python scripts/commit_planner.py # working tree vs HEAD, untracked included
# 2 - For each group: stage exactly its files, then gate what is staged
git add -- <files of group N> # or git add -p for MIXED_FORMATTING files
python scripts/secret_gate.py # blocks before the commit exists
# 3 - Write the message, lint it, commit
python scripts/message_linter.py -m "<message>" --staged && git commit -m "<message>"
# 4 - Before push: the whole series, and proof every commit builds
python scripts/message_linter.py --range @{upstream}..HEAD
git rebase -x "<test command>" @{upstream}
Step 1 groups files: manifest with lockfile, pure moves, whitespace-only
files, each module's changes with their tests, then docs and CI. It holds back
.env, keys and tfstate (exit 4), flags files that mix formatting with real
hunks, and flags a move whose callers' import edits sit in another group, since
that commit would not build. It never picks feat vs fix: decide from what the change does.
Step 2 scans only the added lines of what is staged: provider-shaped
tokens, high-entropy values assigned to key/secret/token/password, sensitive
files and conflict markers. Output is redacted. A false positive is waived in
.commit-craft-allow by fingerprint or path, with a reason.
Step 3 blocks vague subjects ("fix", "update"), subjects over 72 characters, no blank line after the subject, and a change of 40+ lines or 4+ files with no body. It enforces Conventional Commits only if the repo already uses them.
Step 4 also blocks fixup!/squash!/WIP commits and warns on duplicates and
revert pairs. Install assets/hooks/ to run steps 2 to 4 on every commit and push.
Hard rules
- Never
git add -Aorgit add .on a mixed tree. Stage each group by name or by hunk. - A blocked gate means no commit. Remove the value and load it at runtime. Never
--no-verify, never waive a real secret. - A pushed secret is rotated first. Deleting it in a new commit leaves it in history (
references/secret_response.md). - Each commit builds. Tests ride with their change; moves carry their callers.
- The body says why. The diff already says what.
- Rewrite only unpushed history. Rebasing or amending shared commits is the user's call.
Scripts
| Script | Role | Exit codes |
|---|---|---|
scripts/commit_planner.py |
Groups, order, staging commands, MOVE/MIXED/SIZE flags | 0 one commit · 2 split · 3 bad input · 4 secrets file held back |
scripts/secret_gate.py |
Staged or range scan for credentials, sensitive files, conflict markers | 0 · 2 warnings · 3 · 4 blocked |
scripts/message_linter.py |
One message (-m, --message-file) or a series (--range) |
0 · 2 warnings · 3 · 4 blocked |
All support --help, --sample and --output json.
References and assets
references/commit_series_design.md: split, order and verify, with sources (7)references/message_discipline.md: subject, why-body, breaking changes, trailers (7)references/secret_response.md: what the gate catches, its limits, and the leak response order (7)assets/hooks/:pre-commit,commit-msg,pre-pushassets/commit-craft-allow.example: waiver formatassets/series_checklist.md: pre-push sign-off
常见问题
它会替我提交或推送吗?
不会。它的脚本只读取 git,从不暂存、提交或推送。这些步骤由你自己完成。
它会拦截什么?
在提交之前,暂存的密钥和 .env 文件会被拦截。
推送前它能检查整组提交吗?
能。它可以检查范围内的每条提交信息,并可对每个提交运行测试命令。
详情
作者的原始描述
Use when committing a mix of changes, before a push, or when asked to split work into commits or write commit messages. Plans a reviewable series, blocks staged secrets and .env files, and lints messages with commit_planner.py, secret_gate.py and message_linter.py.
热度
- GitHub 星标
- 29k
- 排名
- #9551
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
agent-launcher-orchestrator
29k帮你的智能体从一个清晰的目标出发,逐步规划、构建、测试并定时运行你自己账户中的 Claude 托管智能体。
grade-iterate
29k让你的智能体按评分标准为托管 AI 智能体的工作打分,并在固定的轮次内改进,因此它永远不会无限循环。
interview
29k让你的智能体就一个 AI 智能体的想法对你进行访谈,并在任何上线之前,把你的回答整理成一份简单的构建计划。
run-without-you
29k帮你的智能体设置托管 AI 智能体,使其按计划或在某个事件发生时运行,并在启动前检查定时设置。