commit
Original:🇺🇸 English
Translated
Use when committing changes, staging files, or finishing work in a git worktree. Covers smart commit, multi-concern splitting, sensitive-file guarding, and worktree merge.
11installs
Added on
NPX Install
npx skill4agent add ralphcrisostomo/nuxt-development-skills commitTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Git Commit Skill
Sensitive File Guard
Before staging, scan for sensitive patterns:
git status- ,
.env*,*.pem,*.key,*.p12*.pfx - ,
*.tfstate(with real values)*.tfvars - ,
credentials.json,serviceAccountKey.json*secret*
If a match is found:
- Append the missing pattern to and stage
.gitignore..gitignore - If already tracked, warn and suggest .
git rm --cached <file> - Never proceed with committing a sensitive file.
Smart Commit Workflow
1. Review & Sensitive File Guard
bash
git status
git diff
git diff --cached
git log --oneline -5Scan the output against the sensitive patterns above.
2. Auto-stage tracked changes
bash
git add -uStage tracked modifications and deletions only. Review untracked files first and stage by name if appropriate.
3. Analyse for multi-concern splitting
Group changed files by directory or feature area. If changes span unrelated concerns (e.g. a bug fix and a new feature), split into separate commits automatically.
4. Generate commit message
- Infer type: ,
feat,fix,chore,docs,refactor,test.style - Infer scope from the primary directory or feature area.
- Subject line: imperative voice, under 72 characters.
- Body (optional): explain "why", not "what".
5. Commit via heredoc
bash
git commit -m "$(cat <<'EOF'
type(scope): subject line
Optional body.
Co-Authored-By: Claude <model> <noreply@anthropic.com>
EOF
)"Replace with the actual model name (e.g. , ).
<model>Opus 4.6Sonnet 4.66. Handle pre-commit hook failure
Fix the issue, re-stage, and create a new commit. Never use . Never amend — the failed commit does not exist.
--no-verifyWorktree Workflow
When working in a git worktree ():
.claude/worktrees/<name>/- Smart commit all changes using the workflow above.
- Switch to in the primary working directory.
main - Squash-merge: .
git merge --squash <worktree-branch> - Commit the squashed result with a single well-formed message.
- Verify: .
git log --oneline -5 && git status - Remove: .
git worktree remove .claude/worktrees/<name>
Commit before merging, always merge into , never delete the branch before merge is confirmed, use for linear history.
main--squashRules
- Proceed without confirmation — stage, generate message, and commit in one flow.
- Never commit sensitive files (run the guard first).
- Never amend a published commit — create a new one.
- Never force-push .
main - Never use or
--no-verify.--no-gpg-sign - Prefer named files over to avoid staging secrets or noise.
git add -A
Quick Reference
- Sensitive File Guard → → multi-concern split → Conventional Commit via heredoc with
git add -u.Co-Authored-By - Worktree: commit → squash-merge to main → verify → remove.