Git Commit Formatter Skill
When writing a git commit message, you MUST follow the Conventional Commits specification.
Format
<type>[optional scope]: <description>
Allowed Types
- •feat: A new feature
- •fix: A bug fix
- •docs: Documentation only changes
- •style: Changes that do not affect the meaning of the code (white-space, formatting, etc)
- •refactor: A code change that neither fixes a bug nor adds a feature
- •perf: A code change that improves performance
- •test: Adding missing tests or correcting existing tests
- •chore: Changes to the build process or auxiliary tools and libraries such as documentation generation
Instructions
- •Scope of Analysis: Analyze only the Staged Changes (the diff between the Index and HEAD). Ignore all Unstaged Changes.
- •Determine Type: Identify the primary
typebased on allowed types. - •Identify Scope: Identify the scope if applicable, representing the specific module, component, or file path affected (e.g., (api), (ui), (auth)).
- •Subject Line: Write a concise description in the imperative mood (e.g., "add feature" not "added feature").
- •Constraint: Limit the subject to 50 characters.
- •Format: type(scope): description
- •Body: Provide a detailed body explaining the motivation (why) and the summary of changes (how).
- •Constraint: Wrap lines at 72 characters.
- •Separation: Use a blank line between the subject and the body.
- •Breaking Changes: If the changes break backward compatibility, add a footer starting with BREAKING CHANGE: followed by a description of the change.
- •Security: Always use GPG signing for the commit. Ensure the final command does not include the --no-gpg-sign flag.
- •User Confirmation: Proactively present the generated commit message (subject and body) to the user and ask for their confirmation before executing the
git commitcommand.
Example
feat(auth): implement login with google