commit
Guided git commit with atomic commit analysis and conventional commit format
What this skill does
# 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): ...
3Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.