Claude Code · Slash command
/commit
Create well-formatted git commits — conventional-commit type + emoji, split into atomic commits when a diff covers more than one concern.
442★ · from Tevm, an open-source Ethereum dev toolkit
What this actually does for you
You stop writing commit messages by hand. It looks at what actually changed, writes a proper message for it (with the right emoji and type), and splits unrelated changes into separate commits instead of one messy blob.
Try it for: Make this your default way to commit, full stop — once it's in .claude/commands/, every commit on the project gets the same consistent style with zero extra thought from you.
The command file
# Claude Command: Commit
This command helps you create well-formatted commits with conventional commit messages and emoji.
## Usage
To create a commit, just type:
```
/commit
```
Or with options:
```
/commit --no-verify
```
## What This Command Does
1. Unless specified with `--no-verify`, automatically runs pre-commit checks:
- `pnpm lint` to ensure code quality
- `pnpm build` to verify the build succeeds
- `pnpm generate:docs` to update documentation
2. Checks which files are staged with `git status`
3. If 0 files are staged, automatically adds all modified and new files with `git add`
4. Performs a `git diff` to understand what changes are being committed
5. Analyzes the diff to determine if multiple distinct logical changes are present
6. If multiple distinct changes are detected, suggests breaking the commit into multiple smaller commits
7. For each commit (or the single commit if not split), creates a commit message using emoji conventional commit format
## Best Practices for Commits
- **Verify before committing**: Ensure code is linted, builds correctly, and documentation is updated
- **Atomic commits**: Each commit should contain related changes that serve a single purpose
- **Split large changes**: If changes touch multiple concerns, split them into separate commits
- **Conventional commit format**: Use the format `<type>: <description>` where type is one of:
- `feat`: A new feature
- `fix`: A bug fix
- `docs`: Documentation changes
- `style`: Code style changes (formatting, etc)
- `refactor`: Code changes that neither fix bugs nor add features
- `perf`: Performance improvements
- `test`: Adding or fixing tests
- `chore`: Changes to the build process, tools, etc.
- **Present tense, imperative mood**: Write commit messages as commands (e.g., "add feature" not "added feature")
- **Concise first line**: Keep the first line under 72 characters
- **Emoji**: Each commit type is paired with an appropriate emoji — see the full table in the source file (linked above) for all ~60 mappings (feat ✨, fix 🐛, docs 📝, refactor ♻️, perf ⚡️, test ✅, chore 🔧, and many more specific ones).
## Guidelines for Splitting Commits
When analyzing the diff, consider splitting commits based on these criteria:
1. **Different concerns**: Changes to unrelated parts of the codebase
2. **Different types of changes**: Mixing features, fixes, refactoring, etc.
3. **File patterns**: Changes to different types of files (e.g., source code vs documentation)
4. **Logical grouping**: Changes that would be easier to understand or review separately
5. **Size**: Very large changes that would be clearer if broken down
## Examples
Good commit messages:
- ✨ 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
- 🎨 style: reorganize component structure for better readability
## Command Options
- `--no-verify`: Skip running the pre-commit checks (lint, build, generate:docs)
## Important Notes
- By default, pre-commit checks (`pnpm lint`, `pnpm build`, `pnpm generate:docs`) will run to ensure code quality
- If these checks fail, you'll be asked if you want to proceed with the commit anyway or fix the issues first
- If specific files are already staged, the command will only commit those files
- If no files are staged, it will automatically stage all modified and new files
- Always reviews the commit diff to ensure the message matches the changes›The pre-commit checks (`pnpm lint`, `pnpm build`, `pnpm generate:docs`) are this project's own — swap them for your own project's lint/build/test commands.
How to add it
Copy the command file below.
Save it as .claude/commands/<name>.md in your project (create the folder if it doesn't exist).
Adjust anything project-specific (see the note below, if there is one).
Run the command in Claude Code by typing its name, e.g. it will appear in your / menu.
The linked repo is the source of truth — if the author updates it, the repo link stays current.