Generate structured commit messages following project conventions.
This prompt helps create consistent, well-formatted commit messages that align with the project's established patterns.
Given the current changes in the working directory, do this:
-
Check the current git status to identify modified files:
- Use
git statusto see what files have been changed - Use
git diff --cachedif files are already staged - Use
git diffto see unstaged changes
- Use
-
Analyze recent commit history for message structure:
- Run
git log --format="%h %s%n%b" -5to see recent commit patterns - Identify the established conventions (prefixes, format, style)
- Run
-
Generate a structured commit message that includes:
- Type prefix: Use appropriate prefix (feat:, fix:, docs:, test:, refactor:, style:, chore:)
- Brief summary: Concise description of the main change (50 chars max)
- Detailed body: Bullet-pointed list explaining specific changes
- Impact description: What problems are solved or features added
- Test status: Mention if tests are passing/fixed
-
Stage and commit the changes:
- Use
git addfor relevant files - Use
git commit -s -m "message"with the-sflag for signed-off-by - Ensure the message follows the project's established format
- Use
- feat: New features or significant enhancements
- fix: Bug fixes and issue resolutions
- docs: Documentation updates
- test: Test additions or modifications
- refactor: Code restructuring without functional changes
- style: Code formatting, whitespace, etc.
- chore: Build processes, dependencies, maintenance
type: brief summary of changes
- Specific change 1 with technical details
- Specific change 2 explaining what was modified
- Impact or problem solved by these changes
- Test results or validation performed
# Feature addition
git commit -s -m "feat: implement user authentication system
- Add JWT token-based authentication middleware
- Create login/logout API endpoints with validation
- Implement password hashing with bcrypt
- Add user registration with email verification
- All authentication tests passing successfully"
# Bug fix
git commit -s -m "fix: resolve database connection timeout issues
- Increase connection pool size from 10 to 25
- Add connection retry logic with exponential backoff
- Fix memory leak in database query caching
- Update configuration for production environment
- Database stress tests now passing without timeouts"