git-commit-workflow — скилл Claude Code: правила коммитов
Скилл git-commit-workflow для Claude Code задаёт формат сообщений и правила staging. Помогает разделять изменения по смыслу и не смешивать файлы в одном коммите.
MIT 161 установок ★ 60 обновлён 2026-11-16
npx skills add laurigates/claude-plugins --skill git-commit-workflow -a claude-codeЧто делает git-commit-workflow
git-commit-workflow работает в Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI и OpenCode. Он задаёт формат type(scope): description, требует scope и предлагает выбирать тип изменения: feat, fix, docs, refactor, test, chore, perf или ci.
Скилл советует группировать связанные правки, добавлять файлы по одному через git add, затем смотреть git diff --cached и статус. Для сбора контекста есть скрипт commit-context.sh, который показывает состояние ветки, staged-файлы, статистику diff и стиль недавних коммитов.
Это справочник, а не исполнитель: коммит он не создаёт. Для массовых правок сначала нужен git status --porcelain и проверка через /git:coworker-check, чтобы не забрать чужие staged-файлы.
Какие задачи решает
- составить сообщение в формате
type(scope): subject - разделить связанные изменения на отдельные коммиты
- добавить файлы в staging по явным путям
- проверить staged diff перед коммитом
- связать коммит с задачей через
Fixes #NилиRefs #N
Примеры запросов агенту
- Сформируй сообщение для коммита по формату
type(scope): subjectи выбери подходящий тип изменения. - Раздели текущие правки на логические коммиты и добавляй файлы в staging по одному пути.
- Проверь
git status --porcelainи подготовь контекст черезcommit-context.shперед составлением сообщения.
Как установить git-commit-workflow
1Через Skills CLI (Vercel)
npx skills add laurigates/claude-plugins --skill git-commit-workflow -a claude-code2Вручную: положить файлы
~/.claude/skills/git-commit-workflow/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/git-commit-workflow/
1Через Skills CLI (Vercel)
npx skills add laurigates/claude-plugins --skill git-commit-workflow -a codex2Вручную: положить файлы
.agents/skills/git-commit-workflow/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add laurigates/claude-plugins --skill git-commit-workflow -a cursor2Вручную: положить файлы
.cursor/skills/git-commit-workflow/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install laurigates/claude-plugins git-plugin/skills/git-commit-workflow2Вручную: положить файлы
.github/skills/git-commit-workflow/SKILL.md1Через Skills CLI (Vercel)
npx skills add laurigates/claude-plugins --skill git-commit-workflow -a gemini-cli2Командой платформы
gemini skills install https://github.com/laurigates/claude-plugins --path git-plugin/skills/git-commit-workflowВручную: положить файлы
.devin/skills/git-commit-workflow/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add laurigates/claude-plugins --skill git-commit-workflow -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о git-commit-workflow
Как установить git-commit-workflow в Claude Code?
Выполните npx skills add laurigates/claude-plugins --skill git-commit-workflow -a claude-code, затем используйте файл ~/.claude/skills/git-commit-workflow/SKILL.md.
Что делает git-commit-workflow?
Скилл помогает составлять conventional commit messages с обязательным scope, логически группировать изменения и проверять staging перед коммитом. Он не создаёт коммиты сам.
На каких платформах работает git-commit-workflow?
Скилл доступен для Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI и OpenCode.
Исходный текст
SKILL.md · MIT
---
created: 2025-12-16
modified: 2026-11-14
reviewed: 2026-05-14
name: git-commit-workflow
description: "Commit-message and staging conventions: type(scope): subject, logical grouping, explicit-path staging. Reference only, makes no commit. Use when deciding how to word a message or split changes."
user-invocable: false
allowed-tools: Bash(bash ${CLAUDE_PLUGIN_ROOT}/skills/git-commit-workflow/scripts/commit-context.sh *), Bash(git status *), Bash(git add *), Bash(git diff *), Bash(git commit *), Bash(git log *), Bash(git worktree add *), Bash(gh issue list *), Read
---
# Git Commit Workflow
## When to Use This Skill
| Use this skill when... | Use the alternative when... |
|---|---|
| Designing the conventional-commit message and staging conventions for a repo | Use `git-commit` to actually create a commit (handles pre-commit hooks, issue detection) |
| Reviewing how to group changes logically into focused commits | Use `git-commit-trailers` for `BREAKING CHANGE` / `Co-authored-by` trailer rules |
| Discussing humble, fact-based commit communication style | Use `github-issue-autodetect` to add `Fixes #N` / `Closes #N` links to messages |
| Authoring `feat(scope): subject` rules for your codebase | Use `github-pr-title` to apply the same conventional format to PR titles |
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](REFERENCE.md).
## Preconditions
Before staging any files — especially for bulk-edit / commit-loop workflows that touch many subdirectories — verify the working tree is yours alone:
| Check | Why | How |
|-------|-----|-----|
| Coworker check | Another Claude session in the same checkout may have already pre-staged files (`git commit -a` retry, abandoned staging) that your loop would sweep into the wrong commit. **Run this up front, not opportunistically.** | `SlashCommand` → `/git:coworker-check` |
| Working tree scoped | Confirm `git status --porcelain` shows only your edits | `git status --porcelain` |
If `/git:coworker-check` returns anything other than `clear`, stop and either move to a fresh worktree under `<repo>/.claude/worktrees/<task>` (`EnterWorktree`, or `git worktree add .claude/worktrees/<task>`) or ask the user before proceeding. See `.claude/rules/agent-coworker-detection.md` for the seven detection signals.
## Core Expertise
- **Conventional Commits**: Standardized format for automation and clarity
- **Explicit Staging**: Always stage files individually with clear visibility
- **Logical Grouping**: Group related changes into focused commits
- **Communication Style**: Humble, factual, concise commit messages
- **Pre-commit Integration**: Run checks before committing
**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.
## Conventional Commit Format
### Standard Format
```
type(scope): description
[optional body]
[optional footer(s)]
```
**The scope is required.** Write `type(scope): …` — `docs(readme): update install steps`, never a bare `docs: update install steps`. The Conventional Commits spec lets you omit the scope; this house convention does not (`.claude/rules/conventional-commits.md`). Take it from the component or plugin the change touches.
For footer/trailer patterns (Co-authored-by, BREAKING CHANGE, Release-As), see **git-commit-trailers** skill.
### Commit Types
- **feat**: New feature for the user
- **fix**: Bug fix for the user
- **docs**: Documentation changes
- **style**: Formatting, missing semicolons, etc (no code change)
- **refactor**: Code restructuring without changing behavior
- **test**: Adding or updating tests
- **chore**: Maintenance tasks, dependency updates, linter fixes
- **perf**: Performance improvements
- **ci**: CI/CD changes
### Examples
```bash
# Feature
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"
```
### Commit Message Best Practices
**DO:**
- Use imperative mood ("add feature" not "added feature")
- Keep first line under 72 characters
- Be concise and factual
- **ALWAYS reference related issues** - every commit should link to relevant issues
- Use GitHub closing keywords: `Fixes #123`, `Closes #456`, `Resolves #789`
- Use `Refs #N` for related issues that should not auto-close
- Use lowercase for type and scope
- Be humble and modest
**DON'T:**
- Use past tense ("added" or "fixed")
- Include unnecessary details in subject line
- Use vague descriptions ("update stuff", "fix bug")
- Omit issue references - always link commits to their context
- Use closing keywords (`Fixes`) when you only mean to reference (`Refs`)
## Pre-Commit Context Gathering (Recommended)
Before committing, gather all context in one command:
```bash
# 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](scripts/commit-context.sh) for details.
## Explicit Staging Workflow
### Always Stage Files Individually
```bash
# 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"
```
## Bulk-edit / per-plugin commit loops
When a single change touches many subdirectories (per-plugin, per-package, per-doc) and each needs its own scoped commit for release-please, write a one-shot script rather than chaining commands inline.
Why inline loops fail, the canonical one-shot script recipe, and failure recovery: [REFERENCE.md](REFERENCE.md#bulk-edit--per-plugin-commit-loops).
**Compose a multi-line message with a HEREDOC, not by slurping a temp file.**
```bash
git commit -m "$(cat <<'EOF'
feat(auth): add OAuth2 support
Implements token refresh and secure storage.
Fixes #123
EOF
)"
```
Passing the message **by path** is equally accepted — `git commit -F <file>` /
`--file=<file>` is git's analogue of `gh --body-file`, and the
`bash-antipatterns` hook exempts it (#2462):
```bash
git commit -F /tmp/commit-msg.txt
```
What the hook still nudges away from is the roundabout middle ground: writing a
temp file and then slurping it back through `-m "$(cat /tmp/commit-msg.txt)"`.
Either compose inline with a heredoc, or pass the file by path.
## Communication Style
### Humble, Fact-Based Messages
```bash
# 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).
## Issue Reference Summary
| 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` | `Fixes org/lib#42` |
| Multiple issues | Repeat keyword | `Fixes #1, fixes #2` |
## Best Practices
### Commit Frequency
- **Commit early and often**: Small, focused commits
- **One logical change per commit**: Easier to review and revert
- **Keep commits atomic**: Each commit should be a complete, working state
### Commit Message Length
```bash
# Subject line: <= 72 characters
feat(auth): add OAuth2 support
# Body: <= 72 characters per line (wrap)
# Use blank line between subject and body
```
## Agentic Optimizations
| 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 | `gh issue list --state open --json number,title --limit 30` |
© laurigates · MIT · laurigates/claude-plugins