skills/git-commit/SKILL.md
创建符合规范的 git 提交消息,并在提交前 review 将提交的变更。优先遵循项目现有提交规范,支持 Conventional Commits 格式。使用场景:用户要求创建提交、编写提交消息、提交前检查变更
npx skillsauth add krissss/skills git-commitInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
创建清晰、规范的 git 提交消息。优先遵循项目现有风格,其次参考 Conventional Commits 标准。
如果对话中已通过本技能确定过项目规范,直接复用,跳过本步骤。
首次执行时并行收集以下信息:
git log -5 --pretty=format:"%s"
git branch --show-current
同时检查项目根目录是否存在 commitlint 配置(.commitlintrc.*、commitlint.config.*、package.json 中的 "commitlint" 字段)。
按优先级取第一个匹配:
extends(预设)、parserPreset(解析模式)、rules(type-enum、scope-enum、header-max-length 等)feat/feature)、语言(中文/英文)、issue 引用位置(subject 中/footer 中)优先使用项目已有类型。无明确类型时参考:
| 类型 | 说明 |
|------|------|
| feat / feature | 新功能 |
| fix / bugfix | Bug 修复 |
| docs | 文档变更 |
| style | 代码格式(不影响功能) |
| refactor | 重构(功能不变) |
| perf | 性能优化 |
| test | 测试相关 |
| chore | 构建/工具链 |
从当前分支名中提取 issue 编号:
feature/#1254 → #1254fix/123-login-blank → #123feat/new-feature-456 → #456issue/789 → #789feature/PROJ-123-desc → #PROJ-123解析到 issue 编号时,按上述确定的引用风格放置(subject 中或 footer 中)。
git status --short
git diff --stat
属于同一模块(一起提交):
不搭界(分开提交):
所有变更属于同一模块:直接提交。
大部分属于同一模块,少量不搭界:
主要模块:用户模块
不相关变更(建议暂不提交):
- src/api/orders.ts (订单模块)
跳过不相关内容,仅提交用户模块相关变更?(y/n)
多个模块变更相当:
用户模块:70行 | 订单模块:90行
建议先提交变更较多的模块,是否仅提交订单模块?(y/n/all)
在生成提交消息或执行提交前,必须 review 本次将提交的变更。先判断当前运行环境使用的 agent 及其能力,按以下优先级执行:
优先 review 暂存区;如果没有暂存内容,则 review 工作区变更;如果步骤 2 决定拆分提交,只 review 将纳入本次提交的文件。
使用 subagent review 时,只传递客观材料:本次提交范围、git diff --stat、完整 diff、相关用户需求和本步骤检查项。不要传递主线程的判断结论、期望结果或提交消息草稿。subagent 输出应优先列出阻塞问题,其次列出非阻塞风险;无问题时明确说明未发现阻塞问题。
git diff --cached --stat
git diff --cached
git diff --cached --check
如果暂存区为空,改用:
git diff --stat
git diff
git diff --check
无阻塞问题:继续生成提交消息,并可在回复中简要说明 review 通过。
发现阻塞问题:先停止提交,向用户列出问题、文件位置和建议修复方式;不要生成会掩盖问题的提交消息。
发现非阻塞风险:继续生成提交消息,但在回复中提示风险和建议验证项。
git log @{u}..HEAD --oneline 2>/dev/null
仅在有领先远程的本地提交时判断。合并条件:同一类型 + 相同模块文件、同一 bug 的修复、文档连续更新。其他情况不合并。
基于项目规范和变更内容生成消息:
<type>(<scope>): <subject>
<body>
<footer>
必需:type + subject(50-72 字符)
可选:scope、body、footer
add 而非 addedBREAKING CHANGE: API endpoints now require authentication
Closes #123
Refs #456
scope-enum 中获取可用值两种标记方式(均为 Conventional Commits 标准):
方式 1:类型后加 !
feat!: remove deprecated endpoints
feat(api)!: remove deprecated endpoints
方式 2:Footer 中声明
feat(api): remove deprecated endpoints
BREAKING CHANGE: v1 endpoints are no longer available.
Migration guide: docs/migration.md
Co-Authored-By 等元信息feat: add dark mode support
fix: 修复登录超时问题
docs: 更新安装指南
feat(auth): 实现 OAuth2 登录
fix(ui): 修复移动端按钮对齐问题
feat(auth): #1254 实现 OAuth2 登录
fix(ui): #123 修复移动端按钮对齐问题
feat(api): add pagination support
Implement pagination for list endpoints:
- Add `page` and `limit` query parameters
- Return total count and pagination metadata
Closes #42
development
使用 ddgr 在终端搜索 DuckDuckGo,返回结构化结果。支持站点限定、时间过滤、区域搜索。使用场景:用户要求搜索信息、查找文档、搜索特定网站内容
tools
Use when work should span one or more detached tasks but still behave like one job with a single owner context. TaskFlow is the durable flow substrate under authoring layers like Lobster, ACPX, plugins, or plain code. Keep conditional logic in the caller; use TaskFlow for flow identity, child-task linkage, waiting state, revision-checked mutations, and user-facing emergence.
tools
# Lobster Lobster executes multi-step workflows with approval checkpoints. Use it when: - User wants a repeatable automation (triage, monitor, sync) - Actions need human approval before executing (send, post, delete) - Multiple tool calls should run as one deterministic operation ## When to use Lobster | User intent | Use Lobster? | | ------------------------------------------------------ | --------------------------
tools
# Lobster Lobster executes multi-step workflows with approval checkpoints. Use it when: - User wants a repeatable automation (triage, monitor, sync) - Actions need human approval before executing (send, post, delete) - Multiple tool calls should run as one deterministic operation ## When to use Lobster | User intent | Use Lobster? | | ------------------------------------------------------ | --------------------------