Smart Commit
Generate conventional commit messages that adapt to the repository's existing patterns.
Workflow
1. Analyze Repository Patterns
Run the analysis script to detect the repository's commit conventions:
bash
python3 <skill-path>/scripts/analyze_git_log.py
Key outputs to note:
- •Language: Determines whether to write descriptions in English or Chinese
- •Type distribution: Which commit types the project prefers
- •Scope usage: Whether scopes are used and common scope names
2. Review Staged Changes
bash
git status git diff --staged
3. Generate Commit Message
Apply these rules in order:
- •Match language — Use the detected primary language for the description
- •Match type conventions — Prefer types already used in the repository
- •Match scope patterns — Include scope only if the repository commonly uses them; reuse existing scope names when applicable
- •Choose correct type — Select based on the nature of the change (see references/conventional_commits.md for the full spec)
- •Be concise — Description focuses on "why", body (if needed) explains "what"
4. Execute Commit
Format using HEREDOC to preserve formatting:
bash
git commit -m "$(cat <<'EOF' <type>[optional scope]: <description> [optional body] [optional footer(s)] EOF )"
Resources
- •scripts/analyze_git_log.py — Analyzes last 50 commits for patterns, types, scopes, and language
- •references/conventional_commits.md — Full Conventional Commits v1.0.0 specification; consult when unsure about format rules or breaking change notation