This Skill does not directly perform git commit or git add operations, but instead provides the current Agent with commit messagedecision guidanceandformat standards。
Core Strategy
1. Style Learning (Priority)
Before generating a commit message, you must first observe the project's existing commit habits:
- Run
git log -n 5 --oneline。 - Match history: If the project habitually uses specific prefixes (such as
[FEAT]、Update:, etc.) or language habits, prioritize imitating them and staying consistent. - Language consistency: If the history is entirely in Chinese, use Chinese descriptions; if it is entirely in English, use English.
2. Specification Fallback
If the project's commit records are empty, show no clear pattern, or the project explicitly requires standardized commits, follow the Conventional Commits specification:
<type>(<scope>): <subject>
<body>
Type Definitions
feat: new featurefix: bug fixdocs: documentation changesstyle: changes that do not affect the meaning of the code (whitespace, formatting, missing semicolons, etc.)refactor: refactoring (code changes that neither fix a bug nor add a feature)perf: performance improvementtest: adding missing tests or correcting existing testsbuild: changes that affect the build system or external dependenciesci: changes to CI configuration files and scriptschore: other changes that do not modify src or test filesrevert: revert a previous commit
Subject Format
- Use the imperative mood (e.g. "add" instead of "added").
- Do not end with a period.
- Lowercase the first letter (unless it is a proper noun).
- Keep the length within 50 characters.
Operational Instructions (For Agent Reference Only)
When the Agent needs to generate a commit message, it should think according to the following logic:
- Observe: Use
git log -n 5 --onelineto observe the project style. - Judge:
- An established pattern is found? → Imitate that pattern.
- A Conventional Commits pattern is found? → Follow this specification.
- Initial commit/no pattern? → Adopt Conventional Commits.
- Write:
- A concise Subject.
- Provide a Body when necessary (explain Why rather than How).
- Reference the Issue (e.g.
Closes #123)。
Precautions
- Strictly prohibit over-engineering: Do not generate overly complex commit messages unless the changes are genuinely complex.
- Atomicity: It is recommended that one commit does only one thing. If too many changes are found, it is recommended to prompt the user to split the commit.
- Do not execute commands: This Skill only provides "message suggestions"; execution operations are decided by the main Agent.