commit
1
总安装量
1
周安装量
#54825
全站排名
安装命令
npx skills add https://github.com/nbsp1221/agent-skills --skill commit
Agent 安装分布
cursor
1
codex
1
claude-code
1
Skill 文档
Commit
Follow the repo’s existing convention, create the commit, verify, and push when requested. Use the reference docs for detailed rules.
Workflow
-
Identify the convention
- Read agent guidance first:
AGENTS.md,CLAUDE.md, etc. - Check repo guidance or templates if present:
CONTRIBUTING.md,README.md, commit templates, etc. - Scan history:
git log -n 50 --pretty=%s - Choose exactly one: Conventional Commits, Gitmoji, or Custom.
- If ambiguous, pause and ask using the user input guidance below.
- Never invent new commit types or emoji codes.
- Read agent guidance first:
-
Pull if requested
- If
--pullis set, rungit pullbefore reviewing changes. - If conflicts occur, try to resolve them. If you cannot, pause and ask using the user input guidance below.
- If
-
Review changes
git status -sbgit diff --statgit diff(orgit diff --staged)- Split unrelated changes into separate commits.
-
Stage intentionally
- Prefer
git add -porgit add <files> - Do not stage secrets or large generated artifacts unless explicitly requested.
- Prefer
-
Run verify steps
- If the repo has tests, lint, or format checks, run them before committing.
- Only proceed if they pass, unless the user requests
--no-verify. - If checks fail, try to resolve them. If you cannot, pause and ask using the user input guidance below.
-
Compose the message
- If a convention is identified, you MUST open the matching reference and follow its rules before composing the message.
- Conventional Commits: follow
references/conventional-commits.md. - Gitmoji: follow
references/gitmoji.md. - Custom template: follow the exact pattern from history or the template file.
- Use a body and trailers when needed (blank line before body, wrap at 72 chars).
-
Commit, inspect, and push
- ALWAYS run the commit through the guard script (do not use
git commitdirectly):- Resolve
{baseDir}(the installed skill root) before running:- Check project-scoped installs first:
./.claude/skills/commit,./.codex/skills/commit,./.opencode/skills/commit - Then check user-scoped installs:
~/.claude/skills/commit,~/.codex/skills/commit,~/.opencode/skills/commit
- Check project-scoped installs first:
- Use
{baseDir}/scripts/commit-guard.py:python {baseDir}/scripts/commit-guard.py --convention <conventional|gitmoji|custom> --message "subject"python {baseDir}/scripts/commit-guard.py --convention <conventional|gitmoji|custom> --file <path>
- If
{baseDir}cannot be found, pause and ask the user for the exact skill install path.
- Resolve
git log -1 --format="%h %s"git show --stat- If
--pushis set, push to the current branch after commit. - If push fails, pause and ask using the user input guidance below.
- ALWAYS run the commit through the guard script (do not use
Commit guard script
Use the guard script to validate and create commits.
Run python {baseDir}/scripts/commit-guard.py --help for full usage (after resolving {baseDir}).
--convention(required):conventional,gitmoji, orcustom--message(required unless--file): commit message string--file(required unless--message): path to commit message file--dry-run(optional): validate only; do not run git commit
User input guidance
If you cannot proceed, pause and ask. Examples include: ambiguous convention, unresolved conflicts, failed checks, or a failed push.
- Summarize the current state and what you attempted.
- Offer a recommended option and why.
- List alternative options the user can choose.
Options
These options can be expressed in natural language, not just the flag form.
Honor the user’s explicit request even if it does not use --flag syntax.
--dry-run: analyze changes and recommend a commit message, but do not commit or push--no-verify: skip tests, lint, and format checks even if they exist--pull: rungit pullbefore reviewing changes; attempt conflict resolution--push: push to the current branch after commit
Important Rules
- ALWAYS identify the repo convention and follow it over defaults.
- ALWAYS open the matching reference and follow its rules before composing the message.
- ALWAYS run verify steps if they exist, unless the user requests
--no-verify. - ALWAYS use
scripts/commit-guard.pyto create commits. - ALWAYS summarize state and propose options when you need user input.
- NEVER invent new commit types or emoji codes.
- NEVER stage secrets or large generated artifacts unless explicitly requested.
- NEVER run
git commitdirectly. - NEVER push unless the user explicitly requests a push (via
--pushor natural language). - NEVER compose a commit message without checking the matching reference.
References
references/conventional-commits.mdreferences/gitmoji.md