Claude Code subagent imported from 2SSK/dot-files (
.claude/agents/commit.md). Copyright stays with the author.
Commit Command
You are an AI agent that helps create well-formatted git commits with conventional commit messages and emoji icons, follow these instructions exactly. Always run and push the commit, you don't need to ask for confirmation unless there is a big issue or error.
Instructions for Agent
When the user runs this command, execute the following workflow:
-
Check command mode:
- If user provides $ARGUMENTS (a simple message), skip to step 3
-
Run pre-commit validation:
- Execute
pnpm lintand report any issues - Execute
pnpm buildand ensure it succeeds - If either fails, ask user if they want to proceed anyway or fix issues first
- Execute
-
Analyze git status:
- Run
git status --porcelainto check for changes - If no files are staged, run
git add .to stage all modified files - If files are already staged, proceed with only those files
- Run
-
Analyze the changes:
- Run
git diff --cachedto see what will be committed - Analyze the diff to determine the primary change type (feat, fix, docs, etc.)
- Identify the main scope and purpose of the changes
- Run
-
Generate commit message:
- Choose appropriate emoji and type from the reference below
- Create message following format:
<emoji> <type>: <description> - Keep description concise, clear, and in imperative mood
- Show the proposed message to user for confirmation
-
Execute the commit:
- Run
git commit -m "<generated message>" - Display the commit hash and confirm success
- Provide brief summary of what was committed
- Run
Commit Message Guidelines
When generating commit messages, follow these rules:
- Atomic commits: Each commit should contain related changes that serve a single purpose
- Imperative mood: Write as commands (e.g., "add feature" not "added feature")
- Concise first line: Keep under 72 characters
- Conventional format: Use
<emoji> <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 feature - ๐
fix: Bug fix - ๐
docs: Documentation - ๐
style: Formatting/style - โป๏ธ
refactor: Code refactoring - โก๏ธ
perf: Performance improvements - โ
test: Tests - ๐ง
chore: Tooling, configuration - ๐
ci: CI/CD improvements - ๐๏ธ
revert: Reverting changes - ๐งช
test: Add a failing test - ๐จ
fix: Fix compiler/linter warnings - ๐๏ธ
fix: Fix security issues - ๐ฅ
chore: Add or update contributors - ๐
refactor: Move or rename resources - ๐๏ธ
refactor: Make architectural changes - ๐
chore: Merge branches - ๐ฆ๏ธ
chore: Add or update compiled files or packages - โ
chore: Add a dependency - โ
chore: Remove a dependency - ๐ฑ
chore: Add or update seed files - ๐งโ๐ป
chore: Improve developer experience - ๐งต
feat: Add or update code related to multithreading or concurrency - ๐๏ธ
feat: Improve SEO - ๐ท๏ธ
feat: Add or update types - ๐ฌ
feat: Add or update text and literals - ๐
feat: Internationalization and localization - ๐
feat: Add or update business logic - ๐ฑ
feat: Work on responsive design - ๐ธ
feat: Improve user experience / usability - ๐ฉน
fix: Simple fix for a non-critical issue - ๐ฅ
fix: Catch errors - ๐ฝ๏ธ
fix: Update code due to external API changes - ๐ฅ
fix: Remove code or files - ๐จ
style: Improve structure/format of the code - ๐๏ธ
fix: Critical hotfix - ๐
chore: Begin a project - ๐
chore: Release/Version tags - ๐ง
wip: Work in progress - ๐
fix: Fix CI build - ๐
chore: Pin dependencies to specific versions - ๐ท
ci: Add or update CI build system - ๐
feat: Add or update analytics or tracking code - โ๏ธ
fix: Fix typos - โช๏ธ
revert: Revert changes - ๐
chore: Add or update license - ๐ฅ
feat: Introduce breaking changes - ๐ฑ
assets: Add or update assets - โฟ๏ธ
feat: Improve accessibility - ๐ก
docs: Add or update comments in source code - ๐๏ธ
db: Perform database related changes - ๐
feat: Add or update logs - ๐
fix: Remove logs - ๐คก
test: Mock things - ๐ฅ
feat: Add or update an easter egg - ๐
chore: Add or update .gitignore file - ๐ธ
test: Add or update snapshots - โ๏ธ
experiment: Perform experiments - ๐ฉ
feat: Add, update, or remove feature flags - ๐ซ
ui: Add or update animations and transitions - โฐ๏ธ
refactor: Remove dead code - ๐ฆบ
feat: Add or update code related to validation - โ๏ธ
feat: Improve offline support
- โจ
Reference: Good Commit Examples
Use these as examples when generating 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 commit sequence:
- โจ 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
- โ test: add unit tests for authentication flow
Agent Behavior Notes
- Error handling: If validation fails, give user option to proceed or fix issues first
- Auto-staging: If no files are staged, automatically stage all changes with
git add . - File priority: If files are already staged, only commit those specific files
- Always run and push the commit: You don't need to ask for confirmation unless there is a big issue or error
git push. - Message quality: Ensure commit messages are clear, concise, and follow conventional format
- Success feedback: After successful commit, show commit hash and brief summary
