Guides AI to create structured conventional Git commit messages.
# Git Commit Guidelines for AI Language Models ## Core Principles 1. **Follow Conventional Commits** (https://www.conventionalcommits.org/) 2. **Be concise and precise** - No flowery language, superlatives, or unnecessary adjectives 3. **Focus on WHAT changed, not HOW it works** - Describe the change, not implementation details 4. **One logical change per commit** - Split related but independent changes into separate commits 5. **Write in imperative mood** - "Add feature" not "Added feature" or "Adds feature" 6. **Always include body text** - Never use subject-only commits ## Commit Message Structure ``` <type>(<scope>): <subject> <body> <footer> ``` ### Type (Required) - `feat`: New feature - `fix`: Bug fix - `refactor`: Code change that neither fixes a bug nor adds a feature - `perf`: Performance improvement - `style`: Code style changes (formatting, missing semicolons, etc.) - `test`: Adding or updating tests - `docs`: Documentation changes - `build`: Build system or external dependencies (npm, gradle, Xcode, SPM) - `ci`: CI/CD pipeline changes - `chore`: Routine tasks (gitignore, config files, maintenance) - `revert`: Revert a previous commit ### Scope (Optional but Recommended) Indicates the area of change: `auth`, `ui`, `api`, `db`, `i18n`, `analytics`, etc. ### Subject (Required) - **Max 50 characters** - **Lowercase first letter** (unless it's a proper noun) - **No period at the end** - **Imperative mood**: "add" not "added" or "adds" - **Be specific**: "add email validation" not "add validation" ### Body (Required) - **Always include body text** - Minimum 1 sentence - **Explain WHAT changed and WHY** - Provide context - **Wrap at 72 characters** - **Separate from subject with blank line** - **Use bullet points for multiple changes** (use `-` or `*`) - **Reference issue numbers** if applicable - **Mention specific classes/functions/files when relevant** ### Footer (Optional) - **Breaking changes**: `BREAKING CHANGE: <description>` - **Issue references**: `Closes #123`, `Fixes #456` - **Co-authors**: `Co-Authored-By: Name <email>` ## Banned Words & Phrases **NEVER use these words** (they're vague, subjective, or exaggerated): ❌ Comprehensive ❌ Robust ❌ Enhanced ❌ Improved (unless you specify what metric improved) ❌ Optimized (unless you specify what metric improved) ❌ Better ❌ Awesome ❌ Great ❌ Amazing ❌ Powerful ❌ Seamless ❌ Elegant ❌ Clean ❌ Modern ❌ Advanced ## Good vs Bad Examples ### ❌ BAD (No body) ``` feat(auth): add email/password login ``` **Problems:** - No body text - Doesn't explain what was actually implemented ### ❌ BAD (Vague body) ``` feat: Add awesome new login feature This commit adds a powerful new login system with robust authentication and enhanced security features. The implementation is clean and modern. ``` **Problems:** - Subjective adjectives (awesome, powerful, robust, enhanced, clean, modern) - Doesn't specify what was added - Body describes quality, not functionality ### ✅ GOOD ``` feat(auth): add email/password login with Firebase Implement login flow using Firebase Authentication. Users can now sign in with email and password. Includes client-side email validation and error handling for network failures and invalid credentials. ``` **Why it's good:** - Specific technology mentioned (Firebase) - Clear scope (auth) - Body describes what functionality was added - Explains what error handling covers --- ### ❌ BAD (No body) ``` fix(auth): prevent login button double-tap ``` **Problems:** - No body text explaining the fix ### ✅ GOOD ``` fix(auth): prevent login button double-tap Disable login button after first tap to prevent duplicate authentication requests when user taps multiple times quickly. Button re-enables after authentication completes or fails. ``` **Why it's good:** - Imperative mood - Specific problem described - Body explains both the issue and solution approach --- ### ❌ BAD ``` refactor(auth): extract helper functions Make code better and more maintainable by extracting functions. ``` **Problems:** - Subjective (better, maintainable) - Not specific about which functions ### ✅ GOOD ``` refactor(auth): extract helper functions to static struct methods Convert private functions randomNonceString and sha256 into static methods of AppleSignInHelper struct for better code organization and namespacing. ``` **Why it's good:** - Specific change described - Mentions exact function names - Body explains reasoning and new structure --- ### ❌ BAD ``` feat(i18n): add localization ``` **Problems:** - No body - Too vague ### ✅ GOOD ``` feat(i18n): add English and Turkish translations for login screen Create String Catalog with translations for login UI elements, alerts, and authentication errors in English and Turkish. Covers all user-facing strings in LoginView, LoginViewController, and AuthService. ``` **Why it's good:** - Specific languages mentioned - Clear scope (i18n) - Body lists what was translated and which files --- ## Multi-File Commit Guidelines ### When to Split Commits Split changes into separate commits when: 1. **Different logical concerns** - ✅ Commit 1: Add function - ✅ Commit 2: Add tests for function 2. **Different scopes** - ✅ Commit 1: `feat(ui): add button component` - ✅ Commit 2: `feat(api): add endpoint for button action` 3. **Different types** - ✅ Commit 1: `feat(auth): add login form` - ✅ Commit 2: `refactor(auth): extract validation logic` ### When to Combine Commits Combine changes in one commit when: 1. **Tightly coupled changes** - ✅ Adding a function and its usage in the same component 2. **Atomic change** - ✅ Refactoring function name across multiple files 3. **Breaking without each other** - ✅ Adding interface and its implementation together ## File-Level Commit Strategy ### Example: LoginView Changes If LoginView has 2 independent changes: **Change 1:** Refactor stack view structure **Change 2:** Add loading indicator **Split into 2
This prompt equips AI language models with strict rules for writing Git commit messages based on Conventional Commits. It enforces specific structure, imperative mood, required body text, and bans vague language to produce consistent, professional results. The output is always a ready-to-use commit message suitable for any repository.
Replace these parts of the prompt with your own details.
The AI returns a full commit message such as 'fix(auth): validate email format - Reject invalid email addresses during signup Fixes #312' following all formatting constraints.
Yes, a clear textual summary of changes is sufficient for the AI to generate the message.
Prompt text from the public-domain (CC0) awesome-chatgpt-prompts collection, contributed by alioss2918@gmail.com. How-to-use guidance, tips and use-cases written by Dhanasvi's agents.