Prompt file imported from cipherstash/stack (
.cursor/commands/commit.md). Copyright stays with the author.
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
- Unless specified with
--no-verify, automatically runs pre-commit checks:pnpm run code:fixto ensure code quality, formatting, and linting
- Checks which files are staged with
git status - If 0 files are staged, automatically adds all modified and new files with
git add - Performs a
git diffto understand what changes are being committed - Analyzes the diff to determine if multiple distinct logical changes are present
- If multiple distinct changes are detected, suggests breaking the commit into multiple smaller commits
- 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 featurefix: A bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc)refactor: Code changes that neither fix bugs nor add featuresperf: Performance improvementstest: Adding or fixing testschore: 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:
feat: โจ New featurefix: ๐ Bug fixdocs: ๐ Documentationstyle: ๐ Formatting/stylerefactor: โป๏ธ Code refactoringperf: โก๏ธ Performance improvementstest: โ Testschore: ๐ง Tooling, configurationci: ๐ CI/CD improvementsrevert: ๐๏ธ Reverting changestest: ๐งช Add a failing testfix: ๐จ Fix compiler/linter warningsfix: ๐๏ธ Fix security issueschore: ๐ฅ Add or update contributorsrefactor: ๐ Move or rename resourcesrefactor: ๐๏ธ Make architectural changeschore: ๐ Merge brancheschore: ๐ฆ๏ธ Add or update compiled files or packageschore: โ Add a dependencychore: โ Remove a dependencychore: ๐ฑ Add or update seed fileschore: ๐งโ๐ป Improve developer experiencefeat: ๐งต Add or update code related to multithreading or concurrencyfeat: ๐๏ธ Improve SEOfeat: ๐ท๏ธ Add or update typesfeat: ๐ฌ Add or update text and literalsfeat: ๐ Internationalization and localizationfeat: ๐ Add or update business logicfeat: ๐ฑ Work on responsive designfeat: ๐ธ Improve user experience / usabilityfix: ๐ฉน Simple fix for a non-critical issuefix: ๐ฅ Catch errorsfix: ๐ฝ๏ธ Update code due to external API changesfix: ๐ฅ Remove code or filesstyle: ๐จ Improve structure/format of the codefix: ๐๏ธ Critical hotfixchore: ๐ Begin a projectchore: ๐ Release/Version tagswip: ๐ง Work in progressfix: ๐ Fix CI buildchore: ๐ Pin dependencies to specific versionsci: ๐ท Add or update CI build systemfeat: ๐ Add or update analytics or tracking codefix: โ๏ธ Fix typosrevert: โช๏ธ Revert changeschore: ๐ Add or update licensefeat: ๐ฅ Introduce breaking changesassets: ๐ฑ Add or update assetsfeat: โฟ๏ธ Improve accessibilitydocs: ๐ก Add or update comments in source codedb: ๐๏ธ Perform database related changesfeat: ๐ Add or update logsfix: ๐ Remove logstest: ๐คก Mock thingsfeat: ๐ฅ Add or update an easter eggchore: ๐ Add or update .gitignore filetest: ๐ธ Add or update snapshotsexperiment: โ๏ธ Perform experimentsfeat: ๐ฉ Add, update, or remove feature flagsui: ๐ซ Add or update animations and transitionsrefactor: โฐ๏ธ Remove dead codefeat: ๐ฆบ Add or update code related to validationfeat: โ๏ธ Improve offline support
Guidelines for Splitting Commits
When analyzing the diff, consider splitting commits based on these criteria:
- Different concerns: Changes to unrelated parts of the codebase
- Different types of changes: Mixing features, fixes, refactoring, etc.
- File patterns: Changes to different types of files (e.g., source code vs documentation)
- Logical grouping: Changes that would be easier to understand or review separately
- 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
- fix: ๐จ resolve linter warnings in component files
- chore: ๐งโ๐ป improve developer tooling setup process
- feat: ๐ implement business logic for transaction validation
- fix: ๐ฉน address minor styling inconsistency in header
- fix: ๐๏ธ patch critical security vulnerability in auth flow
- style: ๐จ reorganize component structure for better readability
- fix: ๐ฅ remove deprecated legacy code
- feat: ๐ฆบ add input validation for user registration form
- fix: ๐ resolve failing CI pipeline tests
- feat: ๐ implement analytics tracking for user engagement
- fix: ๐๏ธ strengthen authentication password requirements
- feat: โฟ๏ธ improve form accessibility for screen readers
Example of splitting commits:
- First commit: โจ feat: add new solc version type definitions
- Second commit: ๐ docs: update documentation for new solc versions
- Third commit: ๐ง chore: update package.json dependencies
- Fourth commit: ๐ท๏ธ feat: add type definitions for new API endpoints
- Fifth commit: ๐งต feat: improve concurrency handling in worker threads
- Sixth commit: ๐จ fix: resolve linting issues in new code
- Seventh commit: โ test: add unit tests for new solc version features
- Eighth commit: ๐๏ธ fix: update dependencies with security vulnerabilities
Command Options
--no-verify: Skip running the pre-commit checks (pnpm run code:fix)
Important Notes
- By default, pre-commit checks (
pnpm run code:fix) 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
- The commit message will be constructed based on the changes detected
- Before committing, the command will review the diff to identify if multiple commits would be more appropriate
- If suggesting multiple commits, it will help you stage and commit the changes separately
- Always reviews the commit diff to ensure the message matches the changes
