commit
commit, the rules for every git commit. Use whenever the user wants to commit, save, check in or "commit that", asks for a commit message, wants a messy stage split into clean commits, asks for Conventional Commits, or when a task ends with committing the work. Use it before every `git commit` you run, even when the user did not name the commit skill.
- License 许可
- MIT
- 最近更新
- 2026-11-11
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- commit
- description
- commit, the rules for every git commit. Use whenever the user wants to commit, save, check in or "commit that", asks for a commit message, wants a messy stage split into clean commits, asks for Conventional Commits, or when a task ends with committing the work. Use it before every `git commit` you run, even when the user did not name the commit skill.
- argument-hint
- [#issue]
02 资源文件 1
- 资产文件assets/.commitlintrc.yaml233 B
03 SKILL.md 正文
Rules for every commit you create. A commit is one topic with a message that follows Conventional Commits and references the GitHub issue when there is one, so the history stays reviewable and every change links back to its discussion. Git enforces the message through commitlint in a husky commit-msg hook. The message and its validation follow two upstream skills, this skill covers what they leave open, which is enforcement and the skills being present, the issue, the split, the style of the body and the plan.
Steps
-
Ensure enforcement. Look for a commitlint configuration (
commitlint.config.*,.commitlintrc*, or acommitlintkey inpackage.json) and acommit-msghook that runs it (.husky/commit-msg, or acommit-msgcommand inlefthook.yml). If both are present, continue. If they are missing and the repository has apackage.json, follow commitlint's Getting started and Local setup guides with the commands from thepackage-managerskill, then replace the generated configuration with a copy of assets/.commitlintrc.yaml. It extends@commitlint/config-conventionaland addsreferences-emptyas a warning, so a commit without an issue reference passes with a note. Commit the setup on its own asbuild: add commitlint and husky. If there is nopackage.json, ask whether to create one, otherwise follow the rules below by hand and say so in your reply. Never install anything without confirmation. -
Ensure the upstream skills. Look for
conventional-commit-messageandcommitting-with-commitlintin the skill list of the session, under their own names or with a plugin prefix. If they are missing, install them globally after confirmation, with the "Run a one-off tool" command from thepackage-managerskill.-ginstalls for the user, so every repository finds them.pnpx skills add https://github.com/conventional-changelog/conventional-changelog --skill conventional-commit-message -g pnpx skills add https://github.com/conventional-changelog/commitlint --skill committing-with-commitlint -g -
Read the stage. Run
git status --porcelain,git diff --cachedandgit log --oneline -20. Only staged changes are in scope. If nothing is staged, list the unstaged files and stop. Never rungit add -Aorgit add .unless asked. Every message is written in English, whatever language the log uses. -
Find the issue. Look in the prompt, the branch name, the open pull request of the branch (
gh pr view --json number,body), then an issue linked there. If nothing is found, ask whether to create an issue from the diff with theissueskill or to commit without one. Commit without a reference only when the user or the calling skill says the work has no issue, never silently. WriteRefs: #123for a reference andCloses #123when the commit finishes the issue, which closes once the commit reaches the default branch.FixesandResolvesdo the same, keep the one the log already uses. -
Group by topic. One commit per coherent change, one type per commit. Split the stage along those lines before writing any message. Stage each group by applying patches to the index (
git apply --cached), never with the interactivegit add -p, and never overwrite the working file, so unstaged changes of the user survive. -
Write each message with the
conventional-commit-messageskill, which sets the type by release impact, the scope from the repository, a changelog-ready description and footers as trailers. The subject stays withconventional-commit-messageand commitlint. The body follows the technical-writing skill, every layer except Diátaxis. Add the issue as a footer. The person running the session is the author, so there is noCo-Authored-Byor "Generated with" line naming an AI and no session link. -
Validate with the
committing-with-commitlintskill. Read the resolved rules, pipe the complete message through commitlint before committing, and fix only the rules named in brackets. A warning fromreferences-emptyis expected when the user chose to commit without an issue. -
Present the plan. A table with one row per commit, holding number, files and subject. Wait for the user to confirm. If there is exactly one commit and no open question, commit directly. If no user can answer, print the plan and continue.
-
Commit. Per group
git addthe files, thengit commit -F -with a quoted heredoc so quotes in the body survive. commitlint runs in thecommit-msghook and prints the broken rules on rejection, so fix the message and commit again. Never--no-verify, neverHUSKY=0, never--amendunless asked. Afterwards showgit log --oneline -n <count>.
Done when the stage is empty and every new commit passed commitlint.
04 同仓库更多 Skills
why
Use for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds. Discovers available MCPs and queries each evidence category (source control, issue tracker, long-form docs, real-time chat, infrastructure observability, error tracking, product analytics warehouse) in parallel, then returns a cited read on decisions and tradeoffs. Use how for runtime behavior.
tdd
Use only when the user explicitly asks for TDD, a failing test, or a regression test, OR when the bug has an obvious cheap local test target. Skip when the test path is unclear, expensive, integration-heavy, or not requested.
swarm
Fan out N parallel workers, drain them, and return one report. Use for /swarm, 'swarm this', or parallel coverage, races, gauntlets, and exploration.
show-me-your-work
Keep a reviewable decision trail for long-running or unattended work: a TSV log with one row per decision (what, why, evidence, result). Local by default; commit it when a reviewer needs the trail to trust the result. Use for /show-me-your-work, autonomous or multi-phase runs, or work a human reviews after stepping away.
interrogate
Use for "interrogate", "adversarial review", "multi-model review", "challenge this", "stress test this code", "find blind spots", or "tear this apart". Multiple LLM reviewers challenge changes from independent angles.
how
Use for "how does X work", code walkthroughs before changing something, and placement / ownership / layering questions ("where should this live", "which package owns this", "is this the right layer"). Explains subsystem architecture, runtime flow, onboarding mental models. Use why for motivation.