commit
Git Commit Skill
Sensitive File Guard
Before staging, scan git status for sensitive patterns:
.env*,*.pem,*.key,*.p12,*.pfx*.tfstate,*.tfvars(with real values)credentials.json,serviceAccountKey.json,*secret*
If a match is found:
- Append the missing pattern to
.gitignoreand stage.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
git status
git diff
git diff --cached
git log --oneline -5
Scan the output against the sensitive patterns above.
2. Auto-stage tracked changes
git add -u
Stage 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
git commit -m "$(cat <<'EOF'
type(scope): subject line
Optional body.
Co-Authored-By: Claude <model> <noreply@anthropic.com>
EOF
)"
Replace <model> with the actual model name (e.g. Opus 4.6, Sonnet 4.6).
6. Handle pre-commit hook failure
Fix the issue, re-stage, and create a new commit. Never use --no-verify. Never amend — the failed commit does not exist.
Worktree Workflow
When working in a git worktree (.claude/worktrees/<name>/):
- Smart commit all changes using the workflow above.
- Switch to
mainin the primary working directory. - 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 main, never delete the branch before merge is confirmed, use --squash for linear history.
Rules
- 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
--no-verifyor--no-gpg-sign. - Prefer named files over
git add -Ato avoid staging secrets or noise.
Quick Reference
- Sensitive File Guard →
git add -u→ multi-concern split → Conventional Commit via heredoc withCo-Authored-By. - Worktree: commit → squash-merge to main → verify → remove.
More from ralphcrisostomo/nuxt-development-skills
ralph
Convert PRDs to prd.json format for the Ralph autonomous agent system. Use when you have an existing PRD and need to convert it to Ralph's JSON format. Triggers on: convert this prd, turn this into ralph format, create prd.json from this, ralph json.
52prd
Generate a Product Requirements Document (PRD) for a new feature. Use when planning a feature, starting a new project, or when asked to create a PRD. Triggers on: create a prd, write prd for, plan this feature, requirements for, spec out.
39optimise-claude
Use when auditing, trimming, or restructuring AI instruction files (CLAUDE.md, SKILL.md, AGENTS.md) to reduce context-window consumption. Trigger whenever CLAUDE.md is bloated or Claude ignores instructions, a SKILL.md exceeds 120 lines, skills share duplicated content, AGENTS.md has large inline blocks, or the user asks to optimize, slim down, or reduce token usage.
37nuxt-init
Use when scaffolding a new Nuxt 4 project with standard config files (prettier, eslint, gitignore, husky, vitest, tsconfig, sops) and bun scripts.
33nuxt-terraform
Scaffold Nuxt + AWS Terraform infrastructure. Use when adding GraphQL resolvers, Lambda functions, initializing a new project with AppSync, DynamoDB, Cognito, writing Terraform tests, or generating/reviewing Terraform code style. Triggers on: add graphql resolver, create lambda, scaffold terraform, init terraform, add appsync resolver, add mutation, add query, add terraform test, write tftest, terraform style.
32todo
Use when scanning a codebase for incomplete work and maintaining a living TODO.md grouped by feature. Triggers on: scan for todos, find incomplete work, update todo, what needs doing, create todo list.
30