commit
Original:🇺🇸 English
Translated
Smart git commit workflow using Conventional Commits format with AI-generated commit message suggestions based on staged changes.
9installs
Sourcehabonn/portal-skills
Added on
NPX Install
npx skill4agent add habonn/portal-skills commitTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Commit Skill
Generate meaningful, well-structured git commits following Conventional Commits specification.
When to Use This Skill
Use this skill when the user:
- Asks to "commit" or "make a commit"
- Says "commit my changes" or "save my work"
- Wants help writing a commit message
- Asks "what should I commit?"
- Needs to commit after completing a task
Conventional Commits Format
All commits must follow this format:
<type>(<scope>): <description>
[optional body]
[optional footer(s)]Commit Types
| Type | Description | Example |
|---|---|---|
| New feature or functionality | |
| Bug fix | |
| Documentation changes only | |
| Code style (formatting, semicolons, no logic change) | |
| Code change that neither fixes bug nor adds feature | |
| Performance improvement | |
| Adding or updating tests | |
| Build system or external dependencies | |
| CI/CD configuration changes | |
| Other changes (tooling, configs) | |
| Revert a previous commit | |
Scope Guidelines
Scope should reflect the area of the codebase affected:
- Component names: ,
button,modalheader - Feature areas: ,
auth,cart,checkoutdashboard - Technical areas: ,
api,db,configdeps - File types: ,
types,hooks,utilsstyles
Commit Workflow
Step 1: Check Current Status
bash
git statusReview what files have been modified, added, or deleted.
Step 2: Review Changes
bash
git diff --stagedIf nothing is staged, check unstaged changes:
bash
git diffStep 3: Stage Changes
Stage specific files:
bash
git add <file1> <file2>Or stage all changes:
bash
git add -AStep 4: Generate Commit Message
Analyze the staged changes and generate an appropriate commit message:
- Identify the primary change type - Is it a feature, fix, refactor, etc.?
- Determine the scope - What component/area is affected?
- Write a concise description - What does this change do? (imperative mood)
- Add body if needed - For complex changes, explain the "why"
Step 5: Execute Commit
bash
git commit -m "<type>(<scope>): <description>"For multi-line commits:
bash
git commit -m "<type>(<scope>): <description>" -m "<body>"AI Message Generation Rules
When generating commit messages from staged changes:
- Analyze the diff to understand what changed
- Identify patterns:
- New files → likely or
feattest - Modified logic → could be ,
fix, orfeatrefactor - Only formatting →
style - Config files → or
chorebuild - Test files →
test - Documentation →
docs
- New files → likely
- Extract scope from file paths or component names
- Write description in imperative mood ("add" not "added")
- Keep it under 72 characters for the subject line
Message Quality Guidelines
Good Commit Messages
feat(auth): add password reset functionality
fix(cart): prevent negative quantity values
refactor(api): extract common error handling logic
docs(contributing): add PR template guidelines
test(checkout): add integration tests for payment flowBad Commit Messages (Avoid)
fix bug # Too vague
updated files # No context
WIP # Not descriptive
asdfasdf # Meaningless
feat: stuff # No scope, vague descriptionBreaking Changes
For breaking changes, add after the type/scope and include in the footer:
!BREAKING CHANGE:feat(api)!: change authentication endpoint response format
BREAKING CHANGE: The /auth/login endpoint now returns { token, user }
instead of just the token string.Multiple Changes
If changes span multiple concerns, prefer atomic commits:
bash
# Instead of one big commit, split into logical units:
git add src/components/Button.tsx
git commit -m "refactor(button): extract common styles"
git add src/components/Button.test.tsx
git commit -m "test(button): add accessibility tests"Example Workflow
User: "commit my changes"
- Run to see changes
git status - Run (or
git diff --stagedif nothing staged)git diff - Analyze the changes
- Suggest: "Based on your changes, I recommend:"
feat(dashboard): add user activity chart component - Ask: "Should I commit with this message, or would you like to modify it?"
- Execute the commit
Tips
- One logical change per commit - Makes history easier to navigate
- Present tense, imperative mood - "add" not "adds" or "added"
- No period at the end of the subject line
- Capitalize the first letter of the description
- Reference issues in the footer when applicable:
Closes #123