git-commit
Git Commit
Create atomic, well-formatted commits with emoji conventional commit messages.
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).
Use direct git commit flags:
# Subject only
git commit -m "<emoji> <type>: <description>"
# Subject + body
git commit -m "<emoji> <type>: <description>" -m "<optional body>"
# Multiple body paragraphs
git commit -m "<emoji> <type>: <description>" -m "<paragraph 1>" -m "<paragraph 2>"
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-described intent: If the user describes the purpose of changes in the conversation, use that as primary guide but validate against the actual diff — adjust if it doesn't match
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
More from vamdawn/ai-forge
content-summarizer
Fetch, analyze, and summarize web content into structured Obsidian notes. Supports articles, GitHub repositories, and Reddit/HN/Twitter threads. Automatically detects URL type and selects the appropriate fetcher strategy and note template. Triggers include requests like 'summarize this article', 'take notes on this', 'save this repo', 'summarize this thread', or any URL-based request intended to be saved as an Obsidian note.
60semver-release
Automated version release workflow. Analyzes git commit history to infer semantic version, auto-detects version files across ecosystems, updates multilingual CHANGELOGs, creates git commit and tag. Use when: (1) user says "release", "publish version", "bump version", (2) user invokes /release command, (3) preparing to release a new version.
16review-doc
Structured document review and quality improvement. Use when the user asks to review, proofread, check, audit, or improve a document (Markdown, text, or any prose file). Triggers include: 'review this doc', 'check this document', 'proofread', 'audit this spec', 'review and fix', or any request to find and fix issues in written documents. Supports reviewing against referenced standards (PRD, design docs, style guides).
15plan-executor
Orchestrated multi-agent plan execution with TDD and code review. Use when you have a structured plan file to execute via SubAgents. Decomposes tasks, dispatches agents, enforces TDD and code review gates.
13session-summary
分析当前会话内容并按固定格式生成结构化摘要,输出基本信息、会话概要与逐轮明细。触发词:'总结这次会话'、'summarize this session'、'会话总结'、'session summary'、'总结一下'、'生成会话摘要'、'记录本次会话'。
9review-context
从 context engineering 角度审查代码、架构文档、prompt 和设计文档。自动识别内容类型,选择 3-5 个最相关维度进行审查,生成含严重等级和改进建议的结构化报告。触发词:review context、CE 审查、上下文工程审查。
9