home / skills / datamktkorea / agent-skills / git-commit

git-commit skill

/skills/git-commit

This skill helps you craft consistent git commit messages using Conventional Commits and Gitmoji for clear history.

npx playbooks add skill datamktkorea/agent-skills --skill git-commit

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.2 KB
---
name: git-commit
description: A skill for writing Git commit messages. It follows rules combining Conventional Commits and Gitmoji to maintain a consistent commit history.
---

# Git Commit Message Convention

Utilize this skill when writing Git commit messages to apply Conventional Commits rules and Gitmoji.

## When to Use This Skill

Activate this skill in the following situations:

- When committing code changes
- When a commit message format is required
- When you need to maintain a consistent commit history

## How to Write Commit Messages

### Step 1: Check Staged Changes

Check the staged changes using the `git diff --staged` command.

### Step 2: Determine Commit Type

Select the appropriate type and Gitmoji for the changes:

| Gitmoji |         Code         | Type       | Description                             |
| :-----: | :------------------: | :--------- | :-------------------------------------- |
|   ✨    |     `:sparkles:`     | `feat`     | Add a new feature                       |
|   šŸ›    |       `:bug:`        | `fix`      | Fix a bug                               |
|   šŸ“    |       `:memo:`       | `docs`     | Add or update documentation             |
|   šŸŽØ    |       `:art:`        | `style`    | Code formatting, structural improvement |
|   ā™»ļø    |     `:recycle:`      | `refactor` | Code refactoring                        |
|   āœ…    | `:white_check_mark:` | `test`     | Add or update test code                 |
|   šŸ”§    |      `:wrench:`      | `chore`    | Update build, config files, etc.        |
|   šŸš€    |      `:rocket:`      | `perf`     | Improve performance                     |
|   šŸ”–    |     `:bookmark:`     | `release`  | Version release                         |

> Always check this: [gitmoji | An emoji guide for your commit messages](https://gitmoji.dev/)

### Step 3: Compose the Message

Compose the commit message in the following format:

```text
<gitmoji> <type>(<scope>): <subject>

<body>

<footer>
```

**Components:**

- **Gitmoji (Required)**: An emoji that visually represents the purpose of the commit.
- **Type (Required)**: The category of change (feat, fix, docs, style, refactor, perf, test, chore, release).
- **Scope (Optional)**: The name of the affected module (e.g., `(api)`, `(chat)`, `(auth)`).
- **Subject (Required)**: A concise description of the changes.
  - Use the imperative present tense ("add", not "added").
  - Use a lowercase first letter.
  - No period at the end.
  - Keep it under 50 characters.
- **Body (Optional)**: Explanation of the motivation for the change and how it differs from previous behavior.
- **Footer (Optional)**: Issue tracking (`Closes #123`) or recording Breaking Changes.

### Step 4: Example

```text
✨ feat(auth): add password reset via email

- Implemented a new endpoint `/auth/request-password-reset` that sends a secure, time-limited token to the user's email.
- Added a corresponding service to handle token generation and email dispatch.

Closes #78
```

## Guidelines

- **Language**: Write commit messages in English.
- **Gitmoji Reference**: [https://gitmoji.dev/](https://gitmoji.dev/)
- **Clarity**: The Subject explains "what," and the Body explains "why."
- **Breaking Changes**: Record them in the Footer with the `BREAKING CHANGE:` prefix.

Overview

This skill generates well-structured Git commit messages by combining Conventional Commits with Gitmoji. It enforces a consistent, readable history that makes intent and scope clear for reviewers and automation.

How this skill works

Inspect staged changes and choose a commit type and matching Gitmoji (e.g., ✨ feat, šŸ› fix, šŸ“ docs). Compose messages in the format: <gitmoji> <type>(<scope>): <subject> followed by an optional body and footer for additional context or issue references. The skill enforces rules for tense, capitalization, length, and placement of breaking changes.

When to use it

  • When creating commits for code, docs, tests, or configuration changes
  • When the repository requires a consistent commit format for CI/CD or changelogs
  • When you want commit messages to clearly communicate what and why
  • Before pushing changes to shared branches or opening pull requests
  • When automated tools parse commit messages to generate releases

Best practices

  • Run git diff --staged to review changes before composing a message
  • Pick the single most appropriate type and include a Gitmoji to visualize intent
  • Keep the subject under 50 characters, imperative present tense, no trailing period
  • Use scope to indicate the affected module (api, auth, chat) when helpful
  • Add a body to explain reasoning or design trade-offs; use the footer for issues or BREAKING CHANGE

Example use cases

  • Committing a new feature: ✨ feat(auth): add password reset via email
  • Fixing a bug that caused crashes: šŸ› fix(api): handle null user in session middleware
  • Updating documentation: šŸ“ docs(readme): document setup and env variables
  • Refactoring code for maintainability: ā™»ļø refactor(cache): simplify eviction logic
  • Tagging a release: šŸ”– release: v1.2.0

FAQ

Do I have to include a Gitmoji?

Yes. This skill requires a Gitmoji at the start to make the commit intent immediately recognizable.

What goes in the footer?

Use the footer for issue references like Closes #123 and to record BREAKING CHANGE: followed by a description.