Best use case
commit is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Guided git commit with atomic commit analysis and conventional commit format
Teams using commit should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/commit/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How commit Compares
| Feature / Agent | commit | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Guided git commit with atomic commit analysis and conventional commit format
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# commit
**Category**: Development
## Usage
```bash
commit [--all | --staged | --interactive]
```
## Arguments
- `--all`: Analyze all uncommitted changes (staged + unstaged)
- `--staged`: Only analyze currently staged changes (default)
- `--interactive`: Guide through staging changes atomically before committing
## Execution Method
This command delegates to the `commit-expert` agent (Haiku model) for fast, cost-effective execution.
**Delegation**: Use the Task tool with:
- `subagent_type`: `"git-workflow:commit-expert"`
- `prompt`: Include the mode (`--staged`, `--all`, or `--interactive`) and current working directory
Example:
```
Task(subagent_type="git-workflow:commit-expert", prompt="Run commit in --staged mode in /path/to/repo")
```
---
## Execution Instructions for Claude Code
When this command is run, Claude Code should:
1. **Analyze Changes**
- Run `git status` to understand current state
- Run `git diff --staged` for staged changes (or `git diff` for all)
- Identify the files and types of changes
2. **Check for Atomic Commit Violations**
- Flag if changes span multiple unrelated concerns
- Warn if mixing features, fixes, refactoring, and style changes
- Suggest splitting if commit is too large (>300 lines)
3. **Generate Commit Message**
- Determine appropriate type (feat, fix, docs, etc.)
- Identify scope from file paths
- Write clear, imperative description
- Add body if changes are complex
4. **Present for Approval**
- Show the proposed commit message
- Allow editing before committing
- Execute the commit
## Interactive Flow
### Step 1: Analyze Changes
```
🔍 Analyzing your changes...
Staged changes:
M src/auth/login.py (+45, -12)
M src/auth/tokens.py (+23, -5)
A tests/test_login.py (+89)
Unstaged changes:
M src/styles/button.css (+15, -3)
M README.md (+20)
```
### Step 2: Atomic Commit Check
```
✅ Good: Changes appear to be a single logical unit
All changes relate to authentication/login functionality
OR
⚠️ Warning: Changes may not be atomic
These appear to be separate concerns:
1. Authentication changes (src/auth/*)
2. Style changes (src/styles/button.css)
3. Documentation (README.md)
Recommendations:
- Commit auth changes first: feat(auth): ...
- Commit style changes: fix(ui): ...
- Commit docs separately: docs: ...
Would you like to:
1. Proceed with current staging (not recommended)
2. Unstage some files and commit in parts
3. Show me how to split this commit
```
### Step 3: Generate Commit Message
```
📝 Proposed commit message:
feat(auth): add JWT refresh token rotation
Implement automatic token refresh to improve session security.
Tokens now rotate on each refresh, with old tokens invalidated
after a 5-minute grace period.
- Add refresh token rotation logic
- Update token validation to check rotation status
- Add tests for token refresh flow
Does this look correct?
1. Yes, commit with this message
2. Edit the message
3. Change the commit type
4. Cancel
```
### Step 4: Commit Type Selection (if editing)
```
Select commit type:
1. feat - New feature
2. fix - Bug fix
3. docs - Documentation only
4. style - Code style (formatting, no logic change)
5. refactor - Code restructuring (no feature/fix)
6. perf - Performance improvement
7. test - Adding/fixing tests
8. build - Build system or dependencies
9. ci - CI/CD configuration
10. chore - Maintenance tasks
Current selection: feat
Enter number or type:
```
### Step 5: Scope Selection
```
Suggested scopes based on changed files:
1. auth (src/auth/*)
2. api (src/api/*)
3. No scope
Enter scope or select number: auth
```
### Step 6: Description
```
Write a short description (max 50 chars, imperative mood):
Examples:
✅ "add password reset flow"
✅ "fix token expiration bug"
❌ "added password reset" (past tense)
❌ "fixes the token bug" (not imperative)
Description: add JWT refresh token rotation
```
### Step 7: Body (Optional)
```
Add a commit body? (Explain what and why)
1. Yes, add details
2. No, subject line is sufficient
[If yes]
Enter commit body (empty line to finish):
> Implement automatic token refresh to improve session security.
> Tokens now rotate on each refresh, with old tokens invalidated
> after a 5-minute grace period.
>
```
### Step 8: Execute Commit
```
📋 Final commit message:
feat(auth): add JWT refresh token rotation
Implement automatic token refresh to improve session security.
Tokens now rotate on each refresh, with old tokens invalidated
after a 5-minute grace period.
Confirm commit? (yes/no/edit): yes
✅ Committed: abc1234
feat(auth): add JWT refresh token rotation
3 files changed, 157 insertions(+), 17 deletions(-)
```
## Interactive Staging Mode (--interactive)
When using `--interactive`, guide users through staging atomic commits:
```
🎯 Interactive Atomic Commit Mode
Analyzing all changes to help you create atomic commits...
Found 5 modified files with different concerns:
Group 1: Authentication (recommended first commit)
M src/auth/login.py
M src/auth/tokens.py
A tests/test_login.py
Group 2: UI Fixes
M src/styles/button.css
Group 3: Documentation
M README.md
Stage Group 1 for commit? (yes/no/show diff): yes
[Stages files, then proceeds to commit flow]
```
## Validation Rules
The command should enforce:
1. **Message Length**
- Subject: Max 72 characters (warn at 50)
- Body lines: Max 72 characters
2. **Format**
- Type is valid conventional commit type
- Uses imperative mood
- No period at end of subject
3. **Content Quality**
- Reject vague messages: "fix", "update", "changes", "WIP"
- Require specificity: "fix what?", "update what?"
4. **Atomic Check**
- Warn if >5 files changed
- Warn if >300 lines changed
- Warn if multiple file types with different purposes
5. **No AI Tool Attribution**
- NEVER include "Generated with Claude Code" or similar AI attribution
- NEVER include "Co-Authored-By: Claude" or any AI co-author footer
- NEVER include emojis like 🤖 indicating AI generation
- Commit messages should appear as human-written, professional commits
## Error Handling
```
❌ No changes to commit
Run `git status` to see the current state.
❌ Commit message too vague
"fix bug" is not specific enough.
Please describe what was fixed: "fix(auth): correct token expiration check"
❌ Not in a git repository
Initialize with `git init` or navigate to a git repository.
⚠️ Unstaged changes will not be included
Stage with `git add <file>` or use `commit --all`
```
## Quick Commit Shortcuts
For experienced users, support quick patterns:
```bash
# Quick feature commit
commit feat auth "add password reset"
# Quick fix commit
commit fix api "handle null response"
# Quick docs commit
commit docs "update API documentation"
```
## Integration with Git Hooks
Suggest installing hooks for enforcement:
```
💡 Tip: Install git hooks to enforce commit standards automatically.
Would you like to set up:
1. commit-msg hook (validate message format)
2. pre-commit hook (run tests/linting)
3. Both
4. Skip for now
```
## Example Outputs
### Simple Commit
```
$ commit
🔍 Analyzing staged changes...
M src/utils/helpers.py (+12, -3)
✅ Single file change - good atomic commit
📝 Proposed: fix(utils): handle edge case in date parser
Commit? (yes/edit/cancel): yes
✅ Committed: def4567
```
### Complex Commit Needing Split
```
$ commit --all
🔍 Analyzing all changes...
⚠️ Multiple concerns detected:
Authentication:
M src/auth/login.py
M src/auth/session.py
Unrelated UI fix:
M src/components/Header.vue
Documentation:
M docs/API.md
Recommendation: Split into 3 commits
1. Stage auth files → feat(auth): ...
2. Stage Header.vue → fix(ui): ...
3. Stage API.md → docs(api): ...
Would you like help staging these separately? (yes/no)
```Related Skills
git-commits
Git commit best practices with conventional commits format and atomic commit principles. Use when committing code to ensure clear, meaningful commit history with proper type prefixes and semantic versioning support.
zod
Zod schema validation patterns and type inference. Auto-loads when validating schemas, parsing data, validating forms, checking types at runtime, or using z.object/z.string/z.infer in TypeScript.
typescript-import-style
Merge-friendly import formatting (one-per-line, alphabetical). Auto-loads when writing TypeScript/JavaScript imports to minimize merge conflicts in parallel development. Enforces consistent grouping and sorting.
setup-mcp-auth
Configure authentication for an existing FastMCP server
fastmcp
FastMCP TypeScript framework patterns for MCP servers. Auto-loads when building MCP servers, creating tools/resources/prompts, implementing authentication, configuring transports, or working with FastMCP in TypeScript.
add-mcp-tool
Add a new tool to an existing FastMCP server with guided configuration
add-mcp-resource
Add a new resource or resource template to an existing FastMCP server
plan-with-team
Validate plan file ownership
privacy-compliance
GDPR, CCPA, and privacy compliance guidance for data protection. Use when handling personal data, implementing consent management, or ensuring regulatory compliance across jurisdictions.
oauth
OAuth 2.0 and OpenID Connect implementation patterns. Use when implementing authentication, authorization flows, or integrating with OAuth providers like Google, GitHub, or custom identity providers.
mcp-security
Use when securing MCP servers, preventing prompt injection, implementing authorization, validating user input, or building secure multi-agent pipelines. Provides 5-layer defense architecture patterns.
rag-cag-security
Security patterns for RAG and CAG systems with multi-tenant isolation. Use when building retrieval-augmented or cache-augmented generation systems that require tenant isolation, access control, and secure data handling.