agentleFS
SID-SURANGESID-SURANGE/cursor-team-ops/skills/core/commit-message/SKILL.md

commit-message

Skill0 starsChanged 4 months agoMITView on GitHub

Enforce Conventional Commits discipline — infer type (feat/fix/refactor/…) and scope from the staged diff and changed file paths, and produce a structured `type(scope): subject` message. Goes beyond basic AI commit generation by applying CC rules and scope inference. Triggered by "write a commit message", "what should I commit this as", "help me commit", "what should my commit say", "commit msg", "suggest a commit message", "how do I phrase this commit", "write a good commit", "commit-message".

34 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use error-handling, changelog and 2 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • MicrosoftSkill

    error-handling

    统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用。

    Also in 3 projects that use this

  • HashiCorpSkill

    changelog

    Add a `.changelog/<PR_NUMBER>.txt` entry for a GitHub Pull Request, commit, and push.

    Also in 4 projects that use this

  • GoogleSkill

    code-review

    Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.

    Also in 6 projects that use this

  • OpenAISkill

    brainstorming

    You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

9 rules. 0 are common, 9 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 27 edited versions we read keep these.

  • 9

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use the repo's recent log as a reference — match existing scope conventions if present.

    line 52
  2. Distinctive:

    No period at the end

    line 63
  3. Distinctive:

    Add a body when:

    line 68
  4. Distinctive:

    Do not run git commit — that is the user's decision.

    line 92
  5. Distinctive:

    If the staged diff is empty, say so and stop.

    line 98
  6. Distinctive:

    If the diff is large and spans unrelated concerns, flag it: "This diff touches X and Y — consider splitting into two commits."

    line 99
  7. Distinctive:

    Do not use git commit -m or make the commit.

    line 100
  8. Distinctive:

    Never fall back to unstaged changes when the staged diff is empty — that produces a message for content the user hasn't actually chosen to …

    line 103
  9. Distinctive:

    When the diff spans many unrelated top-level directories, don't force a single scope onto it — say the scope is ambiguous and let the user …

    line 104

“Common” is measured: kept by at least 6 in 10 of the 27 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

✏️ Skill: commit-message

Purpose

Produce a structured, Conventional Commits-compliant commit message from the staged diff — not a free-form summary. Separate from pre-commit-check (which audits the staged diff for issues; this writes the message after the audit passes).

Trigger phrases

  • "write a commit message"
  • "what should I commit this as"
  • "commit-message"
  • "generate a commit message"
  • "what's a good commit message for this"

Steps

1. Read the staged diff and recent history

git diff --cached          # staged changes — the primary input
git log --oneline -10      # recent messages — infer repo's convention and scope patterns

2. Infer the type

TypeUse when
featNew capability visible to a user or caller
fixCorrects a defect or wrong behaviour
refactorRestructures code without changing observable behaviour
docsChanges to documentation only
testAdds or fixes tests
choreBuild scripts, CI config, dependency bumps, tooling
perfMeasurable performance improvement
styleFormatting, whitespace — no logic change

Pick the single most accurate type. If the diff spans multiple types, pick the dominant one and note the others in the body.

3. Infer the scope

Derive scope from the primary directory or module affected:

Changed pathScope example
src/auth/auth
skills/core/commit-message/commit-message
hooks/git-guard.shhooks
Root-level config onlyomit scope

Use the repo's recent log as a reference — match existing scope conventions if present.

4. Write the subject line

type(scope): imperative description of what changed

Rules:

  • Imperative mood: "add", "fix", "remove" — not "added", "fixes", "removing"
  • ≤72 characters total (type + scope + colon + space + description)
  • No period at the end
  • Lowercase after the colon

5. Write the body (if needed)

Add a body when:

  • The why is not obvious from the subject
  • The diff spans multiple concerns
  • There is a breaking change

Separate subject from body with a blank line. Wrap body at 72 characters.

For breaking changes, append:

BREAKING CHANGE: <what changed and how callers must adapt>

6. Output

Present the commit message in a code block, ready to copy:

type(scope): subject

Optional body explaining the why, not the what.

Then ask: "Ready to commit with this message, or would you like to adjust it?"

Do not run git commit — that is the user's decision.

Output

A single commit message block. No explanation unless the type choice is non-obvious.

Notes

  • If the staged diff is empty, say so and stop.
  • If the diff is large and spans unrelated concerns, flag it: "This diff touches X and Y — consider splitting into two commits."
  • Do not use git commit -m or make the commit. Write the message only.

Gotchas

  • Never fall back to unstaged changes when the staged diff is empty — that produces a message for content the user hasn't actually chosen to commit.
  • When the diff spans many unrelated top-level directories, don't force a single scope onto it — say the scope is ambiguous and let the user pick, or recommend splitting the commit.
  • git log --oneline -10 on a very young repo (first few commits) may not have enough history to reliably infer a scope/type convention — say so rather than pattern-matching on 1–2 examples.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.