Git workflow, code quality, context management and testing commands: - commit, push, pr, issue - git operations - simplify, refactor, verify, check - code quality - catchup, onboard, save, cleanup - context management - test, format, sync - development utilities Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2.6 KiB
2.6 KiB
description: Smart git commit with conventional message and emoji
argument-hint: [message] - Optional custom commit message
Smart Commit
Pre-computed Context
Branch:
!git branch --show-current
Staged Files:
!git diff --cached --name-only
Staged Changes (stat):
!git diff --cached --stat
Unstaged Changes:
!git diff --name-only
Recent Commits (style reference):
!git log --oneline -5
Instructions
You are creating a commit with a conventional commit message and appropriate emoji.
1. Verify Staged Changes
If no files are staged, suggest staging:
git add <specific-files>
Never use git add -A or git add . without explicit user approval - these can accidentally stage sensitive files.
2. Analyze Changes
Review the staged diff to determine:
- Type: What kind of change is this?
- Scope: What area of the codebase is affected?
- Description: What does this change do?
3. Determine Commit Type & Emoji
| Type | Emoji | When to use |
|---|---|---|
| feat | feat: |
New feature or functionality |
| fix | fix: |
Bug fix |
| refactor | refactor: |
Code restructuring without behavior change |
| docs | docs: |
Documentation only |
| test | test: |
Adding or updating tests |
| chore | chore: |
Maintenance, dependencies, config |
| style | style: |
Formatting, whitespace, semicolons |
| perf | perf: |
Performance improvement |
4. Generate Commit Message
Format:
<type>(<scope>): <description>
[optional body - explain WHY, not WHAT]
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Rules:
- Description: imperative mood, lowercase, no period
- Max 72 characters for first line
- Body explains motivation if not obvious
5. Execute Commit
If user provided a message argument, use it. Otherwise, use the generated message.
git commit -m "$(cat <<'EOF'
<type>(<scope>): <description>
<optional body>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
EOF
)"
6. Verify
Show the commit result:
git log -1 --stat
Examples
Single file fix:
fix(auth): resolve token refresh race condition
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
New feature:
feat(api): add user preferences endpoint
Allows users to save and retrieve their app preferences.
Includes validation for preference keys.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Refactoring:
refactor(utils): simplify date formatting helpers
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>