4.1 KiB
4.1 KiB
description, allowed-tools, model
| description | allowed-tools | model |
|---|---|---|
| Analyze Git diff and generate Conventional Commits format messages automatically. Uses commit-generator agent. Detects commit type (feat/fix/chore/docs), scope, breaking changes. Focuses on "why" rather than "what". Use after staging changes when ready to commit. Git差分を分析してConventional Commits形式のメッセージを自動生成。型、スコープ、破壊的変更を検出。 | Task | inherit |
/commit - Git Commit Message Generator
Analyze staged changes and generate appropriate commit messages following Conventional Commits specification.
Implementation: This command delegates to the specialized commit-generator subagent for optimal performance and context efficiency.
How It Works
When invoked, this command:
- Launches the
commit-generatorsubagent via Task tool - Subagent analyzes git diff and status (no codebase context needed)
- Generates Conventional Commits format messages
- Returns multiple message alternatives
Usage
Basic Usage
/commit
Analyzes staged changes and suggests messages.
With Context
/commit "Related to authentication flow"
Incorporates context into message generation.
With Issue Number
/commit "#123"
Includes issue reference in commit message.
Conventional Commits Format
<type>(<scope>): <subject>
[optional body]
[optional footer]
Commit Types
| Type | Use Case |
|---|---|
feat |
New feature |
fix |
Bug fix |
docs |
Documentation |
style |
Formatting |
refactor |
Code restructuring |
perf |
Performance improvement |
test |
Testing |
chore |
Maintenance |
ci |
CI/CD changes |
build |
Build system changes |
Subject Line Rules
- Limit to 72 characters
- Use imperative mood ("add" not "added")
- Don't capitalize first letter after type
- No period at the end
- Be specific but concise
Good Examples
✅ feat(auth): add OAuth2 authentication support
✅ fix(api): resolve timeout in user endpoint
✅ docs(readme): update installation instructions
✅ perf(search): optimize database queries
Bad Examples
❌ Fixed bug (no type, too vague)
❌ feat: Added new feature. (capitalized, period)
❌ update code (no type, not specific)
❌ FEAT(AUTH): ADD LOGIN (all caps)
Output Format
The command provides:
- Analysis summary: Files changed, lines added/deleted, detected type/scope
- Recommended message: Most appropriate based on analysis
- Alternative formats: Detailed, concise, with issue reference
- Usage instructions: How to commit with the generated message
Integration with Workflow
Works seamlessly with:
/branch- Create branch first/pr- Generate PR description after commits/test- Ensure tests pass before committing
Technical Details
Subagent Benefits
- 90% context reduction: Only git operations, no codebase loading
- 2-3x faster execution: Lightweight agent optimized for git analysis
- Specialized logic: Dedicated to commit message generation
- Parallel execution: Can run concurrently with other operations
Git Operations Used
The subagent only executes git commands:
git diff --staged- Analyze changesgit status- Check file statusgit log- Learn commit style- No file system access or code parsing
Related Commands
/branch- Generate branch names from changes/pr- Create PR descriptions/review- Code review before committing
Best Practices
- Stage related changes: Group logically related changes
- Commit frequently: Small, focused commits are better
- Review before committing: Check the suggested message
- Include breaking changes: Always note breaking changes
- Reference issues: Link commits to issues when applicable
Context Efficiency
This command is optimized for minimal context usage:
- ✅ No codebase files loaded
- ✅ Only git metadata analyzed
- ✅ Fast execution (<5 seconds)
- ✅ Can run in parallel with other tasks
Note: For implementation details, see .claude/agents/git/commit-generator.md