smart-git-commit
npx skills add https://github.com/muheun/claude-code-marketplace --skill smart-git-commit
Agent 安装分布
Skill 文档
Smart Git Commit
Automatically generate high-quality Gitmoji-based Korean commit messages by analyzing code changes, then execute commits and pushes after user approval.
When to Use This Skill
Auto-activate when users request commit actions:
Korean triggers:
- “커ë°í´ì¤” / “커ë°í´” / “커바
- “ì ì¥í´ì¤” / “ì ì¥í´”
- “í¸ìí´ì¤” / “í¸ìí´” / “í¸ì”
English triggers:
- “commit” / “commit this” / “create commit”
- “push” / “push changes” / “commit and push”
- “save” / “save changes”
Do NOT activate for:
- General git questions or explanations
- Browsing commit history
- Code review without commit intent
Workflow
Follow these steps sequentially for every commit request:
- Step 1: Analyze changes (with optional grouping for large changesets)
- Step 2: Generate commit message (for each group if grouped)
- Step 3: User approval
- Step 4: Execute commit (single or multiple commits)
Step 1: Analyze Changes
Use Bash tool to analyze git repository and detect violations.
1.1 Check if git repository:
git rev-parse --git-dir 2>/dev/null
If fails â “íì¬ ëë í ë¦¬ê° Git ì ì¥ìê° ìëëë¤.”
1.2 Check changes:
git status --porcelain
If empty â “ë³ê²½ì¬íì´ ììµëë¤.”
1.3 Get detailed diff:
# Staged changes
git diff --cached
# Unstaged changes (if needed)
git diff
# Statistics
git diff --cached --stat
1.4 Check AI-related files:
Principle: Respect user’s .gitignore configuration. Files that passed .gitignore are trusted. Only verify AI-related files require user confirmation.
git diff --cached --name-only
AI-related file patterns (â ï¸ User confirmation required):
claudedocs/– Claude Code analysis/reports.claude/– Claude Code configuration*.ai.md,*.claude.md– AI-generated markdown.cursor/– Cursor IDE configuration*.copilot.md– GitHub Copilot files.aider*,aider.*.md– Aider AI files*.gpt.md– ChatGPT related files
If AI files detected: Present options and handle user choice.
Options:
- â Proceed with commit (include AI files)
- ð« Exclude AI files from this commit
- â Cancel
Handle user choice:
- Choice 1: Continue with all files
- Choice 2: Remove AI files from staging (
git restore --staged <files>) - Choice 3: Stop workflow
Important: Do NOT block or warn about other file types (.env, node_modules, etc.). User manages these via .gitignore/.gitignore_global.
Step 1.5: Logical Grouping (Optional)
Activation trigger: Large changeset (10+ files) OR user explicitly requests commit splitting.
1.5.1 Analyze for grouping potential:
# Count changed files
git diff --cached --name-only | wc -l
If â¥10 files, analyze for logical grouping.
1.5.2 Grouping analysis criteria:
Analyze file relationships using:
- Directory structure:
src/user/,src/product/â module-based groups - File naming patterns:
User*.kt,Product*.kt,*Test.ktâ domain-based groups - Change types:
- Implementation files:
*.kt,*.py,*.ts,*.java - Test files:
*Test.kt,*_test.py,*.test.ts,*.spec.js - Documentation:
README.md,*.mdindocs/ - Configuration:
package.json,build.gradle,*.toml,*.yml
- Implementation files:
- Semantic relationships: Analyze diff content to detect related changes
Detailed grouping strategies: references/grouping_strategies.md
1.5.3 Present grouping to user:
Present suggested grouping with file counts and domain names.
Options:
- â Create separate commits (recommended)
- â ï¸ Create 1 combined commit
- âï¸ Modify grouping
- â Cancel
1.5.4 Handle user choice and execute grouped commits:
For each group, execute Step 2 â Step 3 â Step 4 sequentially.
Edge cases:
- If grouping is unclear or ambiguous â fallback to single commit
- If user requests custom grouping â accept user’s grouping logic
- Files <10 â skip grouping, proceed directly to Step 2
Step 2: Generate Commit Message
Use Claude’s natural language processing to generate message from diff analysis.
2.1 Analyze diff semantically:
Read the actual code changes from git diff --cached output:
- What functionality was added/changed?
- What bugs were fixed?
- What was refactored?
2.2 Select Gitmoji:
Based on change type, refer to references/gitmoji_rules.md for complete guidelines.
Quick Reference: ⨠feat | ð fix | â»ï¸ refactor | â¡ perf | â test | ð docs | ð§ chore
Priority when multiple types:
- feat > fix > refactor > perf > others
- Choose the most significant change
Complete Gitmoji mapping: references/gitmoji_rules.md
2.3 Generate Korean summary:
Format:
<gitmoji> <type>: íê¸ íµì¬ ìì½ (max 50 chars)
- íµì¬ ë³ê²½ì¬í 1 (1ì¤, ê°ê²°)
- íµì¬ ë³ê²½ì¬í 2 (1ì¤, ê°ê²°)
- íµì¬ ë³ê²½ì¬í 3 (1ì¤, ê°ê²°)
2.4 Quality rules:
â MUST follow:
- Focus on WHAT, WHY, HOW – not tracking info
- WHAT: 무ìì ê°ë°/ê°ì /í´ê²°íëê° (íì)
- WHY: ì íìíëê° (ì íì )
- HOW: ì´ë»ê² 구ííëê° (íµì¬ë§)
- Domain-centric language (not code-centric)
- Use general terms: “ì¬ì©ì ì¸ì¦”, “ê²ì 기륔, “ë°ì´í° ê³ì¸µ”
- Avoid specific names: class/method/variable names, file names
- Korean-first (title and body)
- Imperative form (“ì¶ê°” not “ì¶ê°íìµë뤔)
- Under 300 characters total
- 3-4 bullet points (each 1 line)
- Production code changes only
â MUST NOT include:
- Code references:
- Class names:
UserService,VectorEntityType - Method names:
extractVectorFields(),getUserById() - Variable names:
userId,searchQuery - File names:
UserService.kt,auth.controller.js
- Class names:
- AI signatures (
ð¤ Generated with...,Co-Authored-By: Claude) - Tracking codes (
Phase 4,T032-1,SC-003) - Task/Issue IDs (
TASK-123,JIRA-456,#789) - Scenario IDs (
SC-003,SCENARIO-45) - Test statistics (
34ê° íµê³¼,2ê° ì¤í¨,커ë²ë¦¬ì§ 85%) - Work report info (ìì 리í¬í¸ì© ì ë³´)
- Past tense (íìµëë¤, íì)
- File-by-file descriptions
- Configuration file details (
.gitignore,package.json) - Verbose explanations
Complete examples with transformations: references/commit_examples.md
Step 3: Show Message and Get User Approval
â ï¸ CRITICAL RULE – NEVER SKIP THIS STEP
This step is mandatory and must never be skipped under any circumstances. Always show the generated commit message to the user and wait for explicit approval before proceeding to commit execution.
3.1 Display the generated message:
MUST use AskUserQuestion tool to present the commit message to the user. Do not proceed to Step 4 without completing this interaction.
Message format:
ð Generated commit message:
<full message>
Choose an action:
3.2 Provide exactly 4 options:
- Commit only – Execute local commit
- Commit + Push – Commit and push to remote
- Modify message – Let user edit message
- Cancel – Abort commit
3.3 Handle user choice:
Wait for user selection. Do not assume or skip this step.
- Choice 1: User approved â Proceed to Step 4 with
do_push=false - Choice 2: User approved with push â Proceed to Step 4 with
do_push=true - Choice 3: User requests modification â Ask user for new message, then proceed to Step 4
- Choice 4: User cancelled â Stop workflow entirely
â ï¸ Enforcement: If you proceed to Step 4 without completing Step 3, you are violating the core workflow. The user must see the message and make an explicit choice.
Step 4: Execute Commit
Use Bash tool to execute git operations.
4.1 Stage files:
# Stage all changes
git add .
# Or stage specific files (if user specified)
git add "file1.kt" "file2.py"
4.2 Commit with heredoc:
Use heredoc to safely handle special characters:
git commit -m "$(cat <<'EOF'
⨠feat: ì¬ì©ì ì¸ì¦ API 구í
- JWT í í° ê¸°ë° ì¸ì¦
- 리íë ì í í° ìë ê°±ì
- ë¡ê·¸ì¸/ë¡ê·¸ìì ìëí¬ì¸í¸
EOF
)"
4.3 Push (optional):
If user chose “Commit + Push”:
git push origin HEAD
4.4 Report results:
Success:
â
Commit completed: <commit hash>
ð Pushed to: origin/<branch>
Failure:
â Commit failed: <error message>
Possible causes:
- Pre-commit hooks blocked
- Merge conflict detected
- No changes staged
Push failure (after successful commit):
â
Commit completed: <commit hash>
â ï¸ Push failed: <error message>
Your changes are committed locally.
Try: git push origin HEAD
Edge Cases
Common edge cases and how to handle them. For complete details, see references/edge_cases.md.
Quick Reference:
- Empty commit â Suggest generic message
- Mixed types â Priority: feat > fix > refactor
- Large diff (>500 lines) â Warn and suggest split
- Unstaged changes â Offer options: staged only / stage all / cancel
- Pre-commit hook failure â Never bypass with –no-verify
- No remote branch â Offer
git push -u origin <branch> - Merge conflict â Request resolution before commit
- Detached HEAD â Suggest creating branch
Full edge case handling: references/edge_cases.md
Checklist
Before each commit:
- User explicitly requested commit
- Git repository verified
- Changes detected (not empty)
- AI-related files confirmed by user (if any)
- Correct Gitmoji selected
- Korean message (imperative form)
- Domain-centric language (no class/method/variable names)
- Under 300 characters total
- No AI signature, tracking codes, or test statistics
- User approved message
References
Detailed reference materials:
references/gitmoji_rules.md– Complete Gitmoji mapping (20+ entries) and selection guidelinesreferences/commit_examples.md– Extensive good/bad examples with code reference transformationsreferences/edge_cases.md– Detailed edge case scenarios and solutionsreferences/grouping_strategies.md– Advanced grouping algorithms and project-specific patterns
Integration with MY_RULES.md
This skill implements MY_RULES.md Git workflow rules:
â Enforced:
- Git ì»¤ë° ì smart-git-commit ì¤í¬ ì¬ì©
- Bash ì§ì ì²ë¦¬ ê¸ì§
- íê¸ ì»¤ë° ë©ìì§
- AI ìëª ì ë ê¸ì§
- í´ëì¤/ë©ìë/ë³ìëª ì§ì ì¸ê¸ ê¸ì§
â Triggers:
- “커바, “커ë°í´ì¤”, “commit”, “push”, “í¸ì”
â Quality:
- Gitmoji + íê¸ ë©ìì§ ìë ìì±
- ëë©ì¸ ì¤ì¬ ì¸ì´ ì¬ì©
- 300ì ì í ì¤ì
- ì¬ì©ì ì¹ì¸ íì