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.
Pull if requested
- If
--pull is set, run git pull before reviewing changes.
- If conflicts occur, try to resolve them. If you cannot, pause and ask using the user input guidance below.
Review changes
git status -sb
git diff --stat
git diff (or git diff --staged)
- Split unrelated changes into separate commits.
Stage intentionally
- Prefer
git add -p or git add <files>
- Do not stage secrets or large generated artifacts unless explicitly requested.
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 commit directly):
- 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
- 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.
git log -1 --format="%h %s"
git show --stat
- If
--push is set, push to the current branch after commit.
- If push fails, pause and ask using the user input guidance below.
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, or custom
--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: run git pull before 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.py to 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 commit directly.
- NEVER push unless the user explicitly requests a push (via
--push or natural language).
- NEVER compose a commit message without checking the matching reference.
References
references/conventional-commits.md
references/gitmoji.md
1---2name: commit3description: Detect the repo's commit convention (Conventional Commits, Gitmoji, or a custom template) and create commits. Use when asked to commit, write a commit message, stage and commit changes, or commit and push work.4---56# Commit78Follow the repo's existing convention, create the commit, verify, and push when requested.9Use the reference docs for detailed rules.1011## Workflow12131. Identify the convention14 - Read agent guidance first: `AGENTS.md`, `CLAUDE.md`, etc.15 - Check repo guidance or templates if present: `CONTRIBUTING.md`, `README.md`, commit templates, etc.16 - Scan history: `git log -n 50 --pretty=%s`17 - Choose exactly one: Conventional Commits, Gitmoji, or Custom.18 - If ambiguous, pause and ask using the user input guidance below.19 - Never invent new commit types or emoji codes.20212. Pull if requested22 - If `--pull` is set, run `git pull` before reviewing changes.23 - If conflicts occur, try to resolve them. If you cannot, pause and ask using the user input guidance below.24253. Review changes26 - `git status -sb`27 - `git diff --stat`28 - `git diff` (or `git diff --staged`)29 - Split unrelated changes into separate commits.30314. Stage intentionally32 - Prefer `git add -p` or `git add <files>`33 - Do not stage secrets or large generated artifacts unless explicitly requested.34355. Run verify steps36 - If the repo has tests, lint, or format checks, run them before committing.37 - Only proceed if they pass, unless the user requests `--no-verify`.38 - If checks fail, try to resolve them. If you cannot, pause and ask using the user input guidance below.39406. Compose the message41 - If a convention is identified, you MUST open the matching reference and follow its rules before composing the message.42 - Conventional Commits: follow `references/conventional-commits.md`.43 - Gitmoji: follow `references/gitmoji.md`.44 - Custom template: follow the exact pattern from history or the template file.45 - Use a body and trailers when needed (blank line before body, wrap at 72 chars).46477. Commit, inspect, and push48 - ALWAYS run the commit through the guard script (do not use `git commit` directly):49 - Resolve `{baseDir}` (the installed skill root) before running:50 - Check project-scoped installs first: `./.claude/skills/commit`, `./.codex/skills/commit`, `./.opencode/skills/commit`51 - Then check user-scoped installs: `~/.claude/skills/commit`, `~/.codex/skills/commit`, `~/.opencode/skills/commit`52 - Use `{baseDir}/scripts/commit-guard.py`:53 - `python {baseDir}/scripts/commit-guard.py --convention <conventional|gitmoji|custom> --message "subject"`54 - `python {baseDir}/scripts/commit-guard.py --convention <conventional|gitmoji|custom> --file <path>`55 - If `{baseDir}` cannot be found, pause and ask the user for the exact skill install path.56 - `git log -1 --format="%h %s"`57 - `git show --stat`58 - If `--push` is set, push to the current branch after commit.59 - If push fails, pause and ask using the user input guidance below.6061## Commit guard script6263Use the guard script to validate and create commits.64Run `python {baseDir}/scripts/commit-guard.py --help` for full usage (after resolving `{baseDir}`).6566- `--convention` (required): `conventional`, `gitmoji`, or `custom`67- `--message` (required unless `--file`): commit message string68- `--file` (required unless `--message`): path to commit message file69- `--dry-run` (optional): validate only; do not run git commit7071## User input guidance7273If you cannot proceed, pause and ask. Examples include: ambiguous convention, unresolved conflicts, failed checks, or a failed push.7475- Summarize the current state and what you attempted.76- Offer a recommended option and why.77- List alternative options the user can choose.7879## Options8081These options can be expressed in natural language, not just the flag form.82Honor the user's explicit request even if it does not use `--flag` syntax.8384- `--dry-run`: analyze changes and recommend a commit message, but do not commit or push85- `--no-verify`: skip tests, lint, and format checks even if they exist86- `--pull`: run `git pull` before reviewing changes; attempt conflict resolution87- `--push`: push to the current branch after commit8889## Important Rules9091- **ALWAYS** identify the repo convention and follow it over defaults.92- **ALWAYS** open the matching reference and follow its rules before composing the message.93- **ALWAYS** run verify steps if they exist, unless the user requests `--no-verify`.94- **ALWAYS** use `scripts/commit-guard.py` to create commits.95- **ALWAYS** summarize state and propose options when you need user input.96- **NEVER** invent new commit types or emoji codes.97- **NEVER** stage secrets or large generated artifacts unless explicitly requested.98- **NEVER** run `git commit` directly.99- **NEVER** push unless the user explicitly requests a push (via `--push` or natural language).100- **NEVER** compose a commit message without checking the matching reference.101102## References103104- `references/conventional-commits.md`105- `references/gitmoji.md`