env.dev

AI Commit Message Prompts

Prompts for generating commit messages with LLMs. Conventional commits, meaningful descriptions from diffs.

Overview

LLMs can generate clear, conventional commit messages from git diffs. Provide the diff and specify the commit convention to get consistent, meaningful messages that explain the "why" behind changes.

Commit Message Prompt Template

Prompt
Generate a commit message for this diff using Conventional Commits.

Rules:
- Format: type(scope): description
- Types: feat, fix, chore, docs, refactor, test, style, ci, perf
- Subject line under 72 characters, focused on WHY not WHAT
- Add body with bullet points for complex changes

Diff:
```diff
[paste git diff]
```

Conventional Commit Types

TypeWhen to UseExample
featNew featurefeat(auth): add Google OAuth login
fixBug fixfix(api): handle null user in /profile
choreMaintenancechore(deps): update typescript to 5.9
docsDocumentationdocs(readme): add deployment instructions
refactorCode restructurerefactor(utils): extract date formatting
testTests onlytest(auth): add login flow integration tests

Multi-Change Commits

If a diff contains multiple logical changes, ask the LLM whether it should be one commit or split into multiple. Follow the single-responsibility principle for commits — each commit should represent one logical change.

Frequently Asked Questions

Can LLMs write good commit messages?

Yes. Provide the git diff and specify the convention. LLMs generate clear, conventional commit messages focused on "why" rather than "what."

What commit convention should I use?

Conventional Commits (feat:, fix:, chore:, etc.) is the most widely adopted. It enables automatic changelog generation and semantic versioning.