/commit:commitfrom commit
Creates well-formatted commits with conventional commit format, GPG signing, and staged file detection. Splits multi-concern changes and respects pre-commit hooks.
Ships in commit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Creates well-formatted commits following conventional commit standards.
/commit$GPG_PASSPHRASE set)<type>: <description> formatgit statusgit diff HEADgit branch --show-currentgit log --oneline -10# If GPG_PASSPHRASE is set, cache it to gpg-agent
if [ -n "$GPG_PASSPHRASE" ]; then
gpg --batch --pinentry-mode loopback \
--passphrase-file <(echo "$GPG_PASSPHRASE") \
--clearsign >/dev/null 2>&1 <<< "test" && echo "✅ GPG passphrase cached" || echo "❌ GPG cache failed"
else
echo "⚠️ GPG_PASSPHRASE not set - GPG signing will prompt for passphrase (and fail in non-interactive environment)"
fi
# Always use --gpg-sign (passphrase is cached if GPG_PASSPHRASE was set)
git commit --signoff --gpg-sign -m "..."
git status --short
# Prefer staged files if any exist
if ! git diff --staged --quiet; then
git diff --staged --stat # Staged changes
else
git diff HEAD --stat # All changes
fi
Suggest split if:
src/ + test/ + docs/Multiple concerns detected:
1. Auth changes (src/auth/*)
2. UI updates (src/components/*)
3. Docs (README.md)
Split into 3 commits?
- feat: add JWT authentication
- style: update login UI
- docs: update auth documentation
[split/all]
Format: <type>: <description>
git commit --signoff ${USE_GPG:+--gpg-sign} -m "<type>: <description>"
If user requests --no-verify:
⚠️ Requested to skip pre-commit hooks.
Bypasses: linting, tests, formatting
Reason: [ask user]
Approve? [yes/no]
Only proceed if confirmed.
| Type | Use Case |
|---|---|
| feat | New feature |
| fix | Bug fix |
| docs | Documentation |
| style | Formatting, styling |
| refactor | Code restructure |
| perf | Performance |
| test | Tests |
| chore | Build/tools |
| ci | CI/CD |
| security | Security fix |
| build | Build system |
| revert | Revert changes |
| wip | Work in progress |
+ src/auth/login.ts (feat)
+ src/components/Button.css (style)
+ README.md (docs)
Split into: 3 separate commits
+ src/auth/login.ts
+ src/auth/middleware.ts
+ tests/auth.test.ts
One commit: feat: add authentication
+ Add export feature (feat)
+ Fix date bug (fix)
Split into: 2 commits by type
300+ lines: auth system
200+ lines: UI components
150+ lines: database
Split into: 3 commits by feature
CLAUDE.md references this skill: "Use /commit or say 'commit changes'"
Reference planning docs in commit body:
feat: add user authentication
- JWT token validation
- Protected routes middleware
- Tests cover happy/error paths
Related to Stage 2 of PLAN.md (User Story 1.2)
Hooks run automatically unless --no-verify used (requires approval).
User: "commit these changes"
Process:
1. Check GPG ✓
2. Analyze: src/auth/login.ts (modified)
3. Single concern ✓
4. Create: feat: add login endpoint
5. Execute: git commit --signoff --gpg-sign -m "..."
User: "commit"
Process:
1. Detect: auth + UI + docs
2. Suggest split (3 commits)
3. User confirms "split"
4. Commit each separately with proper type
User: "/commit --no-verify"
Response:
"⚠️ Skip hooks? Bypasses linting/tests.
Reason: [wait]"
User: "hotfix for production"
Action: Proceed with --no-verify
echo $GPG_PASSPHRASE # Check set
gpg --clearsign <<< "test" # Test manually
# If fails: commit without --gpg-sign
Check output → fix issue → retry Critical case only: ask about --no-verify
git status
# No changes: inform user
# Unstaged only: "Stage files first?"
Keep this main file under 500 lines. For extensive reference:
emoji-reference.md (if needed)advanced-commits.md (if needed)Current approach: All essential info in this file for immediate use.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub pigfoot/claude-code-hubs --plugin commit2 skills in this plugin