agentleFS
ame589ame589/Claude_skill/skills/commit-surgeon/SKILL.md

commit-surgeon

Skill0 starsChanged 4 months agoMITView on GitHub

Split a messy working tree with several unrelated changes into a clean, reviewable sequence of atomic commits, each with an inferred Conventional Commit message. Use this when the user has a pile of uncommitted work spanning multiple concerns and wants it committed sensibly, asks to "split / organize / clean up my changes / commits", wants "atomic commits" or "one commit per concern", or is preparing a tidy PR history. Triggers on: "split my changes", "atomic commits", "organize commits", "my working tree is a mess", "commit this properly", "conventional commits", "separate these changes".

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. eeshsaxena/agent-skills★ 2same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository4 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    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. Very specific:

    Commit order is chosen for reviewability: build → refactor → feat → fix → perf → test → docs → ci → style → chore, so structural changes …

    line 83

≈ “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

Commit Surgeon

What this does

Big, mixed commits are where code review goes to die — a reviewer can't approve a bug fix without also vetting the unrelated refactor and doc tweak riding along. This skill reads your working tree, groups the changes by concern, proposes an ordered set of atomic commits with sensible Conventional-Commit messages, and hands you a script to apply them. Clean history, faster review, easier reverts — without you hand-staging file by file.

When to use it

  • The user has accumulated unrelated changes and wants them committed cleanly.
  • The user asks to split / organize / tidy commits, or wants "atomic commits".
  • You're about to open a PR and the history is one undifferentiated blob.

Workflow

1. Plan the split

python3 skills/commit-surgeon/scripts/plan_commits.py --md commit-plan.md --sh commit.sh

This inspects tracked and untracked changes, clusters files by concern (src / test / docs / config / ci / style) and by module, infers a commit type (feat, fix, refactor, perf, docs, test, build, ci, style, chore) from file type and change keywords, and writes:

  • commit-plan.md — the proposed commits, in review order, and
  • commit.sh — a runnable staging+commit script.

It is read-only; nothing is committed until you act.

2. Review the plan with the user — this is the important step

Present the proposed commits. The type/scope/message are inferred heuristics; correct them where the intent is wrong (only you and the user know that the "refactor" was actually the bug fix). Pay special attention to any ⚠️ mixed-concern files: a single file carrying both a feature and a fix should be split with git add -p so each hunk lands in the right commit — do that manually rather than through the file-level script.

3. Apply

Either run the generated script:

bash commit.sh

…or, when files are mixed, stage hunk-by-hunk yourself (git add -p) following the plan's grouping, committing each concern with its message. Refine any message before committing — never ship an inferred subject you haven't read.

4. Verify the history

git log --oneline --stat

Confirm each commit is self-contained (builds/tests would pass at that commit if practical) and that no unrelated change leaked across a boundary. Reorder or git commit --amend/git rebase -i if needed.

Conventions

  • Messages follow Conventional Commits (type(scope): subject). Scope is the module directory; it's omitted for root-level changes.
  • Commit order is chosen for reviewability: build → refactor → feat → fix → perf → test → docs → ci → style → chore, so structural changes land before the features that use them.
  • A feature and its tests in the same module are grouped into one commit by design — an atomic commit includes its own tests.

Notes & limits

  • Grouping is at file granularity, which is safe and reversible. True hunk-level splitting (two concerns in one file) is flagged, not automated — use git add -p there.
  • Inference is keyword/heuristic based; it cannot read intent. Always review types and messages before committing.
  • The generated script runs git reset first to unstage everything, then stages each group cleanly. Read it before running.

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.