| name | commit |
| description | Git commit workflow with Conventional Commits format. Analyzes changes, generates commit message, handles staging. |
Commit Skill
Usage
/commit [--type <type>] [--scope <scope>]
Parameters
--type: feat | fix | docs | style | refactor | test | chore
--scope: Optional scope (e.g., auth, api, ui)
Examples
/commit
/commit --type feat --scope auth
/commit --type fix
Conventional Commits Format
<type>(<scope>): <description>
[optional body]
[optional footer]
Types
| Type | Description | Example |
|---|
feat | New feature | feat(auth): add OAuth2 login |
fix | Bug fix | fix(api): handle null response |
docs | Documentation | docs: update README |
style | Formatting | style: fix indentation |
refactor | Code restructure | refactor(utils): extract helper |
test | Tests | test(auth): add login tests |
chore | Maintenance | chore: update dependencies |
perf | Performance | perf(db): optimize query |
ci | CI/CD | ci: add GitHub Actions |
build | Build system | build: update webpack config |
Scope Examples
auth - Authentication
api - API layer
ui - User interface
db - Database
config - Configuration
Workflow
Step 1: Analyze Changes
git status
git diff --staged
git diff
Step 2: Determine Type
Based on changes:
- New functionality โ
feat
- Bug fix โ
fix
- Only .md files โ
docs
- Tests added โ
test
- Code cleanup โ
refactor
- Dependencies โ
chore
Step 3: Identify Scope
From changed files:
src/auth/* โ scope: auth
src/api/* โ scope: api
- Multiple areas โ no scope
Step 4: Generate Message
## Changes Detected
### Modified Files
- src/auth/login.ts (+45, -12)
- src/auth/logout.ts (+8, -2)
### Analysis
- Type: feat (new functionality)
- Scope: auth (auth directory)
- Breaking: No
### Suggested Commit
feat(auth): implement session management
- Add session token generation
- Implement token refresh logic
- Add logout with token invalidation
Closes #42
Step 5: Execute Commit
git add -A
git commit -m "feat(auth): implement session management
- Add session token generation
- Implement token refresh logic
- Add logout with token invalidation
Closes #42"
Breaking Changes
For breaking changes, add ! and footer:
feat(api)!: change response format
BREAKING CHANGE: Response now returns { data, meta } instead of raw data.
Migration: Wrap existing handlers with responseAdapter().
Best Practices
- Atomic Commits: One logical change per commit
- Present Tense: "add feature" not "added feature"
- Imperative: "fix bug" not "fixes bug"
- No Period: Don't end subject with period
- 50/72 Rule: Subject โค50 chars, body โค72 per line
Special Cases
Multiple Types
Split into multiple commits:
/commit
/commit
Work in Progress
chore(wip): save progress on feature X
NOT READY FOR REVIEW
- Basic structure done
- Need to add validation
Revert
revert: feat(auth): add OAuth2 login
This reverts commit abc1234.
Reason: Breaks legacy clients.
Output
## Commit Created
**Hash**: abc1234
**Type**: feat
**Scope**: auth
**Message**: implement session management
### Files Committed
- src/auth/login.ts
- src/auth/logout.ts
### Stats
- 2 files changed
- 53 insertions
- 14 deletions