Back to Prompts

Conventional Commit Message Generator

GitVersion ControlConventional CommitsBest Practices
Added: Content reviewed: •Difficulty: Beginner•Suggested tools: ChatGPT, Claude

The review date covers the prompt content, not testing against specific AI models or versions.

Description

Draft commit messages from your actual changes, with Conventional Commits requirements kept separate from optional writing preferences.

The Prompt

Task

Draft commit messages for the change described below. Use Conventional Commits 1.0.0 and the repository's stated writing preferences. Base every claim on the supplied change information.

Change Information

  • What changed: [Plain-English summary or a small, redacted diff]
  • Files/areas affected: [Relevant paths or components]
  • Why: [Problem or motivation]
  • Breaking change: [No, yes with migration details, or unknown]
  • Verification actually performed: [Checks and results, or not run]
  • Related issue: [Real issue reference, or none]
  • Repository conventions: [Allowed types/scopes, length limits, and other rules]

Share only code and context you are allowed to share. Remove secrets, personal data, private URLs, and sensitive ticket details from diffs and descriptions.

Specification vs Writing Preferences

Conventional Commits 1.0.0

Use a type, an optional parenthesized scope, an optional breaking-change marker (!), then a colon, a space, and a description. A body and footers are optional, separated by blank lines. Use feat for a new feature and fix for a bug fix; other types are allowed. Mark a breaking change with ! before the colon or a BREAKING CHANGE: footer. With ! alone, explain the break in the description.

Reference: https://www.conventionalcommits.org/en/v1.0.0/

Writing Preferences for This Prompt

These are defaults, not requirements of the specification. Use the repository's preferences when provided:

  • Prefer a lowercase type and scope, an imperative description, and no final period in the header.
  • Aim for a header of 50 characters or fewer, including the prefix. Preserve clarity if no hard repository limit applies.
  • Wrap body prose near 72 characters when practical.
  • Explain the reason for a non-obvious change in the body.
  • Include issue references only when supplied and relevant.

For types beyond feat and fix, follow the repository's definitions. Common choices include docs, refactor, perf, test, build, ci, and chore. Do not imply this is an exhaustive or required list.

Output

Provide up to three versions for the same change:

  1. A concise header.
  2. A header and short body explaining the reason.
  3. A fuller message only when the supplied context justifies it.

Keep each proposed message in its own code block. Briefly explain the type/scope choice outside the blocks. If the change includes unrelated work, suggest how to separate it instead of hiding it in a vague message.

Constraints

  • Do not invent issue numbers, test results, user impact, or implementation details.
  • Do not add a breaking-change marker without evidence. Ask if compatibility is unclear and material to the message.
  • For a confirmed breaking change, retain the marker in every proposed version and include supplied migration guidance in longer versions.
  • Do not create a longer version merely to repeat the shorter one.
  • Draft messages only; do not run git commands or create commits.

How to Use

1. Copy the prompt. 2. Describe the actual change and why it was needed. 3. Add any repository commit rules and real issue references. 4. State whether compatibility changes and which checks actually ran. 5. Review the draft against your diff before using it.

How to Customize

• Add your repository's allowed types and scope names. • Set a hard header limit if your tooling requires one. • Supply your issue-reference format. • Include confirmed migration details for a breaking change. • Ask for just one message when the change is small.

Expected Outcome

One to three grounded commit-message options, using the specification's structure and your chosen writing style. Short changes may only need a header. Missing facts should stay missing or become questions, not invented claims.

Pro Tips

Write for the person reading git log later. Keep the reason for the change clear. A 50-character header, 72-character body wrapping, lowercase wording, and imperative mood are useful style choices; Conventional Commits itself does not require them.

Illustrative Worked Example

This fictional input and suggested response illustrate how to use the prompt. They are not recorded model test results.

Input:

Change: cart total now passes 0 as the initial value to reduce.
Before: an empty prices array threw a TypeError.
After: an empty prices array returns 0.
Files: src/cart/total.js
Breaking change: no.
Verification: no tests run yet.
Related issue: none.
Repository style: lowercase type/scope; prefer a short header.

Suggested response:

Concise:
fix(cart): return zero for an empty total

With context:
fix(cart): return zero for an empty total

Start the reduction at zero so an empty prices array returns a
numeric total instead of throwing.

Type choice: fix describes the reported bug. No issue reference or test-pass claim is added because neither was supplied.