0xmsc-commit Skill 技能
把 Conventional Commits 规范封装成可重复执行的 Git 提交辅助 Skill
技能简介
0xmsc-commit 是一款面向 Claude、Codex、Claude Code 的 Git 提交规范辅助 Skill,专门解决"提交信息模糊、提交粒度混乱、提交时机凭感觉"这三类日常 Git 痛点。它把 Conventional Commits 规范(type/scope/subject/body/footer)封装成可重复执行的提示模板,让编码 Agent 先看 git status 与 git diff --staged 再起草消息,确保每一条提交只承载一个逻辑变更、每一条消息都符合团队可读的格式约定。Skill 自带 commit 模板,禁止未经确认的强制推送与 amend 操作,从流程上避免误改协作分支。Quality Score 79、通过完整安全审计(外部命令风险已声明),适合作为团队 Git 工作流的统一入口 Skill。
核心能力
- 自动读取
git status与git diff --staged,结合当前暂存内容起草符合 Conventional Commits 的提交信息。 - 强制按 type(feat/fix/chore/docs/refactor/test/...)+ 可选 scope + subject(≤50 字符)+ body + footer 的五段式结构,避免"update files""misc changes"这类无意义摘要。
- 引导一次提交只包含一个逻辑变更(atomic commit),把暂存区里无关的文件拆分到独立提交中。
- 内置 commit 模板,确保跨仓库、跨成员提交格式可被静态校验(commitlint、CI 校验钩子)识别。
- 识别安全的 Git 子命令,拒绝交互式 rebase、force push、amend 等高风险操作,所有写操作前必须显式用户确认。
- 支持 feature commit、breaking change commit、文档/配置维护 commit 三类常见场景,每类都有对应的 footer 模板与示例。
安装配置
- 通过
npx skillstore add 0xmsc/commit一行命令完成安装,无需手工克隆仓库或处理依赖。 - 安装前确保本机已安装 Git ≥2.30 并配置好
user.name、user.email,否则 commit --amend 会因身份缺失报错。 - 推荐在仓库根目录执行安装,使 Skill 能正确解析
.git目录与工作区文件结构。 - 若需启用 Conventional Commits 自动校验,可在仓库
package.json中接入 commitlint + husky,让本 Skill 起草的消息自动通过 CI。
使用步骤
- 第一步:在编码 Agent 中输入
Review my staged changes and suggest one Conventional Commits message. Keep the subject under 50 characters.,Skill 会读取暂存区 diff 并给出建议消息。 - 第二步:若暂存区混杂多个逻辑改动,使用
Review the staged and unstaged changes. Recommend separate atomic commits with file groups and proposed messages before any commit is created.,让它规划拆分方案。 - 第三步:使用
Use git status and git diff --staged to identify the best type and optional scope. Explain the choice before suggesting the message.,让 Skill 解释 type/scope 的选择依据,便于团队新人学习规范。 - 第四步:审核 Skill 给出的最终消息是否符合团队规范,特别留意 BREAKING CHANGE footer 是否需要
feat!:简写形式。 - 第五步:用
Audit the final message for Conventional Commits format, breaking-change footer quality, body clarity, and safe git workflow before commit creation.走一遍发布前自检,再由人工执行git commit。
适用场景
- 个人开发者维护开源项目时统一 commit 历史,方便后续
git log生成 changelog。 - 团队新成员 onboarding:用 Skill 作为活文档,规范 type/scope 用法标准。
- 跨仓库重构或大规模文档/配置更新,需要批量产出格式合规的 commit。
- PR 合并前做最终消息审核,确保 Squash Merge 后主干历史符合规范。
- 与 commitlint、release-please、semantic-release 配合,构建全自动版本号发布流水线。
适用人群
- 任何使用 Claude Code、Codex 或 Claude 进行日常编码的开发者。
- 需要统一 commit 规范的中小型研发团队(5~50 人),尤其是用 GitHub/GitLab 协作的开源项目。
- 希望在团队中推行 Conventional Commits 但缺少培训资源的 Tech Lead、架构师。
- 维护 changelog、自动版本号、semantic-release 流水线的 DevOps 工程师。
工作原理
Skill 启动后会先调用 git status 与 git diff --staged 拿到当前工作区快照,然后基于内置的 type/scope 规则库推断本次提交的最优 type(如新增功能→feat,修复→defect 等)与 scope(模块/子系统名)。它使用 Conventional Commits 1.0 规范的语义模型,把 subject 控制在 50 字符内、body 每行 72 字符,并对 BREAKING CHANGE footer 单独提示。所有写操作(commit、push、amend、rebase)一律走"建议→用户确认→执行"的三段式,确保人类始终是 Git 历史的最终守门人。Skill 风险审计已识别外部命令风险但声明为安全实践,所有 force-push、amend 操作都需要用户显式授权。
官方链接
- Skill 详情页:https://skillstore.io/skills/0xmsc-commit
- Manifest:https://skillstore.io/api/skills/0xmsc-commit/manifest
- 源仓库:https://github.com/0xmsc/coding_assistant/tree/master/src/coding_assistant/skills/commit
- 安装命令:
npx skillstore add 0xmsc/commit
评论与建议
登录 后参与评论或提建议