commit
Creates commits with generated messages following project conventions. Use when asked to commit changes or create a commit.
When & Why to Use This Skill
This Claude skill automates the Git commit workflow by intelligently analyzing code changes and generating standardized, professional commit messages. It streamlines version control by handling the entire process—from status checking and diff analysis to staging and execution—ensuring that repository histories remain clean, consistent, and compliant with project conventions without manual overhead.
Use Cases
- Automating the generation of concise, imperative-style commit messages that accurately reflect the primary purpose of code changes.
- Standardizing commit formats across a development team to ensure all entries follow specific structural requirements like type, scope, and body.
- Enhancing repository security by automatically identifying and preventing the staging of sensitive files such as .env or credential files.
- Reducing context-switching for developers by allowing them to stage and commit changes directly through natural language commands during the coding process.
| name | commit |
|---|---|
| description | Creates commits with generated messages following project conventions. Use when asked to commit changes or create a commit. |
| allowed-tools | Bash(git status:*), Bash(git diff:*), Bash(git add:*), Bash(git commit:*), Read, Glob |
Commit
Overview
Automates commit creation by analyzing changes, generating appropriate commit messages following project conventions, and creating commits with proper staging.
Workflow
Step 1: Check Status
- Run
git statusto see modified and untracked files - Run
git diffto see unstaged changes - Run
git diff --stagedto see staged changes - If no changes to commit, inform user and stop
Step 2: Analyze Changes
- Identify the primary purpose - what's the main change?
- New feature? Which one?
- Bug fix? What bug?
- Refactoring? Of what?
- Configuration change? What aspect?
- Determine type: feature, fix, refactor, chore, docs, etc.
- Identify scope: which files/modules are affected
Step 3: Generate Commit Message
Follow these requirements:
Message structure:
- First line: Concise summary of primary change
- Use imperative mood ("Add feature", "Fix bug", NOT "Added" or "Adds")
- Keep it focused on the single most important change
- Max 80 characters
- Blank line
- Body (if multiple significant changes):
- Bullet points for additional changes
- Focus only on most important changes
Content guidelines:
- Use third person ("This adds..." NOT "I added...")
- Focus on WHAT and WHY, not HOW
- Don't mention tests unless they're a significant part of the commit (e.g., new testing framework, major test infrastructure changes)
- Use backticks for code references (variables, methods, classes, file names)
Step 4: Stage and Commit
Stage relevant files with
git add:- Include modified files that are part of the change
- Include new files if appropriate
- Don't stage files that likely contain secrets (.env, credentials.json, etc.)
- Warn user if trying to commit secret files
Create commit with generated message:
- NEVER add Claude footer or "Generated with Claude Code" links
- NEVER add "Co-Authored-By: Claude" lines
- Use heredoc for proper formatting:
git commit -m "$(cat <<'EOF' Commit message here EOF )"Run
git statusafter commit to verify success