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
In this repository3 other files it gives its agents.
- local-md-mermaid-pdfSkill
- list-session-filesSkill
- session-handoffSkill
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
- Distinctive: line 35
Only documentation or review is needed (no staging or message)
- Distinctive: line 59
Never: run git commit or git push
- Very specific: line 62
Never: add Co-authored-by:, Made-with: Cursor, or any AI/editor attribution
- Distinctive: line 63
Commit message language: en-US
- Distinctive: line 69
Run in parallel when possible:
- Distinctive: line 77
If files are already staged appropriately, leave as-is
- Distinctive: line 80
Do not stage unrelated or generated files unless explicitly required
- Distinctive: line 81
Run git add for selected paths only
- Distinctive: line 95
If no task ID is available, keep the normal prefix without inventing one
≈ “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.
Files
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 commitorgit 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_EDITMSGwith the formatted commit message- List of staged files
- Reminder to run commit locally:
git commit
# or
git commit -F .git/COMMIT_EDITMSGConstraints
- Never run
git commitorgit 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 statusgit 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 addfor 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 usefeat:,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 APIfeat/TRELLO-456: Add export CSV action to reportschore/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
- Format:
4. Hand off
Report staged files, the full commit message (copy-ready), and instruct the user to run git commit locally.
Rationalization Traps
| Rationalization | Reality |
Running git commit is faster | Hooks must run on the user's machine |
| Files are already staged, skip inspect | Staging may include unrelated or secret files |
| Attribution lines are harmless | Co-authored-by: and editor attribution are prohibited |
| One big stage is fine | Unrelated changes block clean review and revert |
Red Flags
git commitorgit pushwas executed.env, credentials, or generated artifacts were staged.git/COMMIT_EDITMSGwas not writtengit diff --cachedwas not reviewed before staging
Verification
git diff --cachedreviewed for scope and secrets- Only related files are staged (
git diff --cached --name-only) .git/COMMIT_EDITMSGexists 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
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
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.

