Smart Commit
Analyze outstanding changes and organize them into logical, well-structured commits.
Process
Check current state:
- Run
git status to see all modified, staged, and untracked files
- Run
git diff to see unstaged changes
- Run
git diff --cached to see already staged changes
Analyze changes:
- Read the changed files to understand what was modified
- Group related changes by:
- Feature/functionality (e.g., all auth-related changes together)
- Type (e.g., refactoring, bug fix, new feature, docs, tests)
- Component/module (e.g., all UI changes, all API changes)
Propose commit groups:
- Present the proposed groupings to the user via AskUserQuestion
- Each group should have:
- List of files to include
- Proposed commit message following conventional commits format
- Ask user to confirm, adjust, or skip each group
Create commits:
- For each approved group:
- Stage only the relevant files with
git add <files>
- Create commit with the agreed message
- Use
git add -p approach if only parts of a file belong to a commit (ask user first)
Summary: Show final git log --oneline -n <count> of created commits
Commit Message Format
Follow conventional commits:
<type>(<scope>): <description>
[optional body]
Co-Authored-By: Claude <noreply@anthropic.com>
Types: feat, fix, refactor, docs, test, chore, style, perf
Examples
Single logical change:
feat(auth): add OAuth2 login flow
- Add OAuth2 provider configuration
- Implement token refresh logic
- Add login/logout UI components
Mixed changes get split:
fix(api): handle null response in user endpoint
refactor(ui): extract Button component
docs: update README with setup instructions
Safety
- Never commit files that look like secrets (.env, credentials, keys)
- Always show the user what will be committed before committing
- If unsure about grouping, ask the user
1---2name: commit3description: Analyze outstanding git changes and organize them into logical, well-structured commits. Use when the user wants to commit changes or organize their work into commits.4---56# Smart Commit78Analyze outstanding changes and organize them into logical, well-structured commits.910## Process11121. **Check current state**:13 - Run `git status` to see all modified, staged, and untracked files14 - Run `git diff` to see unstaged changes15 - Run `git diff --cached` to see already staged changes16172. **Analyze changes**:18 - Read the changed files to understand what was modified19 - Group related changes by:20 - Feature/functionality (e.g., all auth-related changes together)21 - Type (e.g., refactoring, bug fix, new feature, docs, tests)22 - Component/module (e.g., all UI changes, all API changes)23243. **Propose commit groups**:25 - Present the proposed groupings to the user via AskUserQuestion26 - Each group should have:27 - List of files to include28 - Proposed commit message following conventional commits format29 - Ask user to confirm, adjust, or skip each group30314. **Create commits**:32 - For each approved group:33 - Stage only the relevant files with `git add <files>`34 - Create commit with the agreed message35 - Use `git add -p` approach if only parts of a file belong to a commit (ask user first)36375. **Summary**: Show final `git log --oneline -n <count>` of created commits3839## Commit Message Format4041Follow conventional commits:42```43<type>(<scope>): <description>4445[optional body]4647Co-Authored-By: Claude <noreply@anthropic.com>48```4950Types: `feat`, `fix`, `refactor`, `docs`, `test`, `chore`, `style`, `perf`5152## Examples5354**Single logical change:**55```56feat(auth): add OAuth2 login flow5758- Add OAuth2 provider configuration59- Implement token refresh logic60- Add login/logout UI components61```6263**Mixed changes get split:**64- `fix(api): handle null response in user endpoint`65- `refactor(ui): extract Button component`66- `docs: update README with setup instructions`6768## Safety6970- Never commit files that look like secrets (.env, credentials, keys)71- Always show the user what will be committed before committing72- If unsure about grouping, ask the user