git-commit
npx skills add https://github.com/vamdawn/ai-forge --skill git-commit
Agent 安装分布
Skill 文档
Git Commit
Create atomic, well-formatted commits with emoji conventional commit messages. $ARGUMENTS
Workflow
Step 1: Assess
Run git status. Then check:
Abort if:
- Unresolved merge conflicts exist â inform the user and STOP
- No modified, staged, or untracked files exist â inform the user and STOP
Gather context:
git log --oneline -5â learn the project’s existing commit stylegit diff --stagedif files are already staged; otherwisegit difffor tracked files- For untracked files shown in
git status, useReadto view their content
If files are already staged: work with ONLY those files. Do NOT stage additional files.
Step 2: Classify and Group
For each changed file, determine its type (feat/fix/refactor/docs/…) and concern (which subsystem or feature it belongs to).
Group into logical units â each one a single coherent purpose that stands alone as a git log entry. Apply keep-together rules first to form atomic units, then evaluate split rules between those units.
Split when ANY apply:
- Changes serve different purposes (bug fix + new feature)
- Changes touch unrelated subsystems (backend API + frontend CSS)
- Source code changes mixed with unrelated documentation
- Diff exceeds ~200 lines with separable concerns
- Formatting/style changes mixed with logic changes
Keep together:
- Feature/fix + its tests
- Code + its type definitions
- Multi-file rename of the same symbol
- Code + documentation describing that same code
Step 3: Stage
Single logical unit â git add <file1> <file2> ..., proceed to Step 4.
Multiple logical units â
- Present the plan:
N logical groups: 1. [type]: [desc] (files) 2. ... - STOP and wait for the user to confirm â do not proceed until they respond
- For each group (foundational changes first): stage â commit (Step 4) â loop back
Rules:
- ALWAYS use explicit file paths â NEVER
git add -Aorgit add . - NEVER stage secret files (.env, credentials, keys, tokens) â warn the user and skip
Step 4: Commit
Format: <emoji> <type>: <description>
Rules:
- Imperative mood, present tense (“add” not “added”)
- Subject line under 72 characters
- Lowercase after colon (“feat: add…” not “feat: Add…”)
- No co-authorship footer
- Match project’s commit style observed in Step 1
| Type | Emoji | When to use |
|---|---|---|
| feat | ⨠| New user-facing or API-facing functionality |
| fix | ð | Corrects incorrect behavior |
| docs | ð | Documentation-only changes |
| style | ð | Formatting, whitespace, semicolons |
| refactor | â»ï¸ | Restructures without changing behavior |
| perf | â¡ï¸ | Measurable performance improvement |
| test | â | Test-only changes |
| chore | ð§ | Build, tooling, dependencies, config |
| ci | ð | CI/CD pipeline changes |
| revert | âªï¸ | Reverts a previous commit |
Critical overrides (always use instead of the base emoji):
ð¥for ANY breaking change âð¥ feat: ...ðï¸for production-critical hotfixes âðï¸ fix: ...ðï¸for security vulnerability fixes âðï¸ fix: ...
For other specialized sub-types, read references/emoji-mapping.md for 50+ emoji.
Add a body (blank line after subject) when the “why” isn’t obvious, breaking changes need explanation, or the commit closes an issue (Closes #NNN).
Always use HEREDOC syntax:
git commit -m "$(cat <<'EOF'
<emoji> <type>: <description>
<optional body>
EOF
)"
Step 5: Verify
git log --oneline -3â confirm the commit message matches the expected format- If groups remain from Step 3, return to Step 3
- After all commits:
git statusto confirm no unintended changes remain
If commit failed (pre-commit hook, etc.): inform the user of the error and STOP. Do NOT use --amend â the failed commit was never created. On re-invocation, create a NEW commit.
Edge Cases
- Binary files: Note in commit context; do not analyze diff content
- Large changesets (>500 lines): Always propose splitting, even if changes appear to be a single logical unit
- User hint via $ARGUMENTS: Use as primary guide but validate against the actual diff â adjust if hint doesn’t match changes
Examples
Single commit:
⨠feat: add user authentication with JWT tokens
With body:
ð¥ feat: migrate API response format to v2
The old format nested data under `response.data`. The new format puts it
at the top level. This is a breaking change for all API consumers.
Closes #234
Split commits (refactored shared module + added feature with tests + unrelated docs):
â»ï¸ refactor: extract validation logic into shared module⨠feat: add email format validation with unit testsð docs: update project setup guide