--- name: git-commit description: MUST use this skill when user asks to commit, create commit, save work, or mentions "컀밋". This skill OVERRIDES default git commit behavior. Creates commits following Conventional Commits format with emoji + type/scope/subject (✨ feat, πŸ› fix, ♻️ refactor, etc). --- # Git Commit Guide Creates commits using the Conventional Commits format with type, scope, and subject components. ## Quick Start ```bash # 1. Check project conventions cat CLAUDE.md 2>/dev/null | head -30 # 2. Review staged changes git diff --staged --stat git diff --staged # 3. Stage files if needed git add # 4. Create commit with emoji git commit -m "✨ feat(scope): add new feature" ``` ## Commit Structure Format: `emoji type(scope): subject` | Component | Description | Example | |-----------|-------------|---------| | **emoji** | Visual indicator | ✨, πŸ›, ♻️ | | **type** | Change category | `feat`, `fix`, `refactor` | | **scope** | Affected area (kebab-case) | `auth`, `api-client` | | **subject** | What changed (imperative mood) | `add login validation` | **Rules:** - First line ≀ 72 characters - Use imperative mood ("add", not "added" or "adding") - No period at end ## Commit Types with Emoji ### Core Types | Emoji | Type | Purpose | |-------|------|---------| | ✨ | `feat` | New feature | | πŸ› | `fix` | Bug fix | | πŸ“ | `docs` | Documentation | | πŸ’„ | `style` | Formatting/style (no logic change) | | ♻️ | `refactor` | Code refactoring | | ⚑️ | `perf` | Performance improvement | | βœ… | `test` | Add/update tests | | πŸ”§ | `chore` | Tooling, config | | πŸš€ | `ci` | CI/CD improvements | | βͺ️ | `revert` | Revert changes | ### Detailed Types **Features (feat):** | Emoji | Usage | |-------|-------| | 🧡 | Multithreading/concurrency | | πŸ”οΈ | SEO improvements | | 🏷️ | Add/update types | | πŸ’¬ | Text and literals | | 🌐 | Internationalization/localization | | πŸ‘” | Business logic | | πŸ“± | Responsive design | | 🚸 | UX/usability improvements | | πŸ“ˆ | Analytics/tracking | | 🚩 | Feature flags | | πŸ’« | Animations/transitions | | ♿️ | Accessibility | | 🦺 | Validation | | πŸ”Š | Add/update logs | | πŸ₯š | Easter eggs | | πŸ’₯ | Breaking changes | | ✈️ | Offline support | **Fixes (fix):** | Emoji | Usage | |-------|-------| | 🚨 | Compiler/linter warnings | | πŸ”’οΈ | Security issues | | 🩹 | Simple fix for non-critical issue | | πŸ₯… | Catch errors | | πŸ‘½οΈ | External API changes | | πŸ”₯ | Remove code/files | | πŸš‘οΈ | Critical hotfix | | ✏️ | Typos | | πŸ’š | CI build | | πŸ”‡ | Remove logs | **Refactor:** | Emoji | Usage | |-------|-------| | 🚚 | Move/rename resources | | πŸ—οΈ | Architectural changes | | 🎨 | Improve structure/format | | ⚰️ | Remove dead code | **Chore:** | Emoji | Usage | |-------|-------| | πŸ‘₯ | Add/update contributors | | πŸ”€ | Merge branches | | πŸ“¦οΈ | Compiled files/packages | | βž• | Add dependency | | βž– | Remove dependency | | 🌱 | Seed files | | πŸ§‘β€πŸ’» | Developer experience | | πŸ™ˆ | .gitignore | | πŸ“Œ | Pin dependencies | | πŸ‘· | CI build system | | πŸ“„ | License | | πŸŽ‰ | Begin project | | πŸ”– | Release/version tags | | 🚧 | Work in progress | **Database/Assets:** | Emoji | Usage | |-------|-------| | πŸ—ƒοΈ | Database changes | | 🍱 | Assets | **Test:** | Emoji | Usage | |-------|-------| | πŸ§ͺ | Add failing test | | 🀑 | Mock things | | πŸ“Έ | Snapshots | | βš—οΈ | Experiments | ## Commit Scope (Logical Atomicity) **MUST FOLLOW:** Do not commit per file. Commit per **feature unit**. - **Principle:** If you modified `main.py`, `utils.py`, `config.yaml` to develop Feature A, these 3 files **MUST be in a single commit**. - **Reason:** When reverting to a specific commit, that feature should work completely. **❌ Bad Example** (νŒŒμΌλ³„λ‘œ 뢄리 컀밋 - κΈ°λŠ₯ λ‹¨μœ„κ°€ μ•„λ‹˜) ```bash git add search.py git commit -m "✨ feat: create search module" git add api.py git commit -m "πŸ› fix: fix api connection" ``` **βœ… Good Example** ```bash git add search.py api.py git commit -m "✨ feat(search): implement keyword search with API endpoint" ``` ## Result-Oriented Messages **MUST FOLLOW:** Do not write conversation history (process). Write only the **final code changes (result)**. Even if there were 10 modifications during development (error fixes, typo fixes, etc.), the commit message should only state the finally implemented feature. | ❌ Bad (Process) | βœ… Good (Result) | |------------------|------------------| | "Fixed typo, fixed A function error, added library to implement login" | `✨ feat(auth): implement JWT-based login` | | "fix api connection and variable name errors and import errors" | `✨ feat(search): implement keyword search` | ## Core Workflow ### 1. Check Project Conventions ```bash cat CLAUDE.md 2>/dev/null | head -30 ``` Always check for project-specific commit rules. ### 2. Review Staged Changes ```bash git diff --staged --stat git diff --staged ``` Understand what's being committed. ### 3. Analyze Changes Identify: - Primary type (feat > fix > refactor) - Scope (module/component affected) - Summary (what changed, in imperative mood) ### 4. Create Commit ```bash git commit -m "emoji type(scope): subject" # Example: git commit -m "✨ feat(auth): add login validation" ``` ### 5. Add Body (if needed) For complex changes: ```bash git commit -m "$(cat <<'EOF' ✨ feat(scope): subject Body explaining WHY and HOW. Wrap at 72 characters. Refs: #123 EOF )" ``` ## Breaking Changes Add exclamation mark (!) after type/scope for breaking changes: ```bash git commit -m "πŸ’₯ feat(api)!: change response format" ``` Or use footer: ```bash git commit -m "$(cat <<'EOF' πŸ’₯ feat(api): change response format BREAKING CHANGE: Response now returns array instead of object. EOF )" ``` ## Subject Line Rules - **DO**: Use imperative mood ("add", "fix", "change") - **DO**: Keep under 50 characters - **DO**: Start lowercase after colon - **DON'T**: End with period - **DON'T**: Use vague words ("update", "improve", "change stuff") ## Review Fix Commits When addressing PR review comments: ```bash git commit -m "$(cat <<'EOF' πŸ› fix(scope): address review comment #ID Brief explanation of what was wrong and how it's fixed. Addresses review comment #123456789. EOF )" ``` ## Commit Split Guidelines When analyzing diffs, consider splitting commits based on: | Criteria | Description | |----------|-------------| | **Different concerns** | Changes to unrelated parts of codebase | | **Change types** | Feature vs bug fix vs refactoring | | **File patterns** | Source code vs documentation vs config | | **Logical grouping** | Changes easier to review separately | | **Size** | Very large changes that benefit from granularity | **Split Example:** ``` 1st: ✨ feat: add new solc version type definitions 2nd: πŸ“ docs: update documentation for new solc version 3rd: πŸ”§ chore: update package.json dependencies 4th: 🏷️ feat: add type definitions for new API endpoints 5th: 🧡 feat: improve worker thread concurrency handling 6th: 🚨 fix: resolve linting issues in new code 7th: βœ… test: add unit tests for new solc version features 8th: πŸ”’οΈ fix: update dependencies for security vulnerabilities ``` ## Pre-Commit Checklist Before creating a commit, ask yourself: 1. **Are all related files included?** (Are all dependency files modified for the feature `git add`ed?) 2. **Is the message clean?** (Does it contain only the core implementation without repetitive "fix", "modify"?) 3. **Is it the diff from previous commit?** (Did you summarize `git diff` content, not conversation log?) ## Good Commit Examples ``` ✨ feat: add user authentication system πŸ› fix: resolve memory leak in rendering process πŸ“ docs: update API documentation with new endpoints ♻️ refactor: simplify error handling logic in parser 🚨 fix: resolve linter warnings in component files πŸ§‘β€πŸ’» chore: improve developer tools setup process πŸ‘” feat: implement business logic for transaction validation 🩹 fix: resolve minor style inconsistency in header πŸš‘οΈ fix: patch critical security vulnerability in auth flow 🎨 style: restructure component for better readability πŸ”₯ fix: remove deprecated legacy code 🦺 feat: add input validation for user registration form πŸ’š fix: resolve CI pipeline test failures πŸ“ˆ feat: implement tracking for user engagement analytics πŸ”’οΈ fix: strengthen authentication password requirements ♿️ feat: improve form accessibility for screen readers ``` ## Important Rules - **ALWAYS** check project conventions (CLAUDE.md) before committing - **ALWAYS** review staged changes before committing - **ALWAYS** commit per feature unit, not per file - **ALWAYS** write result-oriented messages (final changes only) - **ALWAYS** use imperative mood in subject ("add", not "added") - **ALWAYS** include appropriate emoji at the start - **ALWAYS** keep first line ≀ 72 characters - **ALWAYS** use HEREDOC for multi-line messages - **NEVER** stage secrets, credentials, or large binaries - **NEVER** use vague subjects ("fix bug", "update code") - **NEVER** list process steps in commit message - **NEVER** end subject with period