conventional-commit

claude_code 0 companion files
Download ZIP ← Back

SKILL.md

---
name: Conventional Commit Message Generator
description: Auto-generate conventional commit messages with emojis from git diff. Use when committing changes, creating commit messages, or when the user mentions "commit", "commit message", or needs help writing commits following conventional commits format with emojis.
allowed-tools: Bash, Read, Grep,
---

# Conventional Commit Message Generator

This skill automatically generates conventional commit messages with emojis based on analyzing git diffs.

## Commit Format

All commits follow this single-line format:
```
<emoji> <type>: <subject>
```

**NO descriptions or body text - single line only!**

## Emoji & Type Mapping

| Emoji | Type | When to Use |
|-------|------|-------------|
| ✨ | feat | New features or functionality |
| 🐛 | fix | Bug fixes |
| 📝 | docs | Documentation changes only |
| ♻️ | refactor | Code restructuring without changing functionality |
| 🎨 | style | Code formatting, missing semicolons, whitespace |
| ⚡ | perf | Performance improvements |
| ✅ | test | Adding or correcting tests |
| 🧑‍💻 | chore | Tooling, configuration, maintenance, dependencies |
| 🚧 | wip | Work in progress (incomplete features) |
| 🔥 | remove | Removing code or files |
| 🚑 | hotfix | Critical production fixes |
| 🔒 | security | Security improvements or fixes |

## Instructions

When the user needs a commit message:

1. **Analyze the changes**:
   ```bash
   git diff --staged
   ```

   If nothing is staged, check unstaged changes:
   ```bash
   git diff
   ```

2. **Determine the commit type**:
   - Look at file extensions and content
   - Check what was added, modified, or removed
   - Identify the primary purpose of the changes

3. **Generate the commit message**:
   - Use imperative mood ("Add feature" not "Added feature")
   - Keep subject under 50 characters
   - Be specific but concise
   - Focus on WHAT changed and WHY, not HOW
   - NO descriptions or multi-line commits

4. **Automatically commit the changes**:
   - If there are unstaged changes, stage them first with `git add .`
   - Execute the commit using the generated message
   - Use simple quoted string format (single quotes to handle emojis safely)
   - DO NOT ask the user for confirmation - proceed with the commit automatically

   Example:
   ```bash
   git commit -m '✨ feat: Add user authentication with JWT'
   ```

5. **Examples of commit messages**:
   ```
   ✨ feat: Add user authentication with JWT
   🐛 fix: Resolve payment webhook timeout
   ♻️ refactor: Simplify auth middleware logic
   ⚡ perf: Optimize database queries with indexing
   📝 docs: Update API endpoint documentation
   🧑‍💻 chore: Update dependencies to latest versions
   🔒 security: Fix SQL injection vulnerability
   ✅ test: Add integration tests for payment flow
   ```

## Decision Tree

```
Is it adding new functionality? → ✨ feat
Is it fixing a bug? → 🐛 fix
Is it only documentation? → 📝 docs
Is it restructuring code without changing behavior? → ♻️ refactor
Is it improving performance? → ⚡ perf
Is it formatting/style only? → 🎨 style
Is it adding/fixing tests? → ✅ test
Is it dependencies/config/tooling? → 🧑‍💻 chore
Is it removing code? → 🔥 remove
Is it a critical production fix? → 🚑 hotfix
Is it security-related? → 🔒 security
Is it incomplete work? → 🚧 wip
```

## Edge Cases

- **Multiple types of changes**: Choose the most significant change
- **Mixed refactor + new feature**: Usually ✨ feat (new feature takes precedence)
- **Bug fix + refactor**: Usually 🐛 fix (bug fix takes precedence)
- **Update dependencies**: 🧑‍💻 chore

## Anti-Patterns to Avoid

❌ `feat: added new feature for users to login`
✅ `✨ feat: Add user login functionality`

❌ `fix: fixed the bug where payment fails`
✅ `🐛 fix: Resolve payment processing failure`

❌ Multi-line commits with descriptions
✅ Single-line commits only

❌ Past tense ("Added", "Fixed")
✅ Imperative mood ("Add", "Fix")

No companion files

Add companion files to enhance this skill

Danger Zone

Deleting this skill will remove all associated files. This action cannot be undone.

Created
11/4/2025, 6:25:10 PM
Last Updated
11/4/2025, 6:25:10 PM
🆔 Skill ID
UtJj8-m26w3ugla7B3qHG