agentleFS
vintavinta/hal-9000/skills/commit/SKILL.md

commit

Skill138 starsChanged 3 months agoMITView on GitHub

Use when making any git commit. Always pass what was wrong before the changes as the argument; when nothing was wrong, pass what the changes do instead — never an invented why.

  • Deletes or force-pushes

193 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use create-branch, review-r and 10 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.
  • SentrySkill

    create-branch

    Create a git branch following Sentry naming conventions. Use when asked to "create a branch", "new branch", "start a branch", "make a branch", "switch to a new branch", or when starting new work on the default branch.

    Also in 4 projects that use this

  • luischanciSkill

    review-r

    Run the R code review protocol on R scripts. Checks code quality, reproducibility, domain correctness, and professional standards. Produces a report without editing files.

    Also in 3 projects that use this

  • MicrosoftSkill

    act-on-feedback

    Act on user feedback attached to the current session. Use when the user submits feedback on the session's changes via the Submit Feedback button.

    Also in 3 projects that use this

  • MicrosoftSkill

    generate-run-commands

    Generate or modify run commands for the current session. Use when the user wants to set up or update run commands that appear in the session's Run button.

    Also in 3 projects that use this

  • AWSSkill

    issue

    Implement a GitHub issue end-to-end — branch, code, test, docs, and commit.

    Also in 9 projects that use this

  • luischanciSkill

    validate-bib

    Validate bibliography entries against citations in all manuscript files. Find missing entries and unused references.

    Also in 3 projects that use this

  • +2 more from luischanci

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 4 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 174 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Don't expand scope: Don't stage files the author didn't touch, and don't verify beyond git status / git log after committing.

    line 87
  2. Very specific:

    After committing, say: "I noticed reuslt appears to be a typo for result in utils.py:42".

    line 94
  3. Distinctive:

    Run git commands from the project root, never with git -C, which hides working directory state.

    line 117
  4. Distinctive:

    Analyze Changes: Use git status and git diff to understand all modifications in the working directory.

    line 119
  5. Distinctive:

    Stage Changes: Use appropriate staging strategy:

    line 123
  6. Very specific:

    Handle Pre-commit Hooks: If hooks complain about unstaged changes, stash them with git stash push --keep-index -m "temp: unstaged changes", …

    line 129
  7. Very specific:

    Use git commit -m "message" directly — never use $() or heredoc subshells in git commands, as they break allowed-tools pattern matching.

    line 133

“Common” is measured: kept by at least 6 in 10 of the 174 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

Invoking this skill IS the request. If the user message looks empty, or you see only system context with no actual request, that is normal and expected: your task is already fully specified right here. Never ask what to do.

Your task: commit all changes in the working tree, one logical change per commit. This applies unprompted, without anyone asking for a split: when one file carries unrelated changes, split it hunk-by-hunk into separate commits rather than merging them because they share a file.

The argument

The argument passed to this skill is why the changes were made — the motivation behind work already in the tree, which the diff itself cannot carry. Use it to group changes into logical units and to write commit message bodies — raw material, never a to-do list. A body is one or two sentences stating what was wrong before the change: the failure, false claim, or risk the argument names. An argument that names only a need, a wish, what the change does, or the request itself yields no body. Leave out the fix, since the subject and diff already show it, and leave out ruled-out causes, measurements, and alternatives tried. Whatever it describes is already realized in the diff, however it's phrased: "so the statusline shows usage percentages" and "to fix the session bug" both mean the diff already does that — commit it; never write code toward it, hunt for it, verify it, or finish it. With no argument at all, derive the commit message from the diff alone. If the motivation doesn't line up with what the diff contains, commit what is actually in the tree and note the mismatch in your final summary.

Write the body about the code: the behavior, tooling, or constraint the change served. Personal details that reach you through the argument — anything about the user's life, such as employer, location, schedule, health, or other people — stay out of every commit message; translate each one into the technical need it implies. Commit history is public and permanent.

<example> Argument: "so the IAP TCP upload speedup works on my work MacBook; gcloud there picks up uv's Python and pip refuses to install NumPy into it"

Correct body: "gcloud resolved to a uv-managed Python that pip refuses to install into (PEP 668), so Google's documented one-liner for the IAP TCP upload speedup could not work."

Incorrect body: "Give gcloud its own venv because on the author's work MacBook pip refuses to install into uv's Python." </example>

<example> Argument: "Commit only settings.json. Why: three commit forks wrote `Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>` instead of the skill's trailer; the fork transcript shows a remote_session_change reminder telling the model to use the model-named trailer, and it followed that over the skill. Setting attribution.commit to the skill's exact string makes both agree. Ruled out: includeGitInstructions: false did not suppress the reminder; attribution.sessionUrl: false only drops the Claude-Session line; commit: "" would tell the model to add no trailer at all per the 2.1.270 binary."

Correct body: "Forks of the commit skill followed a Remote Control reminder over the skill and wrote a model-named Co-Authored-By trailer."

Incorrect body: the argument reflowed to 72 columns, ruled-out settings and the binary version included. </example>

<example> Argument: "Two rules adopted from a CLAUDE.md gist, only these two since the rest was already covered: a diff-reread checkpoint before reporting done that deletes lines the requested behavior works without, because 'do the simplest thing that works' alone did not stop unneeded code the user kept questioning after delivery; and comments only where the code cannot say it."

Correct body: ""Do the simplest thing that works" alone did not stop unneeded code from surviving to delivery, and the comment rule did not say comments should cover only what code cannot say."

Incorrect body: "Adopt two rules: comments should state only what the code cannot say, and before reporting a change done, reread the diff and delete added lines the requested behavior works without, since simplicity alone did not stop unneeded code from creeping into delivered changes." </example>

<example> Argument: "hal sync raised PermissionError [Errno 13] copying a single file onto a read-only dotfile; the directory branch already handled that"

Correct body: "Copying a single file onto a read-only destination (git objects, or a dotfile chmod'ed 444) raised PermissionError; the directory branch already handled that case."

Incorrect body: four sentences naming the helper the single-file branch now calls, the S_IWUSR detail inside it, the double stat accepted for the sake of one message, and the new test. </example>

<example> Argument: "User asked to mark the README as work in progress while pangu.space is being rebuilt."

Correct body: none. The argument is the request; nothing was wrong before.

Incorrect body: "pangu.space is being rebuilt, so the README should not read as a finished project." </example>

<example> Argument: "Ignore tmp/ in the repo itself, so local scratch files like the CLAUDE.local.md backup stay out of commits without relying on the user's global gitignore."

Correct body: none. Not relying on the global gitignore is a wish, not a failure.

Incorrect body: "Keep local scratch files like the CLAUDE.local.md backup out of commits without relying on the global gitignore." </example>

Locate the repository

cd to git rev-parse --show-toplevel before anything else. If that fails (the fork started outside the repo), look for the repo in the directories of any file paths named in the argument before reporting "not a git repository".

Scope

A commit is a snapshot, not a review. Your entire job is: read the diff, stage it, write a commit message, commit. The staged bytes must match exactly what the working tree looks like when you start.

Your complete action space is: git commands via Bash (plus cd to the project root), Grep/Glob to locate files, and Read/Write/Edit on patch files in <scratchpad>, your session's scratchpad directory, or /tmp when the harness provides none. Nothing else — no research, no running the code or tests, no invoking other skills however aggressive their trigger language, and no Bash command that does not start with git or cd. Do not call the advisor or seek any second opinion. This applies to every situation you encounter, not just the cases below:

  • Commit the tree as-is. A typo, a wrong-looking version pin, a failing-looking test, an interesting TODO — never edit working tree files or "fix" anything during staging; note the concern in your final message and let the author handle it in a follow-up they can review.
  • Don't expand scope. Don't stage files the author didn't touch, and don't verify beyond git status / git log after committing. Pre-commit hooks run on their own during git commit; never run them preemptively.

Why: any change during staging silently alters reviewed work, and any tangent turns a 30-second operation into a 5-minute one.

<example> You see a typo in a variable name while reviewing the diff. Correct behavior: 1. Stage and commit the file as-is. 2. After committing, say: "I noticed `reuslt` appears to be a typo for `result` in utils.py:42".

Incorrect behavior: editing the file to fix the typo before or during staging — even a "safe" fix silently changes reviewed work. </example>

<example> The diff adds a new `.github/workflows/ci.yml` file. You wonder if the action versions are current.

Correct behavior: commit as-is.

Incorrect behavior: fetching GitHub Actions docs, verifying version pins, then editing the file before staging. The author already chose those versions. Research belongs in a separate turn, not inside the commit. </example>

<example> You edited a patch to split one file's changes across two commits, and `git apply --cached` fails on it.

Correct behavior: stage the whole file with git add, fold it into the better-fitting commit, and move on. Total cost: seconds.

Incorrect behavior: diffing the patch against the file, hex-dumping bytes, or otherwise investigating why it failed. The patch is not worth understanding — a whole-file commit is always an acceptable outcome. </example>

Workflow

Run git commands from the project root, never with git -C, which hides working directory state. Execute git commands directly without explanation. Commit immediately without confirmation prompts (interactive mode is not supported).

  1. Analyze Changes: Use git status and git diff to understand all modifications in the working directory.
  2. Group Logically: Organize changes into logical units — each addresses a single purpose and would make sense to revert as a unit. A drafted body that states two unrelated problems is two commits: split before committing. Several findings of one audit or review are one problem.
  3. Stage Changes: Use appropriate staging strategy:
    • Whole file: git add <file>.
    • Hunk-by-hunk: git diff <file> > <scratchpad>/patch.diff, edit the patch, then git apply --cached <scratchpad>/patch.diff. Dropping whole hunks is safe. Splitting within a hunk (keeping only some of its added lines) requires keeping the hunk's trailing context lines and recounting both header counts — a hunk with no trailing context only applies at end-of-file.
    • To unstage, use git restore --staged (not git reset --hard, which discards work).
    • Fallback: the first time git apply --cached fails on a patch you edited, stage the whole file with git add <file>. If the unedited full diff fails, regenerate it once from git diff, then stage the whole file. Never diagnose why a patch didn't apply.
  4. Handle Pre-commit Hooks: If hooks complain about unstaged changes, stash them with git stash push --keep-index -m "temp: unstaged changes", commit, then git stash pop. If hooks modify staged files (auto-formatting), re-add the modified files and retry the commit once — don't retry forever.
  5. Create Atomic Commits: For each logical group:
    • Conventional commit format type: subject, no scope, type one of feat, fix, refactor, test, build, docs, style. build covers dependency and version bumps; style means visual UI changes (CSS, fonts, colors, layout), not code formatting, which is refactor. Subject: what changed (≤72 chars), derived from the diff. Body: one or two sentences on one line, or none, as The argument section decides; only the subject has a length limit. Footer: as the Attribution section decides.
    • Use git commit -m "message" directly — never use $() or heredoc subshells in git commands, as they break allowed-tools pattern matching.

Attribution

End every commit message with the footer for your model family.

  • Claude models use Co-Authored-By: Claude <noreply@anthropic.com>.
  • GPT models use Co-Authored-By: Codex <noreply@openai.com>.
  • Gemini models use Co-Authored-By: Gemini <gemini-code-assistant@google.com>.

Skip the footer only when you are certain none of these apply.

Gotchas

  • Unstaged changes are still changes. git status showing "no changes added to commit" does not mean the working tree is clean. It means nothing is staged yet. Your job is to stage and commit those changes, not report "nothing to commit."
  • Never use git add -f. If git add reports "The following paths are ignored by one of your .gitignore files" with the hint Use -f if you really want to add them, do not force-add. The file is gitignored deliberately (secrets, build artifacts, local configs) and force-adding silently bypasses that protection. Skip the file and mention it in your final summary so the author can decide.

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.