commit-best-practices
Create git commits with AI-generated messages following best practices. Use when the user asks to commit changes, mentions "commit", wants to save work to git, or has made changes ready to be committed. Invokes /git-actions:commit command which analyzes changes, generates concise messages matching repo style, and handles staging/approval workflow.
When & Why to Use This Skill
This Claude skill automates the Git commit workflow by generating high-quality, AI-driven commit messages based on real-time code diffs. It streamlines version control by analyzing changes, staging files, and ensuring all messages adhere to industry best practices—such as using the imperative mood and maintaining concise subject lines—while adapting to your repository's specific style.
Use Cases
- Standardizing Commit History: Automatically generate professional, consistent commit messages across a team to ensure the repository log remains readable and well-structured.
- Workflow Acceleration: Quickly stage and commit changes using simple slash commands like `/git-actions:commit all`, reducing the context-switching between the editor and terminal.
- Context-Aware Documentation: Create information-dense messages that explain the 'what' and 'why' of complex code changes by leveraging AI analysis of the actual file modifications.
- Custom Convention Adherence: Easily apply specific formatting rules, such as Conventional Commits or strict character limits, through simple natural language instructions.
| name | commit-best-practices |
|---|---|
| description | Create git commits with AI-generated messages following best practices. Use when the user asks to commit changes, mentions "commit", wants to save work to git, or has made changes ready to be committed. Invokes /git-actions:commit command which analyzes changes, generates concise messages matching repo style, and handles staging/approval workflow. |
| allowed-tools | SlashCommand |
Creating Commits with Best Practices
When the user needs to create a git commit, use the /git-actions:commit slash command. This command orchestrates the entire workflow with best practices built-in.
Usage
/git-actions:commit all # Stage all changes and commit
/git-actions:commit staged # Commit only staged changes
/git-actions:commit # Auto-detect (staged if any, else all)
What the Command Does
- Stages files (if needed)
- Analyzes changes using git diff
- Reviews recent commit history to match repository style
- Generates a concise, information-dense commit message
- Presents the message for user approval
- Creates the commit after approval
The commit-writer Agent
The /git-actions:commit command invokes the commit-writer agent, which has commit best practices embedded:
- Concise, information-dense messages (50-char subject limit)
- Imperative mood ("Add" not "Added")
- Explains WHAT and WHY, not HOW
- Adapts to repository commit conventions
- References issues when relevant
- Atomic commits (one logical change)
Custom Instructions
You can pass additional context to override defaults:
/git-actions:commit all use conventional commits format
/git-actions:commit staged keep it under 40 chars
/git-actions:commit all emphasize performance improvements
/git-actions:commit staged no body
Examples
User: "I've updated the authentication logic, can you commit this?"
You: Use /git-actions:commit all to stage all changes and create a commit with a well-crafted message.
User: "Commit my staged files"
You: Use /git-actions:commit staged to commit only the staged changes.
User: "I need a brief commit message for this fix"
You: Use /git-actions:commit all keep it under 40 chars to create a concise commit.