Execute git commit operations when user requests to commit or push code changes. Use this skill to generate recommended commit messages, perform local commits, or push to remote repositories.
Automatically generate high-quality Gitmoji-based Korean commit messages by analyzing code changes, then execute commits and pushes after user approval.
Auto-activate when users request commit actions:
Korean triggers:
English triggers:
Do NOT activate for:
Follow these steps sequentially for every commit request:
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 filesIf AI files detected: Present options and handle user choice.
Options:
Handle user choice:
git restore --staged <files>)Important: Do NOT block or warn about other file types (.env, node_modules, etc.). User manages these via .gitignore/.gitignore_global.
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:
src/user/, src/product/ → module-based groupsUser*.kt, Product*.kt, *Test.kt → domain-based groups*.kt, *.py, *.ts, *.java*Test.kt, *_test.py, *.test.ts, *.spec.jsREADME.md, *.md in docs/package.json, build.gradle, *.toml, *.ymlDetailed grouping strategies: references/grouping_strategies.md
1.5.3 Present grouping to user:
Present suggested grouping with file counts and domain names.
Options:
1.5.4 Handle user choice and execute grouped commits:
For each group, execute Step 2 → Step 3 → Step 4 sequentially.
Edge cases:
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:
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:
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:
❌ MUST NOT include:
UserService, VectorEntityTypeextractVectorFields(), getUserById()userId, searchQueryUserService.kt, auth.controller.js🤖 Generated with..., Co-Authored-By: Claude)Phase 4, T032-1, SC-003)TASK-123, JIRA-456, #789)SC-003, SCENARIO-45)34개 통과, 2개 실패, 커버리지 85%).gitignore, package.json)Complete examples with transformations: references/commit_examples.md
⚠️ 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:
3.3 Handle user choice:
Wait for user selection. Do not assume or skip this step.
do_push=falsedo_push=true⚠️ 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.
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
Common edge cases and how to handle them. For complete details, see references/edge_cases.md.
Quick Reference:
git push -u origin <branch>Full edge case handling: references/edge_cases.md
Before each commit:
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 patternsThis skill implements MY_RULES.md Git workflow rules:
✅ Enforced:
✅ Triggers:
✅ Quality: