Generate Commit Message
Analyze staged changes and generate a single-line commit message.
Instructions
-
Check for staged changes
- Run
git diff --cachedto see what's staged - If nothing is staged, check
git statusand suggest what to stage
- Run
-
Check project conventions
- Run
git log --oneline -10to see recent commit style - Match the existing format (conventional commits, prefixes, etc.)
- Run
-
Generate a single-line commit message
Best Practices
- 50 characters or less - keep it concise
- Imperative mood - "Add feature" not "Added feature" or "Adds feature"
- Capitalize the first letter
- No period at the end
- What and why, not how
If the project uses Conventional Commits, use the format:
type(scope): description
Types: feat, fix, docs, style, refactor, test, chore
Output
Print the commit message in a code block:
Add user authentication endpoint