Back to catalog

Commit

Create well-formatted commits with conventional commit format and emoji

  • Category: Git Workflow
  • Tags: git, commit, conventional-commits, emoji, workflow
  • Downloads: 0
  • Updated: 2025-11-09

Syntax

/commit

Command

{"argument_hint": "[message] | --no-verify | --amend", "allowed_tools": "Bash(git add:*), Bash(git status:*), Bash(git commit:*), Bash(git diff:*), Bash(git log:*)", "model": null, "disable_model_invocation": false, "markdown_body": "# Smart Git Commit\n\nCreate well-formatted commit: $ARGUMENTS\n\n## Current Repository State\n\n- Git status: !`git status --porcelain`\n- Current branch: !`git branch --show-current`\n- Staged changes: !`git diff --cached --stat`\n- Unstaged changes: !`git diff --stat`\n- Recent commits: !`git log --oneline -5`\n\n## What This Command Does\n\n1. Unless specified with `--no-verify`, automatically runs pre-commit checks:\n   - `npm run lint` or `pnpm lint` to ensure code quality\n   - `npm run build` or `pnpm build` to verify the build succeeds\n   - `npm run test` or `pnpm test` to run tests\n2. Checks which files are staged with `git status`\n3. If 0 files are staged, automatically adds all modified and new files with `git add`\n4. Performs a `git diff` to understand what changes are being committed\n5. Analyzes the diff to determine if multiple distinct logical changes are present\n6. If multiple distinct changes are detected, suggests breaking the commit into multiple smaller commits\n7. For each commit (or the single commit if not split), creates a commit message using emoji conventional commit format\n\n## Best Practices for Commits\n\n- **Verify before committing**: Ensure code is linted, builds correctly, and tests pass\n- **Atomic commits**: Each commit should contain related changes that serve a single purpose\n- **Split large changes**: If changes touch multiple concerns, split them into separate commits\n- **Conventional commit format**: Use the format `<type>: <description>` where type is one of:\n  - `feat`: A new feature\n  - `fix`: A bug fix\n  - `docs`: Documentation changes\n  - `style`: Code style changes (formatting, etc)\n  - `refactor`: Code changes that neither fix bugs nor add features\n  - `perf`: Performance improvements\n  - `test`: Adding or fixing tests\n  - `chore`: Changes to the build process, tools, etc.\n- **Present tense, imperative mood**: Write commit messages as commands (e.g., \"add feature\" not \"added feature\")\n- **Concise first line**: Keep the first line under 72 characters\n- **Emoji**: Each commit type is paired with an appropriate emoji:\n  - ✨ `feat`: New feature\n  - 🐛 `fix`: Bug fix\n  - 📝 `docs`: Documentation\n  - 💄 `style`: Formatting/style\n  - ♻️ `refactor`: Code refactoring\n  - ⚡️ `perf`: Performance improvements\n  - ✅ `test`: Tests\n  - 🔧 `chore`: Tooling, configuration\n  - 🚀 `ci`: CI/CD improvements\n  - 🗑️ `revert`: Reverting changes\n  - 🚨 `fix`: Fix compiler/linter warnings\n  - 🔒️ `fix`: Fix security issues\n  - 🏗️ `refactor`: Make architectural changes\n  - 💥 `feat`: Introduce breaking changes\n  - ♿️ `feat`: Improve accessibility\n\n## Guidelines for Splitting Commits\n\nWhen analyzing the diff, consider splitting commits based on these criteria:\n\n1. **Different concerns**: Changes to unrelated parts of the codebase\n2. **Different types of changes**: Mixing features, fixes, refactoring, etc.\n3. **File patterns**: Changes to different types of files (e.g., source code vs documentation)\n4. **Logical grouping**: Changes that would be easier to understand or review separately\n5. **Size**: Very large changes that would be clearer if broken down\n\n## Examples\n\nGood commit messages:\n- ✨ feat: add user authentication system\n- 🐛 fix: resolve memory leak in rendering process\n- 📝 docs: update API documentation with new endpoints\n- ♻️ refactor: simplify error handling logic in parser\n- 🚨 fix: resolve linter warnings in component files\n- 🔒️ fix: strengthen authentication password requirements\n- ♿️ feat: improve form accessibility for screen readers\n\n## Command Options\n\n- `--no-verify`: Skip running the pre-commit checks (lint, build, test)\n- `--amend`: Amend the previous commit instead of creating a new one\n\n## Important Notes\n\n- By default, pre-commit checks will run to ensure code quality\n- If these checks fail, you'll be asked if you want to proceed with the commit anyway or fix the issues first\n- If specific files are already staged, the command will only commit those files\n- If no files are staged, it will automatically stage all modified and new files\n- The commit message will be constructed based on the changes detected\n- Before committing, the command will review the diff to identify if multiple commits would be more appropriate\n- If suggesting multiple commits, it will help you stage and commit the changes separately\n- Always reviews the commit diff to ensure the message matches the changes"}

Usage examples

/commit
/commit --no-verify
/commit --amend