К основному содержанию
скилл CX Codex

commit · pedrohcgs — скилл для Claude Code: проверки перед коммитом и PR

Гоняет гейты качества, согласованности и паспортов, заводит ветку от main, стейджит файлы поимённо и пишет коммит с утверждением о поведении.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add pedrohcgs/claude-code-my-workflow --skill commit -a claude-code
Открыть на GitHub

Что делает commit

Скилл запускается только на явное намерение: вы говорите «закоммить», «давай закоммитим», «открой PR» или ставите /commit. На расплывчатое «всё, закончили» он не сработает — сначала спросит подтверждение. Внутри два обязательных прохода перед ветвлением: python3 scripts/quality_score.py по изменённым .qmd, .tex и .R и полный набор гейтов через ./scripts/backtest.sh.

Оценка качества ниже 80 останавливает работу: либо правьте, либо говорите «commit anyway». Красный backtest не обходится даже так — придётся чинить. Если задет документ с паспортом в quality_reports/passports/, скилл читает его и валит коммит на утверждении со статусом FAIL или STALE, отправляя к /audit-reproducibility. Дальше — ветка вместо main, git add с конкретными файлами без git add -A и сообщение, у которого заголовок описывает новое поведение, а не пересказывает ход работы.

Пуш и PR только с --pr или по прямой просьбе. Слияние скилл не делает никогда: «ship it» и «done» за команду слияния не считаются. После ./scripts/install-hooks.sh хук .githooks/pre-commit повторяет ту же планку 80 на проиндексированных файлах; одобренный обход передаётся в коммит как SKIP_QUALITY_GATE=1, и причина обхода попадает в сообщение. git commit --no-verify скилл не использует.

Какие задачи решает

  • прогнать изменённые файлы через оценку качества до коммита
  • поймать расхождение счётчиков и битые ссылки до пуша
  • проверить, что задетый документ не тянет утверждение со статусом FAIL
  • завести ветку вместо коммита напрямую в main
  • написать заголовок коммита, описывающий новое поведение

Примеры запросов агенту

  • Закоммить это, ветку назови fix-parity-gate
  • /commit поправил проверку хешей в фикстурах
  • Закоммить и открой PR с --pr

Как установить commit

1Через Skills CLI (Vercel)

npx skills add pedrohcgs/claude-code-my-workflow --skill commit -a claude-code

2Вручную: положить файлы

~/.claude/skills/commit/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/commit/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о commit

Как установить commit в Claude Code?

Выполните npx skills add pedrohcgs/claude-code-my-workflow --skill commit -a claude-code. Файл скилла окажется по пути ~/.claude/skills/commit/SKILL.md.

Что делает commit?

Проверяет качество и согласованность изменений, при необходимости создаёт ветку от main, стейджит конкретные файлы и пишет коммит. PR открывает только с --pr или по вашей просьбе.

Можно ли закоммитить при низкой оценке качества?

Да, но только с явным обходом: скажите «commit anyway», и скилл проставит SKIP_QUALITY_GATE=1, записав причину в сообщение коммита. Красный backtest так обойти нельзя.

Исходный текст

SKILL.md · MIT
---
name: commit
description: Commit the current work — runs the quality, consistency and passport gates, branches off main if needed, stages specific files, and writes a commit whose subject states what is now true. Pushes and opens a pull request only with --pr or when the user asks; never merges — a merge happens only when the user explicitly says to merge. Use ONLY on explicit commit intent — user says "commit", "let's commit this", "open a PR", or prefixes with `/commit`. Do NOT auto-invoke on vague end-of-task phrases ("we're done", "wrap up") — those require explicit confirmation first. Never force-pushes or skips hooks.
argument-hint: "[optional: commit message] [--pr]"
allowed-tools: ["Bash", "Read", "Glob", "Agent", "Task"]
---

# Commit

Verify the gates, then commit. **A commit is not a pull request, and a pull request is not a merge.**
This skill stops after the commit. It pushes and opens a pull request only with `--pr` or when the
user asks, and it **never merges** — a merge happens only when the user explicitly says to merge
that pull request (see "Merging" below). Reviewers such as Codex and Copilot comment after a pull
request opens; merging before they report skips their review.

## Steps

### Step 0: Quality Gate (Pre-Commit)

**Run before branching.** For every changed `.qmd`, `.tex`, or `.R` file that has quality rubrics, run:

```bash
python3 scripts/quality_score.py <changed-file-paths>
```

- If any file scores below **80**, halt and report the findings. The user must either fix the issues or explicitly override with phrases like *"commit anyway"* or *"skip quality gate"*. Once `./scripts/install-hooks.sh` has been run, `.githooks/pre-commit` re-runs the same ≥80 gate on the staged `.qmd`/`.tex`/`.R` files, so carry an approved override into Step 4 as `SKIP_QUALITY_GATE=1 git commit ...` and record the override reason in the commit message. That variable skips only the quality score; the backtest still runs. Never fall back to `git commit --no-verify`.
- If all files score 80+, continue.

Spawn the **verifier** agent (via the `Agent` tool with `subagent_type=verifier`) to run compilation/render checks on the changed files. Report pass/fail before committing.

### Step 0b: Consistency Gate (Pre-Commit)

**Runs unconditionally.** The full backtest suite — all ten gates (surface-sync count claims like `"18 agents, 61 skills, 37 rules, 11 hooks"` and marked tables, skill integrity, model currency, links, spec conformance, staleness, repo hygiene, derived counts, ledger coverage, hook battery):

```bash
./scripts/backtest.sh
```

- **Exit 0:** all gates green — continue.
- **Nonzero:** at least one gate is red — print its output and halt. Fix, then re-run. Do not proceed past this gate on a red result, even with "commit anyway": a red gate is drift that the next reader inherits, and small count drift has repeatedly cost follow-up PRs.

### Step 0c: Passport Check (Pre-Commit)

If the diff touches a manuscript (`.tex`/`.qmd`) that has a passport in `quality_reports/passports/`, any `source_file` a passport lists, or any file a claim declares as a display (its `location:`, or an `appears_in` `path:`), read that passport: a load-bearing claim with `status: FAIL` or `STALE` is a **must-fix** — halt, name the claim, and point at `/audit-reproducibility` (or the stale script) before committing. A touched display triggers the check for the same reason a touched script does: editing one artifact's copy of a number desynchronizes it from that number's other displays — the supplement or deck holding the same value was not necessarily updated in the same commit. Skip silently when no passport exists.

### Step 1: Check current state

```bash
git status
git diff --stat
git log --oneline -5
```

### Step 2: Create a branch (when on main)

Never commit directly to `main`. If the current branch is `main`, create one; if you are already on
a feature branch, commit there.

```bash
git checkout -b <short-descriptive-branch-name>
```

### Step 3: Stage files

Add specific files (never use `git add -A`):

```bash
git add <file1> <file2> ...
```

Do NOT stage `.claude/settings.local.json` or any files containing secrets.

### Step 4: Commit with a descriptive message

If `$ARGUMENTS` is provided, use it as the commit message. Otherwise, analyze the staged changes and write a message that explains *why*, not just *what*.

**The subject line states what is TRUE AFTER the commit** — a plain sentence about behavior that a reader could go and test. *"Fixed review feedback"* and *"Updated the checker"* narrate your afternoon and tell a reader nothing; *"The parity gate refuses a fixture whose hash is unregistered"* is a claim they can check against the code. Process narration — which review round it came from, who asked, how many attempts it took — belongs in the body if it belongs anywhere. The body still carries the *why*; the subject carries the claim.

```bash
git commit -m "$(cat <<'EOF'
<commit message here>
EOF
)"
```

### Step 5: Push and open a pull request — only with `--pr` or when the user asks

Without `--pr`, and without the user asking for a pull request, skip this step: the commit stays
local and the report says so.

```bash
git push -u origin <branch-name>
gh pr create --title "<short title>" --body "$(cat <<'EOF'
## Summary
<1-3 bullet points>

## Changed defaults
<"None", or each default a forker will notice changing: a setting, a threshold, a hook that now fires, a path that moved>

## Test plan
<checklist>

🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"
```

### Step 6: Report

Report the commit (hash and subject), the branch, and — if a pull request was opened — its URL.
Say plainly that nothing was merged.

## Merging — only when the user says so

A merge is never a step of this skill. Merge only when the user explicitly asks to merge a specific
pull request ("merge #155"); "ship it", "done" or "commit" are not a merge instruction. Before
merging, check that the pull request's CI is green and that its reviews (human, Codex, Copilot)
have been read and answered.

```bash
gh pr merge <pr-number> --merge --delete-branch
git checkout main
git status --porcelain          # must print nothing before the next line runs
git pull
```

**Expect the tree to be dirty here — that is what Step 3 is for.** Staging specific files means
everything the session touched but did not stage, plus every untracked artifact, is still in the
tree when you arrive at this step. The `git-guardrails` hook this template ships **denies**
`git pull` (and `merge`, and `rebase`) whenever `git status --porcelain` is non-empty, because a
pull that resolves on top of uncommitted work cannot be reviewed afterwards — you can no longer
tell which hunk came from the remote. Chaining a stash into the same command line does not help:
the hook reads the tree, it does not predict what the line will do to it.

Clear the tree deliberately, then pull:

```bash
git stash push -u -m "post-merge: unstaged leftovers"   # -u, or untracked files stay behind
git pull
git stash pop
```

`git pull --autostash` is the one-command alternative, but only on a tree whose dirt is entirely
**tracked**. `git stash` does not stash untracked files, so an autostash over a `??` entry starts
the pull on the same dirty tree the check exists to refuse — the hook therefore reads porcelain
and **denies** `--autostash` whenever any `??` entry is present. At this step that is the usual
state, so the explicit `-u` stash above is the default route and `--autostash` is the shortcut for
the case where `git status --porcelain` shows no `??` lines at all. Git agrees independently: if
the incoming commits add a file at a path you are holding untracked, it aborts the merge
(*"untracked working tree files would be overwritten"*) after the autostash has already been
taken. Either route must be its **own** command — chaining the stash and the pull onto one line is
denied outright, because an identified history op reaches the tree reading only as a standalone
simple command.

`ALLOW_DIRTY_MERGE=1` is the hatch for a dirty state you have looked at and can justify out loud.
It is not the routine remedy, and reaching for it because the block is inconvenient is the
behavior the check exists to prevent.

## Important

- **Never skip Step 0.** Quality gates catch broken compilation, bad citations, and hardcoded paths before they reach `main`. If the user insists on skipping, record their override reason in the commit message.
- Never commit directly to `main`; branch off it first.
- Never push, open a pull request, or merge unless asked — see Step 5 and "Merging".
- Exclude `settings.local.json` and sensitive files from staging.
- When the user does ask to merge, use `--merge` (not `--squash` or `--rebase`) unless they say otherwise.
- If the commit message from `$ARGUMENTS` is provided, use it exactly.

## Flags

| Flag | Effect |
|---|---|
| `--pr` | After the commit, push the branch and open a pull request (Step 5). Never merges. |

© pedrohcgs · MIT · pedrohcgs/claude-code-my-workflow

Похожие скиллы

Все скиллы по теме «Git и GitHub» →

Сначала — commit от других авторов.

commit getsentry Скилл для коммитов в стиле Sentry: собирает conventional commits со ссылками на задачи и следит, чтобы вы не коммитили прямо в main. CX Codex +1 4 700установок commit NeoLabHQ Автоматизирует подготовку коммитов по стандарту Conventional Commits с подходящими эмодзи. Проверяет текущую ветку, запускает линтер и предлагает разбить крупные диффы на атомарные части. CX Codex +1 1 200установок commit parcadei Скилл проводит git-коммиты через согласование с вами и не добавляет упоминаний Claude в сообщения. Пригодится, когда агент накопил правки за сессию. CX Codex +1 499установок commit PaulRBerg Собирает сообщение коммита из подготовленного диффа и отдаёт сам коммит, индекс и пуш утилите ai-commit. CX Codex +1 342установок commit LegendApp Превращает правки текущей задачи в один или несколько аккуратных коммитов и не тянет в них постороннюю работу. Пригодится, когда в дереве накопилось несколько несвязанных изменений. CX Codex +1 404установок triage Matt Pocock Скилл проводит issue и внешние PR через роли триажа, проверку и подготовку брифа для агента. Подойдёт мейнтейнеру, который разбирает очередь задач. 990 453установок code-review Matt Pocock Проверяет изменения от выбранной точки по стандартам репозитория и требованиям задачи. Нужен для ревью ветки, PR или незавершённой работы. 789 521установок implement Matt Pocock Выполняет задачу по спецификации или тикетам, ведёт работу через тесты и завершает её ревью с коммитом. Подходит для задач, где нужен дисциплинированный цикл разработки. 774 700установок git-guardrails-claude-code Matt Pocock Скилл ставит хук Claude Code, который останавливает опасные Git-команды до их запуска. Нужен, если агент не должен делать push или удалять изменения. 499 069установок setup-pre-commit Matt Pocock Скилл настраивает pre-commit для JavaScript-репозитория: Husky запускает форматирование, проверку типов и тесты перед коммитом. 489 289установок scaffold-exercises Matt Pocock Скилл создаёт структуру учебных упражнений с секциями, задачами, решениями и пояснениями. Пригодится при запуске нового раздела курса. 480 196установок

Из того же набора27

deploy Скилл собирает слайды Quarto в HTML и синхронизирует файлы с docs/ для GitHub Pages. Запускайте его, когда нужно опубликовать лекцию. CX Codex +1 ★ 1 671звёзд репо deep-audit Разбирает теорию, доказательство, статью или кодовую базу на части, гоняет по ним независимых скептиков и чинит всё подтверждённое. Нужен, когда одного прохода ревью мало. CX Codex +1 ★ 1 671звёзд репо credible-claims Скилл для делегированной и ИИ-ассистированной исследовательской работы: сначала бриф, потом запись утверждений. Помогает не путать быстрое выполнение с доказательством. CX Codex +1 ★ 1 671звёзд репо context-status Скилл показывает примерный расход контекста, активный план и состояние сохранения сессии. Пригодится, чтобы проверить, что останется после автоуплотнения. CX Codex +1 ★ 1 671звёзд репо compress-session Скилл выжимает из текущего диалога структурированную заметку с решениями, открытыми вопросами и следующими шагами, пока контекст не ушёл в автосжатие. CX Codex +1 ★ 1 671звёзд репо coauthor-brief Собирает Markdown-брифинг для соавтора или коллеги: что изменилось с прошлого раза, в каком состоянии рукопись, анализ и слайды, как воспроизвести проект локально. CX Codex +1 ★ 1 671звёзд репо capture-environment Скилл собирает версии языков, пакетов и сиды в lockfile, чтобы расчёт воспроизводился на чужой машине. Нужен перед выкладкой replication package. CX Codex +1 ★ 1 671звёзд репо adjudicate-review Превращает замечания ревьюера в проверенные правки. Каждое замечание остаётся кандидатом, пока не сверено с исходником. CX Codex +1 ★ 1 671звёзд репо

Спонсоры проекта

Компании, которые помогают держать аналитику открытой