agentleFS
wanderlimawanderlima/agent-skills/skills/git/prepare-git-commit/SKILL.md

prepare-git-commit

Skill2 starsChanged 5 months agoMITView on GitHub

Stages related git changes and writes a commit message to .git/COMMIT_EDITMSG without running git commit or push (hooks run when the user commits). Use when the user asks to prepare a commit, stage files, write a commit message, or commit changes without pushing.

  • Reads credentials
  • Commits and pushes

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 8 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Only documentation or review is needed (no staging or message)

    line 35
  2. Distinctive:

    Never: run git commit or git push

    line 59
  3. Very specific:

    Never: add Co-authored-by:, Made-with: Cursor, or any AI/editor attribution

    line 62
  4. Distinctive:

    Commit message language: en-US

    line 63
  5. Distinctive:

    Run in parallel when possible:

    line 69
  6. Distinctive:

    If files are already staged appropriately, leave as-is

    line 77
  7. Distinctive:

    Do not stage unrelated or generated files unless explicitly required

    line 80
  8. Distinctive:

    Run git add for selected paths only

    line 81
  9. Distinctive:

    If no task ID is available, keep the normal prefix without inventing one

    line 95

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

Prepare Git Commit

Overview

Stages files for one logical change and writes a commit message to .git/COMMIT_EDITMSG. The user runs git commit locally so hooks (e.g. commit-msg) execute.

When to Use

Use when

  • The user asks to prepare a commit
  • The user asks to stage files or write a commit message
  • The user asks to commit changes without pushing

Do not use when

  • The user explicitly asks to run git commit or git push
  • The user wants amend, squash, or rebase unless explicitly requested
  • Only documentation or review is needed (no staging or message)

Inputs

  • Current branch state (git status, git diff)
  • Files already staged or changed on the branch
  • Recent commit message style (git log)
  • User scope when they name specific paths or changes
  • Task/ticket ID when work is tied to a card (Trello, Jira, Linear, GitHub Issues, etc.)

Outputs

  • .git/COMMIT_EDITMSG with the formatted commit message
  • List of staged files
  • Reminder to run commit locally:
git commit
# or
git commit -F .git/COMMIT_EDITMSG

Constraints

  • Never run git commit or git push
  • Never amend, squash, or rebase unless explicitly requested
  • Never stage secrets (.env, credentials, tokens)
  • Never add Co-authored-by:, Made-with: Cursor, or any AI/editor attribution
  • Commit message language: en-US

Steps

1. Inspect

Run in parallel when possible:

  • git status
  • git diff (staged + unstaged)
  • git log -n 5 (message style)

2. Stage

  • If files are already staged appropriately, leave as-is
  • Otherwise, pick branch changes related to the same logical work (prefer recent edits)
  • Stage only files for the same logical change
  • Do not stage unrelated or generated files unless explicitly required
  • Run git add for selected paths only

3. Write commit message

  • Write to .git/COMMIT_EDITMSG
  • Format: short title line + bullet list (intent/why, not noisy implementation detail)
  • Prefix — prefer prefix from branch name (e.g. feat/, fix/, chore/); otherwise use feat:, fix:, bugfix:, chore:, refactor:
  • Task / ticket ID — when the work is tied to a card or ticket (Trello, Jira, Linear, GitHub Issues, Asana, etc.), always include the task ID in the commit title prefix:
    • Format: {type}/{ID}: {title}
    • Examples:
      • fix/PROJ-123: Handle null response from checkout API
      • feat/TRELLO-456: Add export CSV action to reports
      • chore/ABC-789: Bump eslint and align config
    • Resolve the ID from (in order): user mention → branch name (feat/PROJ-123-..., fix/456-...) → PR/issue link → card URL
    • If no task ID is available, keep the normal prefix without inventing one

4. Hand off

Report staged files, the full commit message (copy-ready), and instruct the user to run git commit locally.

Rationalization Traps

RationalizationReality
Running git commit is fasterHooks must run on the user's machine
Files are already staged, skip inspectStaging may include unrelated or secret files
Attribution lines are harmlessCo-authored-by: and editor attribution are prohibited
One big stage is fineUnrelated changes block clean review and revert

Red Flags

  • git commit or git push was executed
  • .env, credentials, or generated artifacts were staged
  • .git/COMMIT_EDITMSG was not written
  • git diff --cached was not reviewed before staging

Verification

  • git diff --cached reviewed for scope and secrets
  • Only related files are staged (git diff --cached --name-only)
  • .git/COMMIT_EDITMSG exists with title, prefix, and bullet list
  • Task/ticket ID included in the title prefix when work is linked to a tracked card
  • No prohibited attribution in the message
  • User received staged file list, full message, and local commit command

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.