---
name: write-commit-message-prompt
description: A prompt that turns your staged changes or a short description of them into a clear Conventional Commits message with a type, scope, imperative subject, a why-focused body and breaking-change footer. Use when the user wants a commit message written, asks how to describe their changes, or follows conventional commits.
license: CC0-1.0
metadata:
  category: coding-prompts
  tags: "git,pull-request,quality"
  author: johnny-bravo
  version: "1.0"
  updated: "2026-10-31"
  status: published
  source_url: "https://github.com/f/prompts.chat/blob/2fe67135becdc605c6dcb2bacb7ce49bdb27c362/prompts.csv"
  source_license: CC0-1.0
  copyright: "Public domain (CC0 1.0) - prompt contributed to prompts.chat by jeff-nasseri"
  original_author: "jeff-nasseri (prompts.chat, 'Conventional Commit Message Generator')"
  modified: "Adapted by TheSkillVault: restructured as numbered rules, added a secrets check, steps and done-when sections."
  imported_on: "2026-10-31"
---

# Write a commit message (prompt)

## When to use
- You finished a change and need a clear commit message.
- Your project uses Conventional Commits (feat:, fix:, chore: and so on).
- You want commit history that explains why, not just what.

## Steps
1. Stage your change, then run `git diff --staged` and copy the output (or describe the change in a sentence).
2. Paste it into the prompt below in place of {{DIFF OR DESCRIPTION}}.
3. Check the type and scope, then commit with `git commit -F message.txt` or paste it into your editor.

## Prompt
```text
Write a commit message following the Conventional Commits specification for the changes below.

1. Format: <type>[optional scope][!]: <description>, then a blank line, an optional body and optional footers.
2. Types: feat, fix, docs, style, refactor, test, chore, ci, perf, build, revert.
3. Add a scope in parentheses when it helps, e.g. feat(api):.
4. Description: imperative mood ("add", not "added"), lowercase, no period, about 50 characters.
5. Body: explain what changed and why, not how. Wrap near 72 characters.
6. Breaking change: add ! after the type or scope and a "BREAKING CHANGE:" footer.
7. Footers like "Refs: #123" only if I gave you an issue number.
8. If the changes do several unrelated things, say so and suggest how to split them.

Output only the commit message, with no code fences or explanation.

CHANGES:
{{DIFF OR DESCRIPTION}}
```

## How to adapt
- Team uses a different style? Replace rules 1-4 with an example of a good commit from your repo.
- For a pull request title, ask for "the subject line only".

## Gotchas
- Check the diff for secrets (API keys, tokens, `.env` values) before pasting it into any AI tool, and before committing.
- Works with any git host (GitHub, GitLab, Bitbucket) and any chat AI. No tool lock-in.

## Done when
- The subject follows type(scope): description in under about 50 characters.
- The body says why the change was made.

## Example prompt
"Write a commit message for this diff."

---
Based on the "Conventional Commit Message Generator" prompt by jeff-nasseri on prompts.chat (CC0 1.0, public domain).
