--- name: commit-message description: Generate meaningful, conventional commit messages from code changes ---
Pro shows the line behind each finding and how to fix it
Scanned 2/12/2026
npx -y skills add lovedragonball/power-ranger-toolkit --skill commit-message --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Commit Message?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/lovedragonball-commit-message)More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.
# 📝 Commit Message Skill
---
name: commit-message
description: Generate meaningful, conventional commit messages from code changes
---
## 🎯 Purpose
สร้าง commit messages ที่มีความหมาย ตาม Conventional Commits standard จาก code changes อัตโนมัติ
## 📋 When to Use
- เมื่อ stage changes และพร้อม commit
- ต้องการ consistent commit style
- ต้องการ auto-generate changelogs
- Team ใช้ conventional commits
## 🔧 Conventional Commits Format
```
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
```
### Types
| Type | Description | Example |
|------|-------------|---------|
| `feat` | New feature | `feat: add user authentication` |
| `fix` | Bug fix | `fix: resolve login redirect issue` |
| `docs` | Documentation | `docs: update API documentation` |
| `style` | Formatting (no code change) | `style: format code with prettier` |
| `refactor` | Refactoring | `refactor: extract validation logic` |
| `perf` | Performance | `perf: optimize database queries` |
| `test` | Tests | `test: add unit tests for utils` |
| `build` | Build system | `build: update webpack config` |
| `ci` | CI/CD | `ci: add GitHub Actions workflow` |
| `chore` | Maintenance | `chore: update dependencies` |
| `revert` | Revert | `revert: undo last commit` |
### Scope (Optional)
```
feat(auth): add OAuth2 support
fix(api): handle timeout errors
docs(readme): add installation guide
refactor(components): simplify Button props
```
## 📝 Generation Process
```
1. ANALYZE changes
- git diff --staged
- Identify changed files
- Detect change patterns
2. DETECT type
- New files → feat
- Deleted code → fix or refactor
- Test files → test
- Config changes → build/ci
3. IDENTIFY scope
- By folder (auth, api, ui)
- By feature
- By component
4. GENERATE description
- Imperative mood
- Clear and concise
- Max 72 characters
5. ADD body (if needed)
- Explain WHY
- Reference issues
- Breaking changes
```
## 📊 Examples by Change Type
### New Feature
```bash
# Changes: Created new UserProfile component
feat(user): add user profile component
- Display user avatar, name, and bio
- Add skeleton loading state
- Implement responsive layout
```
### Bug Fix
```bash
# Changes: Fixed null check in API
fix(api): handle null response in user fetch
The API was crashing when user data was null.
Added proper null check and fallback value.
Closes #123
```
### Refactoring
```bash
# Changes: Extracted logic to custom hook
refactor(hooks): extract useAuth from AuthContext
- Created useAuth hook for auth state
- Reduced AuthProvider complexity
- Improved testability
```
### Breaking Change
```bash
# Changes: Changed API signature
feat(api)!: change login API response format
BREAKING CHANGE: The login response now returns
{ user, token } instead of { data: { user, token } }
```
## 🔧 Auto-Generation Logic
```typescript
function generateCommitMessage(diff: string): string {
// Analyze diff
const files = parseChangedFiles(diff);
const additions = countAdditions(diff);
const deletions = countDeletions(diff);
// Determine type
let type = 'chore';
if (files.some(f => f.includes('.test.'))) type = 'test';
if (files.some(f => f.includes('README') || f.includes('.md'))) type = 'docs';
if (additions > deletions * 2) type = 'feat';
if (deletions > additions && hasFixPattern(diff)) type = 'fix';
// Determine scope
const scope = detectScope(files);
// Generate description
const description = generateDescription(diff, type);
return scope
? `${type}(${scope}): ${description}`
: `${type}: ${description}`;
}
```
## 📋 Good Commit Messages
### ✅ Good
```
feat(cart): add product quantity selector
fix(auth): prevent duplicate login requests
docs(api): document rate limiting behavior
refactor(utils): simplify date formatting logic
test(user): add integration tests for signup
```
### ❌ Bad
```
fixed stuff
update
WIP
changes
asdfasdf
```
## 🛠️ Tools
### Commitizen
```bash
npm install -g commitizen
git cz # Interactive commit
```
### Husky + Commitlint
```bash
npm install -D husky @commitlint/cli @commitlint/config-conventional
```
```javascript
// commitlint.config.js
module.exports = {
extends: ['@commitlint/config-conventional']
};
```
## ✅ Commit Message Checklist
- [ ] Type is correct
- [ ] Scope is relevant (if used)
- [ ] Description is clear
- [ ] Uses imperative mood ("add" not "added")
- [ ] Less than 72 characters
- [ ] Body explains WHY (if complex)
- [ ] References issues/PRs (if applicable)
- [ ] Breaking changes noted
## 🔗 Related Skills
- `git-workflow` - Git operations
- `changelog-generator` - Generate changelogs
- `pr-review` - Review pull requests
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!