tomwangowa

commit-msg-generator

0
0
# Install this skill:
npx skills add tomwangowa/agent-skills --skill "commit-msg-generator"

Install specific skill from multi-skill repository

# Description

Generate high-quality commit messages following Conventional Commits specification. Use this Skill when the user asks to generate commit message, write commit message, or create commit description.

# SKILL.md


name: commit-msg-generator
description: Generate high-quality commit messages following Conventional Commits specification. Use this Skill when the user asks to generate commit message, write commit message, or create commit description.


Commit Message Generator

Purpose

This Skill generates well-structured commit messages that follow the Conventional Commits specification by:
1. Analyzing staged changes (git diff --cached)
2. Using Gemini CLI to understand the changes and their purpose
3. Generating a properly formatted commit message
4. Providing the message in a ready-to-use format

The Skill helps maintain consistent commit history and saves time writing descriptive commit messages.


Instructions

When the user expresses intent to generate a commit message (for example: "generate commit message", "write commit message", "help me commit"), follow the steps below strictly.

Execution steps

  1. Run the script scripts/generate_commit_msg.sh.

  2. The script will:

  3. Check that there are staged changes
  4. Analyze the diff to understand what changed
  5. Use Gemini to generate a commit message following Conventional Commits format
  6. Display the generated message

  7. Present the generated commit message to the user and explain:

  8. The commit type and scope
  9. Why this message accurately describes the changes
  10. How to use it (copy it or use git commit -F command)

  11. Optional: Ask if the user wants to:

  12. Use the message as-is
  13. Make modifications
  14. Regenerate with different emphasis

Output requirements

Your response should include:

  • Generated commit message
    Display the full commit message clearly

  • Explanation
    Brief explanation of why this type/scope was chosen

  • Usage instructions
    How to apply the message to the commit

  • Alternative options
    Offer to modify or regenerate if needed


Constraints

  • Only works when there are staged changes (git add must be run first)
  • Requires Gemini CLI to be installed and configured
  • Message format strictly follows Conventional Commits specification
  • Subject line must be 50 characters or less
  • Body lines wrapped at 72 characters

Examples

User:

Generate a commit message for my staged changes

Expected behavior:
- Run generate_commit_msg.sh
- Display the generated message with formatting
- Explain the commit type and reasoning
- Provide command to use the message


User:

Help me write a commit message

Expected behavior:
- Same workflow as above
- Show both the raw message and usage command


User:

I need a commit description

Expected behavior:
- Generate message following conventional commits
- Explain what makes this a good commit message
- Offer to regenerate if user wants different emphasis


Commit Message Format

The generated messages follow this format:

type(scope): subject line

Optional body explaining what and why, not how.
Can include bullet points for multiple changes.

Co-Authored-By: Gemini AI <[email protected]>

Types:
- feat: New feature
- fix: Bug fix
- docs: Documentation
- style: Formatting
- refactor: Code restructuring
- perf: Performance
- test: Tests
- chore: Maintenance
- ci: CI/CD
- build: Build system

Best Practices:
- Subject in imperative mood ("add" not "added")
- Subject starts with lowercase
- No period at end of subject
- Body explains "what" and "why", not "how"

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.