git-commit-workflow by laurigates/claude-plugins
npx skills add https://github.com/laurigates/claude-plugins --skill git-commit-workflow关于提交消息规范、暂存实践以及使用约定式提交和显式暂存工作流的最佳实践的专家指导。
有关详细示例、高级模式和最佳实践,请参阅 REFERENCE.md。
注意: 提交在主分支上进行,并推送到远程功能分支以进行 PR。有关主分支开发模式,请参阅 git-branch-pr-workflow 技能。
type(scope): description
[optional body]
[optional footer(s)]
关于页脚/尾部模式(Co-authored-by, BREAKING CHANGE, Release-As),请参阅 git-commit-trailers 技能。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
# 带作用域的功能
git commit -m "feat(auth): implement OAuth2 integration"
# 带正文的错误修复
git commit -m "fix(api): resolve null pointer in user service
Fixed race condition where user object could be null during
concurrent authentication requests."
# 破坏性变更
git commit -m "feat(api)!: migrate to GraphQL endpoints
BREAKING CHANGE: REST endpoints removed in favor of GraphQL.
See migration guide at docs/migration.md"
应该:
Fixes #123, Closes #456, Resolves #789Refs #N 表示相关但不应自动关闭的议题不应该:
Fixes)(应使用 Refs)在提交之前,用一个命令收集所有上下文:
# 基本上下文:状态、暂存文件、差异统计、最近日志
bash "${CLAUDE_PLUGIN_ROOT}/skills/git-commit-workflow/scripts/commit-context.sh"
# 带议题匹配:同时获取开放的 GitHub 议题以进行自动链接
bash "${CLAUDE_PLUGIN_ROOT}/skills/git-commit-workflow/scripts/commit-context.sh" --with-issues
该脚本输出:分支信息、暂存/未暂存状态、差异统计、检测到的作用域、最近的提交风格、预提交配置状态,以及可选的开放议题。使用此输出来撰写提交消息。详情请参阅 scripts/commit-context.sh。
# 显示当前状态
git status --porcelain
# 为了可见性,逐个暂存文件
git add src/auth/login.ts
git add src/auth/oauth.ts
git status # 验证暂存了哪些文件
# 显示将要提交的内容
git diff --cached --stat
git diff --cached # 审查实际变更
# 使用约定式消息提交
git commit -m "feat(auth): add OAuth2 support"
始终直接在 git commit 中使用 HEREDOC。
git commit -m "$(cat <<'EOF'
feat(auth): add OAuth2 support
Implements token refresh and secure storage.
Fixes #123
EOF
)"
# 良好:简洁、基于事实、谦逊
git commit -m "fix(auth): handle edge case in token refresh"
git commit -m "feat(api): add pagination support
Implements cursor-based pagination for list endpoints.
Includes tests and documentation."
聚焦于事实:改变了什么、为什么改变(如果不明显)以及影响(破坏性变更)。
| 场景 | 模式 | 示例 |
|---|---|---|
| 修复问题的错误修复 | Fixes #N | Fixes #123 |
| 完成议题的功能 | Closes #N | Closes #456 |
| 相关但未完成 | Refs #N | Refs #789 |
| 跨仓库 | Fixes owner/repo#N | Fixes org/lib#42 |
| 多个议题 | 重复关键词 | Fixes #1, fixes #2 |
# 主题行:<= 72 个字符
feat(auth): add OAuth2 support
# 正文:每行 <= 72 个字符(换行)
# 在主题和正文之间使用空行
| 上下文 | 命令 |
|---|---|
| 预提交上下文 | bash "${CLAUDE_PLUGIN_ROOT}/skills/git-commit-workflow/scripts/commit-context.sh" |
| 上下文 + 议题 | bash "${CLAUDE_PLUGIN_ROOT}/skills/git-commit-workflow/scripts/commit-context.sh" --with-issues |
| 快速状态 | git status --porcelain |
| 暂存差异统计 | git diff --cached --stat |
| 最近提交风格 | git log --format='%s' -5 |
| 用于链接的开放议题 | gh issue list --state open --json number,title --limit 30 |
每周安装数
74
仓库
GitHub 星标数
18
首次出现
2026年1月29日
安全审计
安装于
opencode73
github-copilot72
cursor72
gemini-cli70
codex70
amp69
Expert guidance for commit message conventions, staging practices, and commit best practices using conventional commits and explicit staging workflows.
For detailed examples, advanced patterns, and best practices, see REFERENCE.md.
Note: Commits are made on main branch and pushed to remote feature branches for PRs. See git-branch-pr-workflow skill for the main-branch development pattern.
type(scope): description
[optional body]
[optional footer(s)]
For footer/trailer patterns (Co-authored-by, BREAKING CHANGE, Release-As), see git-commit-trailers skill.
# Feature with scope
git commit -m "feat(auth): implement OAuth2 integration"
# Bug fix with body
git commit -m "fix(api): resolve null pointer in user service
Fixed race condition where user object could be null during
concurrent authentication requests."
# Breaking change
git commit -m "feat(api)!: migrate to GraphQL endpoints
BREAKING CHANGE: REST endpoints removed in favor of GraphQL.
See migration guide at docs/migration.md"
DO:
Fixes #123, Closes #456, Resolves #789Refs #N for related issues that should not auto-closeDON'T:
Fixes) when you only mean to reference (Refs)Before committing, gather all context in one command:
# Basic context: status, staged files, diff stats, recent log
bash "${CLAUDE_PLUGIN_ROOT}/skills/git-commit-workflow/scripts/commit-context.sh"
# With issue matching: also fetches open GitHub issues for auto-linking
bash "${CLAUDE_PLUGIN_ROOT}/skills/git-commit-workflow/scripts/commit-context.sh" --with-issues
The script outputs: branch info, staged/unstaged status, diff stats, detected scopes, recent commit style, pre-commit config status, and optionally open issues. Use this output to compose the commit message. See scripts/commit-context.sh for details.
# Show current status
git status --porcelain
# Stage files one by one for visibility
git add src/auth/login.ts
git add src/auth/oauth.ts
git status # Verify what's staged
# Show what will be committed
git diff --cached --stat
git diff --cached # Review actual changes
# Commit with conventional message
git commit -m "feat(auth): add OAuth2 support"
ALWAYS use HEREDOC directly in git commit.
git commit -m "$(cat <<'EOF'
feat(auth): add OAuth2 support
Implements token refresh and secure storage.
Fixes #123
EOF
)"
# Good: Concise, factual, modest
git commit -m "fix(auth): handle edge case in token refresh"
git commit -m "feat(api): add pagination support
Implements cursor-based pagination for list endpoints.
Includes tests and documentation."
Focus on facts: What changed , Why it changed (if non-obvious), and Impact (breaking changes).
| Scenario | Pattern | Example |
|---|---|---|
| Bug fix resolving issue | Fixes #N | Fixes #123 |
| Feature completing issue | Closes #N | Closes #456 |
| Related but not completing | Refs #N | Refs #789 |
| Cross-repository | Fixes owner/repo#N |
# Subject line: <= 72 characters
feat(auth): add OAuth2 support
# Body: <= 72 characters per line (wrap)
# Use blank line between subject and body
| Context | Command |
|---|---|
| Pre-commit context | bash "${CLAUDE_PLUGIN_ROOT}/skills/git-commit-workflow/scripts/commit-context.sh" |
| Context + issues | bash "${CLAUDE_PLUGIN_ROOT}/skills/git-commit-workflow/scripts/commit-context.sh" --with-issues |
| Quick status | git status --porcelain |
| Staged diff stats | git diff --cached --stat |
| Recent commit style | git log --format='%s' -5 |
| Open issues for linking |
Weekly Installs
74
Repository
GitHub Stars
18
First Seen
Jan 29, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode73
github-copilot72
cursor72
gemini-cli70
codex70
amp69
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
122,000 周安装
Fixes org/lib#42 |
| Multiple issues | Repeat keyword | Fixes #1, fixes #2 |
gh issue list --state open --json number,title --limit 30 |