
Smart Commit
FreeCreate meaningful conventional commits with context.
Free · Opens the source repo
What Smart Commit does
Smart Commit is a tool designed for developers who want to enhance their commit messages by providing meaningful context. It analyzes both staged and unstaged changes in your Git repository to automatically generate conventional commits. Unlike standard commit processes, which often focus solely on what has changed, Smart Commit emphasizes the reasoning behind changes, making it easier for teams to understand the intent behind each commit.
The workflow begins by assessing the current state of your working tree, allowing you to see which files have been modified. If there are unstaged changes, the tool suggests logical groupings for staging, ensuring that related changes are committed together. Once changes are staged, Smart Commit analyzes the diff to determine the appropriate commit type and scope based on the nature of the changes. This includes identifying new features, bug fixes, refactors, and more, all while considering the directory structure to derive meaningful scopes.
Users can also override the auto-detected commit type and scope by providing arguments, allowing for flexibility in how commits are structured. Once the commit message is composed, it follows a strict format that includes an imperative short description and an optional body explaining the rationale behind the changes. This structured approach not only improves the quality of commit messages but also aids in maintaining a clear project history.
Smart Commit is particularly useful for teams that prioritize clear communication and documentation within their version control practices. By ensuring that commit messages convey the 'why' behind changes, it fosters better collaboration and understanding among team members, especially in larger projects where context can easily be lost.
When to use it
Use Smart Commit when you want to create structured and meaningful commit messages that enhance project documentation and collaboration.
When not to use it
This skill may not be suitable for projects that do not follow conventional commit practices or for users who prefer to write commit messages entirely manually.
What you can build with it
Improving Team Collaboration
By using Smart Commit, teams can ensure that commit messages convey the reasoning behind changes, facilitating better communication.
Maintaining Project Documentation
Smart Commit helps maintain a clear project history by generating structured commit messages that explain the context of changes.
Automating Commit Message Generation
Developers can save time and reduce errors in commit message writing by using Smart Commit to automate the process.
How to install Smart Commit
View source1. Install with the skills CLI
npx skills add davila7/claude-code-templates/commit-smart --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by davila7Smart Commit
Create meaningful conventional commits by analyzing your actual changes.
Workflow
Step 1: Assess the working tree
Run these commands to understand the current state:
git status
git diff --stat
git diff --cached --stat
Step 2: Handle unstaged changes
If nothing is staged (git diff --cached is empty):
- Show the user what files have changed
- Suggest what to stage based on logical grouping (e.g., "these 3 files are all related to the auth refactor")
- Ask if they want to stage all, or select specific files
- Stage the approved files with
git add <files>
If changes are already staged, proceed to analysis.
Step 3: Analyze the diff
Read the full staged diff:
git diff --cached
Determine the commit type from the changes:
| Signal | Type |
|---|---|
| New files with new functionality | feat |
| New test files or test additions | test |
| Changes to existing logic fixing incorrect behavior | fix |
| Structural changes without behavior change | refactor |
| package.json, tsconfig, CI config changes | chore |
| Build/bundler config changes | build |
| README, docs, comments only | docs |
| Formatting, whitespace, semicolons only | style |
| Performance improvements | perf |
Determine the scope from the primary directory or module affected:
src/api/->apisrc/components/auth/->authtests/->tests- Root config files -> omit scope
- Multiple unrelated areas -> omit scope
Step 4: Check for user overrides
If the user provided arguments via $ARGUMENTS:
- Single word (e.g.,
fix) -> use as commit type - Two words (e.g.,
refactor api) -> use as type and scope - Otherwise -> use auto-detected values
Step 5: Compose the commit message
Format: type(scope): imperative short description
Rules:
- Subject line max 72 characters
- Use imperative mood ("add", "fix", "refactor", not "added", "fixes")
- Don't end with a period
- Body explains WHY this change was made, not what changed (the diff shows what)
- If changes are trivial (typo fix, formatting), skip the body
Example:
feat(auth): add JWT refresh token rotation
Tokens were expiring mid-session for users with slow connections.
Rotating refresh tokens extends the session without compromising
security, since each refresh token can only be used once.
Step 6: Confirm and commit
Show the user the proposed commit message and ask for confirmation.
If confirmed, run:
git commit -m "<message>"
Then verify with:
git log --oneline -1
Show the committed hash and message.
Tips
- Run after completing a logical unit of work, not after every file change
- If the diff is too large for one commit, suggest splitting into multiple commits
- For breaking changes, add
!after the scope:feat(api)!: change response format - The body should answer "if someone reads this commit in 6 months, will they understand WHY?"
Frequently asked questions about Smart Commit
Similar skills
Release Candidate Preparation
Streamline your OpenAI Agents release process.
Gitmoji
Generate expressive commit messages with emojis.
GitHub Release
Automate your GitHub library release process effortlessly.
Commit Message Storyteller
Generate meaningful commit messages from your git diffs.
Author Contributions
Trace author contributions across branches in Git.
Implementation Kickoff
Streamline your code implementation process with ease.
