dotfiles
bugabingas dorkfiles
owned by bugabinga
opencode/skills/git-commit/SKILL.md
Raw
name: git-commit
description: Write semantic git commits in conventional commit format — feat/fix/chore/docs types, scope, breaking change notation (!), atomic commit discipline, changelog-ready messages.
license: MIT
What I do
Create well-formatted commits following conventional commit standards.
Principles
- One topic per branch: Don't jump between topics
- Build logically: Each commit sets up the next
- Small and atomic: One "thing" per commit, repo should build and pass tests
Format
<type>(<scope>): <subject>
<body>
<footer>
Subject Line
- Imperative mood: "add" not "added"
- No period at end
- Max 50 characters
Body
- Explain what and why, not how
- Wrap at 72 characters
Footer
- References: "Closes #123"
- Breaking: "BREAKING CHANGE: ..."
Types
- feat: New features
- fix: Bug fixes
- docs: Documentation
- style: Formatting
- refactor: Code change
- test: Tests
- chore: Maintenance
- perf: Performance
Examples
feat(auth): add JWT login endpoint
Implement JWT authentication with refresh tokens.
- POST /api/login returns access token
- Add token validation middleware
Closes #45
fix(array): handle null input in reducer
Returns empty array when input is null to prevent crashes.
Fixes #123
Workflow
# Stage
git add <files>
git diff --cached
# Commit
git commit -m "type(scope): subject"
# Verify
git log --oneline -3
Rewriting History
git rebase -i main
# pick, reword, edit, squash, fixup, drop
git commit --fixup=<sha>
git rebase --autosquash main
Checklist
- One thing per commit?
- Repo builds if rolled back?
- Message explains WHY?
- Under 50 characters?
- No "and" in subject?
Use to create clear, helpful commits.
Markdown source
---
name: git-commit
description: Write semantic git commits in conventional commit format — feat/fix/chore/docs types, scope, breaking change notation (!), atomic commit discipline, changelog-ready messages.
license: MIT
---
## What I do
Create well-formatted commits following conventional commit standards.
## Principles
- **One topic per branch**: Don't jump between topics
- **Build logically**: Each commit sets up the next
- **Small and atomic**: One "thing" per commit, repo should build and pass tests
## Format
```
<type>(<scope>): <subject>
<body>
<footer>
```
### Subject Line
- Imperative mood: "add" not "added"
- No period at end
- Max 50 characters
### Body
- Explain what and why, not how
- Wrap at 72 characters
### Footer
- References: "Closes #123"
- Breaking: "BREAKING CHANGE: ..."
## Types
- feat: New features
- fix: Bug fixes
- docs: Documentation
- style: Formatting
- refactor: Code change
- test: Tests
- chore: Maintenance
- perf: Performance
## Examples
```
feat(auth): add JWT login endpoint
Implement JWT authentication with refresh tokens.
- POST /api/login returns access token
- Add token validation middleware
Closes #45
```
```
fix(array): handle null input in reducer
Returns empty array when input is null to prevent crashes.
Fixes #123
```
## Workflow
```bash
git add <files>
git diff --cached
git commit -m "type(scope): subject"
git log --oneline -3
```
## Rewriting History
```bash
git rebase -i main
git commit --fixup=<sha>
git rebase --autosquash main
```
## Checklist
- [ ] One thing per commit?
- [ ] Repo builds if rolled back?
- [ ] Message explains WHY?
- [ ] Under 50 characters?
- [ ] No "and" in subject?
---
Use to create clear, helpful commits.