Git Commit Assistant Skill
Safe, high-quality Git commits. Sensitive file exclusion, .gitignore management, Conventional Commits message generation.
Activation Triggers
- "commit", ".gitignore", push-related requests
Workflow
Phase 1: Repository Analysis
git status --porcelain + git branch --show-current to check state
- Read
.gitignore, suggest missing required patterns
Phase 2: File Classification
AUTO_EXCLUDE (never commit):
- Secrets:
*.key, *.pem, *credentials*, *secret*, *password*, .env*
- MCP config:
.claude.json, .mcp.json*
- Personal settings:
settings.json, settings.local.json, IDE configs
- Build artifacts:
node_modules/, dist/, build/, vendor/, *.log, *.cache
- OS:
.DS_Store, Thumbs.db
AUTO_COMMIT (generally safe):
- Source code (
src/**, internal/**, lib/**), tests, docs (*.md)
- Shared config (
.gitignore, package.json, tsconfig.json, go.mod, .github/workflows/*)
- Skills (
~/.claude/skills/**)
CONFIRM (user decision): Files > 1MB, new directories, executables, unclassified config files
Phase 3: Commit Message Generation
- Analyze changes from
git diff --cached and git status
- Generate Conventional Commits message:
<type>(<scope>): <subject> ← English, max 50 chars, imperative
- <description (Japanese OK)>
- 3-5 bullets explaining what/why/impact. No file lists
- Attribution trailer comes from
attribution.commit in settings.json — do not write it manually
- Confirm with the user only when Phase 2 turned up a CONFIRM-class file, a file that
should be excluded, or an ambiguous commit scope. Invoking this skill already expresses
intent to commit, so an unambiguous commit proceeds without a separate approval step.
Phase 4: Commit & Push
- Stage with
git add / git rm
- Commit using heredoc, verify success
- Push only after user confirmation
Sensitive Content Scan
Scan diff before commit:
- API keys:
[A-Za-z0-9_-]{20,}
- Passwords:
password.*=.*
- URLs with credentials:
://.*:.*@
Warn and abort commit on detection.
Error Handling
| Error |
Action |
| Merge conflict |
Prompt resolution, show conflict files |
| Detached HEAD |
Suggest git switch -c <branch> |
| Nothing to commit |
Report clearly |
Supporting Files
templates/commit-message.md: Message template and examples
1---2name: git-commit-assistant3description: Stages and commits changes safely in any repository. Use when the user asks to commit, or when a commit would include untracked or sensitive files (credentials, MCP configs, personal settings). Writes Conventional Commits messages with a Japanese explanation. Do not use to merely inspect git status or a diff.4---56# Git Commit Assistant Skill78Safe, high-quality Git commits. Sensitive file exclusion, .gitignore management, Conventional Commits message generation.910## Activation Triggers1112- "commit", ".gitignore", push-related requests1314## Workflow1516### Phase 1: Repository Analysis17181. `git status --porcelain` + `git branch --show-current` to check state192. Read `.gitignore`, suggest missing required patterns2021### Phase 2: File Classification2223**AUTO_EXCLUDE (never commit)**:24- Secrets: `*.key`, `*.pem`, `*credentials*`, `*secret*`, `*password*`, `.env*`25- MCP config: `.claude.json`, `.mcp.json*`26- Personal settings: `settings.json`, `settings.local.json`, IDE configs27- Build artifacts: `node_modules/`, `dist/`, `build/`, `vendor/`, `*.log`, `*.cache`28- OS: `.DS_Store`, `Thumbs.db`2930**AUTO_COMMIT (generally safe)**:31- Source code (`src/**`, `internal/**`, `lib/**`), tests, docs (`*.md`)32- Shared config (`.gitignore`, `package.json`, `tsconfig.json`, `go.mod`, `.github/workflows/*`)33- Skills (`~/.claude/skills/**`)3435**CONFIRM (user decision)**: Files > 1MB, new directories, executables, unclassified config files3637### Phase 3: Commit Message Generation38391. Analyze changes from `git diff --cached` and `git status`402. Generate Conventional Commits message:41 ```42 <type>(<scope>): <subject> ← English, max 50 chars, imperative4344 - <description (Japanese OK)>45 ```46 - 3-5 bullets explaining what/why/impact. No file lists47 - Attribution trailer comes from `attribution.commit` in settings.json — do not write it manually483. Confirm with the user only when Phase 2 turned up a CONFIRM-class file, a file that49 should be excluded, or an ambiguous commit scope. Invoking this skill already expresses50 intent to commit, so an unambiguous commit proceeds without a separate approval step.5152### Phase 4: Commit & Push53541. Stage with `git add` / `git rm`552. Commit using heredoc, verify success563. Push only after user confirmation5758## Sensitive Content Scan5960Scan diff before commit:61- API keys: `[A-Za-z0-9_-]{20,}`62- Passwords: `password.*=.*`63- URLs with credentials: `://.*:.*@`6465Warn and abort commit on detection.6667## Error Handling6869| Error | Action |70|-------|--------|71| Merge conflict | Prompt resolution, show conflict files |72| Detached HEAD | Suggest `git switch -c <branch>` |73| Nothing to commit | Report clearly |7475## Supporting Files7677- `templates/commit-message.md`: Message template and examples