Git Commit Conventional
Overview
Generate clear Conventional Commit messages, decide commit grouping, run commit-time checks, and create commit(s) safely.
Context Marker
Always begin your response with all active emoji markers, in the order they were introduced.
Format: "<marker1><marker2><marker3>\n<response>"
The marker for this skill is: 🎯
Workflow
Inspect repository context:
- Run
git log -n 20 --pretty=format:%s for subject style context only.
- Run
git status.
Select the diff to analyze:
- If staged changes exist, use
git diff --staged and ignore unstaged changes.
- If nothing is staged, run
git diff and ask whether to stage all or specific files before committing.
Evaluate commit pressure using balanced thresholds:
- Count changed files and changed lines from the active diff context.
- Classify zone:
green: <=5 files and <=150 changed lines.
yellow: 6-12 files or 151-400 changed lines.
red: >12 files or >400 changed lines.
- Apply zone behavior:
green: proceed with normal commit boundary analysis.
yellow: recommend splitting and record a risk note if user chooses a single commit.
red: require a split plan before proceeding; only continue single-commit flow with explicit user override.
Decide single versus multiple commits with an explicit framework:
- Check logical separation: split when changes serve multiple distinct goals.
- Check file-type mixing: split documentation changes from code changes when they can stand alone.
- Check implementation versus tests: split when test updates are independent from implementation updates.
- Check formatting versus logic: split formatting-only churn from behavior changes.
- Check dependencies versus behavior: split dependency and tooling updates from code behavior changes.
- Check mixed-purpose hunks in the same file: split by hunk when one file contains unrelated intents (for example, rename plus refactor).
- Check size and reviewability: consider splitting broad changes (for example, over roughly 150 changed lines) by module or feature.
- Check issue/feature boundaries: split when multiple bugs or features are addressed in one diff.
- Keep together when changes are small and focused on one purpose.
- Keep together when changes are tightly coupled and splitting would create non-functional or misleading history.
- Keep together when all changes are part of one coherent refactor.
Stage changes intentionally for the selected commit boundary:
- Use
git add -p to stage only relevant hunks when a file mixes logical changes.
- Use
git add -e only when hunk editing is required and apply minimal edits.
- After staging, verify scope with
git diff --staged and git diff before proceeding.
- If partial staging would create a broken intermediate commit, keep dependent hunks together.
Run a concise quality review before committing:
- Check correctness, maintainability, security, performance, and tests.
- Classify findings by severity: Critical, High, Medium, Low.
- Present findings using this structure: Executive Summary; Issues by severity with file/line references; Suggested fixes with brief examples; Positive observations; Actionable next steps.
- If any Critical or High issue is found, stop and request explicit user confirmation before committing.
If .pre-commit-config.yaml exists, run pre-commit run:
- Never bypass hooks.
- For trivial fixes, apply changes, restage files, and rerun hooks with a max of 2 retries.
- Stop retrying when hooks pass, when retries are exhausted, or when reruns make no additional file changes.
- If hooks still fail after retries, stop and ask the user for direction.
- For non-trivial fixes, present the proposed fix to the user and get approval before applying and proceeding.
- Treat formatting-only or whitespace-only hook edits as trivial auto-fixes.
- Track every auto-fixed file and the hook that changed it.
Generate commit message(s) in strict Conventional Commit format:
- Subject must match
<type>(<scope>): <subject> or <type>: <subject>.
- If subject format is invalid, regenerate until format is valid.
- Keep subject imperative and concise.
- If the change is breaking, use
! and add explicit breaking-change explanation in the body and/or footer (BREAKING CHANGE: ...).
- Include body to document context and rationale.
- Only exclude a body when the changes are very, very small.
Apply AI attribution policy before each commit:
- Always include a footer-only
Co-Authored-By attribution on agent-created commits.
- Never mention AI generation in the subject or body.
- Use best effort self-identification to determine AI name and email from runtime/model self-awareness metadata.
- If email is not readily available, use
no-reply@example.com.
- If name is not readily available, use
AI Assistant.
- Never block commit flow by asking the user for attribution identity.
Use deterministic output contract for single-commit and multi-commit runs:
- Before committing, present
Commit Plan:
commit_count
threshold_zone_encountered
boundaries_rationale
scope_per_commit
- Before each commit, present
Per-Commit Preview:
index (i/N)
staged_files
subject
body_present
footers
checks_to_run
- After each commit, present
Per-Commit Result:
hash
subject
hook_result
auto_fix_files
Validate message format and create commit(s):
- Show generated message(s) in chat.
- Run
git commit with the generated message(s).
- For multiple commits, stage the right files before each commit.
- In the final commit summary to the user, include:
- Ordered
<hash> <subject> list.
Pre-commit changes note:
- If auto-fixes were applied, list hook id(s) and file path(s).
- If none were applied, explicitly say
Pre-commit changes: none.
ai_attribution_applied: yes/no.
working_tree_status: clean/not clean.
Mandatory Rules
- Never use hook bypass flags such as
--no-verify or -n.
- Never commit when Critical or High review issues are present unless the user explicitly confirms.
- Never include unrelated files in a commit.
- Never stage an entire file when only some hunks belong to the current commit boundary.
- Always report whether pre-commit auto-fixed files before finalizing the commit result message.
References
- Conventional commit types, scopes, and templates:
references/conventional-commits.md
- Review severity rubric and reporting format:
references/review-guardrails.md
- Commit pressure zones and threshold behavior:
references/commit-hygiene-thresholds.md
- AI attribution policy for commits:
references/ai-attribution.md
1---2name: git-commit-conventional3description: Create Conventional Commit messages and execute safe git commits from working tree changes. Use when users ask to create a commit, write a conventional commit message, split broad changes into multiple commits, stage only parts of files, run pre-commit before committing, or perform a quick commit-time quality review with severity guardrails.4---56# Git Commit Conventional78## Overview910Generate clear Conventional Commit messages, decide commit grouping, run commit-time checks, and create commit(s) safely.1112## Context Marker1314Always begin your response with all active emoji markers, in the order they were introduced.1516Format: `"<marker1><marker2><marker3>\n<response>"`1718The marker for this skill is: `🎯`1920## Workflow21221. Inspect repository context:23 - Run `git log -n 20 --pretty=format:%s` for subject style context only.24 - Run `git status`.251. Select the diff to analyze:26 - If staged changes exist, use `git diff --staged` and ignore unstaged changes.27 - If nothing is staged, run `git diff` and ask whether to stage all or specific files before committing.281. Evaluate commit pressure using balanced thresholds:29 - Count changed files and changed lines from the active diff context.30 - Classify zone:31 - `green`: `<=5` files and `<=150` changed lines.32 - `yellow`: `6-12` files or `151-400` changed lines.33 - `red`: `>12` files or `>400` changed lines.34 - Apply zone behavior:35 - `green`: proceed with normal commit boundary analysis.36 - `yellow`: recommend splitting and record a risk note if user chooses a single commit.37 - `red`: require a split plan before proceeding; only continue single-commit flow with explicit user override.381. Decide single versus multiple commits with an explicit framework:39 - Check logical separation: split when changes serve multiple distinct goals.40 - Check file-type mixing: split documentation changes from code changes when they can stand alone.41 - Check implementation versus tests: split when test updates are independent from implementation updates.42 - Check formatting versus logic: split formatting-only churn from behavior changes.43 - Check dependencies versus behavior: split dependency and tooling updates from code behavior changes.44 - Check mixed-purpose hunks in the same file: split by hunk when one file contains unrelated intents (for example, rename plus refactor).45 - Check size and reviewability: consider splitting broad changes (for example, over roughly 150 changed lines) by module or feature.46 - Check issue/feature boundaries: split when multiple bugs or features are addressed in one diff.47 - Keep together when changes are small and focused on one purpose.48 - Keep together when changes are tightly coupled and splitting would create non-functional or misleading history.49 - Keep together when all changes are part of one coherent refactor.501. Stage changes intentionally for the selected commit boundary:51 - Use `git add -p` to stage only relevant hunks when a file mixes logical changes.52 - Use `git add -e` only when hunk editing is required and apply minimal edits.53 - After staging, verify scope with `git diff --staged` and `git diff` before proceeding.54 - If partial staging would create a broken intermediate commit, keep dependent hunks together.551. Run a concise quality review before committing:56 - Check correctness, maintainability, security, performance, and tests.57 - Classify findings by severity: Critical, High, Medium, Low.58 - Present findings using this structure: Executive Summary; Issues by severity with file/line references; Suggested fixes with brief examples; Positive observations; Actionable next steps.59 - If any Critical or High issue is found, stop and request explicit user confirmation before committing.601. If `.pre-commit-config.yaml` exists, run `pre-commit run`:61 - Never bypass hooks.62 - For trivial fixes, apply changes, restage files, and rerun hooks with a max of 2 retries.63 - Stop retrying when hooks pass, when retries are exhausted, or when reruns make no additional file changes.64 - If hooks still fail after retries, stop and ask the user for direction.65 - For non-trivial fixes, present the proposed fix to the user and get approval before applying and proceeding.66 - Treat formatting-only or whitespace-only hook edits as trivial auto-fixes.67 - Track every auto-fixed file and the hook that changed it.681. Generate commit message(s) in strict Conventional Commit format:69 - Subject must match `<type>(<scope>): <subject>` or `<type>: <subject>`.70 - If subject format is invalid, regenerate until format is valid.71 - Keep subject imperative and concise.72 - If the change is breaking, use `!` and add explicit breaking-change explanation in the body and/or footer (`BREAKING CHANGE: ...`).73 - Include body to document context and rationale.74 - Only exclude a body when the changes are very, very small.751. Apply AI attribution policy before each commit:76 - Always include a footer-only `Co-Authored-By` attribution on agent-created commits.77 - Never mention AI generation in the subject or body.78 - Use best effort self-identification to determine AI name and email from runtime/model self-awareness metadata.79 - If email is not readily available, use `no-reply@example.com`.80 - If name is not readily available, use `AI Assistant`.81 - Never block commit flow by asking the user for attribution identity.821. Use deterministic output contract for single-commit and multi-commit runs:83 - Before committing, present `Commit Plan`:84 - `commit_count`85 - `threshold_zone_encountered`86 - `boundaries_rationale`87 - `scope_per_commit`88 - Before each commit, present `Per-Commit Preview`:89 - `index` (`i/N`)90 - `staged_files`91 - `subject`92 - `body_present`93 - `footers`94 - `checks_to_run`95 - After each commit, present `Per-Commit Result`:96 - `hash`97 - `subject`98 - `hook_result`99 - `auto_fix_files`1001011. Validate message format and create commit(s):102 - Show generated message(s) in chat.103 - Run `git commit` with the generated message(s).104 - For multiple commits, stage the right files before each commit.105 - In the final commit summary to the user, include:106 - Ordered `<hash> <subject>` list.107 - `Pre-commit changes` note:108 - If auto-fixes were applied, list hook id(s) and file path(s).109 - If none were applied, explicitly say `Pre-commit changes: none`.110 - `ai_attribution_applied: yes/no`.111 - `working_tree_status: clean/not clean`.112113## Mandatory Rules114115- Never use hook bypass flags such as `--no-verify` or `-n`.116- Never commit when Critical or High review issues are present unless the user explicitly confirms.117- Never include unrelated files in a commit.118- Never stage an entire file when only some hunks belong to the current commit boundary.119- Always report whether pre-commit auto-fixed files before finalizing the commit result message.120121## References122123- Conventional commit types, scopes, and templates: `references/conventional-commits.md`124- Review severity rubric and reporting format: `references/review-guardrails.md`125- Commit pressure zones and threshold behavior: `references/commit-hygiene-thresholds.md`126- AI attribution policy for commits: `references/ai-attribution.md`