write-commit-message

Generates a git commit message from a diff matching the repository's commit style.

Updated Mar 29, 2024
One-click install
npx skills add https://github.com/petobens/ai-harness --skill write-commit-message-petobens
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: write-commit-message
Source: https://github.com/petobens/ai-harness/tree/main/skills/write-commit-message
Command: npx skills add https://github.com/petobens/ai-harness --skill write-commit-message-petobens

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing clear, consistent commit messages is tedious and often inconsistent across a team. This Skill analyzes your staged changes or a specified diff and produces a well-formed commit message that matches the repository's existing conventions. ## Core Features & Use Cases - Style Detection: Reads the last 50 commit subjects and mimics the repository's existing style, defaulting to Conventional Commits when unclear. - Flexible Scope: Works with staged changes, a diff against a base branch, or a specific commit SHA. - Formatting Rules: Enforces imperative-mood summaries under 72 characters, proper body wrapping, and correct Conventional Commits types. - Use Case: After staging a bug fix, ask for a commit message and receive a ready-to-use fix(ui): ... message with an explanatory body, output in a single fenced code block without running git commit. ## Quick Start Generate a commit message for my currently staged changes in this repository.

Frequently Asked Questions about write-commit-message

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate a commit message from staged changes?

Stage your changes with git add, then ask for a commit message. The skill runs git diff --staged, reviews the last 50 commit subjects for style, and outputs a message in a fenced text block without running git commit.

How to write a Conventional Commits message automatically?

The skill defaults to Conventional Commits format (type(scope): summary) when the repository history is unclear or already follows that style. It selects the correct type such as feat, fix, chore, or refactor based on the diff content.

Can I generate a commit message for a specific commit or branch diff?

Yes. Provide a base branch to diff against with BASE...HEAD, or a commit SHA to describe with SHA^!. The skill resolves the requested scope and generates the message from that diff instead of staged changes.

Does the commit message generator run git commit automatically?

No. The skill only outputs the commit message in a single fenced text code block. It never runs git commit, so you review and apply the message yourself.

What happens if there are no changes to describe?

If the resolved diff is empty, the skill reports that there is nothing to describe and stops. No commit message is generated and the output formatting rules do not apply.