agentsclimarketplace

Pavlo commit rewriter

Skill pavloglushko/ai-skills/skills/pavlo-commit-rewriter

Automates Phases 1–3 of the commit rewriting workflow: preparation, analysis & message drafting, and rewriting via git filter-branch. Use when you need to rewrite commit messages on the current branch to improve clarity, follow conventions, and align with a plan.From its SKILL.md

Install
npx -y skills add pavloglushko/ai-skills --skill pavlo-commit-rewriter

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

5.4 KB, as published. Nobody here has run it

Skill: Commit Rewriter

Rewrite commit messages in three phases: prepare, draft, apply. Follows .github/git-commit-instructions.md.

Scripts

Reusable scripts live in scripts/ relative to this SKILL.md:

ScriptPurpose
scripts/build_rebase_todo.pyParses commit_rewrite_mapping.md + git log, writes /tmp/rebase_todo.txt and /tmp/commit_msg_mapping.json.
scripts/msg_filter.pyReads /tmp/commit_msg_mapping.json; used as git filter-branch --msg-filter.
scripts/verify.shChecks commit count and diffs against BACKUP branch.

Process Overview

Phase 1 — Preparation

  1. Verify <branch>-BACKUP exists; refuse to proceed if missing.
  2. Detect branch point (merge-base or user-provided).
  3. List commits; locate plan file (e.g., plan-*.md) or ask.
  4. Report findings, wait for confirmation → Phase 2 — Analysis & Message Drafting.

Phase 2 — Analysis & Message Drafting

  1. Analyze git --no-pager diff --stat per commit.

  2. Read the plan as context — diff stats take priority. Describe what actually changed, not what the plan intended.

  3. Map commits to plan steps (by file overlap and intent):

    • At most one actual commit per plan step; unmapped is fine.
    • Mapped → title starts with Step X:. Unmapped → plain title.
  4. Generate new messages per .github/git-commit-instructions.md.

  5. Write commit_rewrite_mapping.md in the project root:

    #Old messageNew messagePlan stepComments
    1feat: add XStep 1: Add X to YStep 1—
    2fix typoFix typo in Z—merge with #1
    3wip——delete — empty commit

    Comments column: suggest merge/squash/delete where appropriate.

  6. Report table, wait for confirmation → Phase 3 — Rewrite & Verify. User may edit the file before confirming; Phase 3 re-reads it and treats every change as authoritative (renamed titles, accepted/rejected merges, reassigned mappings).

Phase 3 — Rewrite & Verify

All commands below use SCRIPTS=.github/skills/pavlo-commit-rewriter/scripts.

  1. Stash uncommitted changes (rebase and filter-branch require a clean tree):

    git stash
    
  2. Generate rebase todo and message mapping:

    python3 -u $SCRIPTS/build_rebase_todo.py \
        --mapping commit_rewrite_mapping.md \
        --branch-point <hash>
    

    This writes /tmp/rebase_todo.txt and /tmp/commit_msg_mapping.json. Review the printed summary (pick/fixup/drop counts).

  3. Rebase (only if fixup or drop rows exist):

    GIT_SEQUENCE_EDITOR="cp /tmp/rebase_todo.txt" \
        git rebase -i <branch-point>
    

    Commit count decreases after rebase; the build script prints the expected count.

  4. Rewrite messages:

    cp $SCRIPTS/msg_filter.py /tmp/msg_filter.py
    FILTER_BRANCH_SQUELCH_WARNING=1 \
        git filter-branch -f --msg-filter \
        'python3 /tmp/msg_filter.py /tmp/commit_msg_mapping.json' \
        <branch-point>..HEAD
    
  5. Verify:

    bash $SCRIPTS/verify.sh <branch-point> <branch> <expected-count>
    
    • Checks commit count matches expected.
    • Lists all rewritten messages.
    • Diffs against BACKUP; warns if non-empty.
  6. Restore stashed changes:

    git stash pop
    

Rules

  • No git pager. Every git command must use git --no-pager. Bare git log / git diff blocks the agent.
  • Match by subject line, not hash (hashes change after rewrite/rebase).
  • Commit count changes after rebase. Verify the new count (printed by build_rebase_todo.py) before running filter-branch.
  • Named phases. Always name the next phase when asking for confirmation.
  • User edits are authoritative. Phase 3 honours all changes the user made to commit_rewrite_mapping.md.
  • Stash before rewrite. Phase 3 operations require a clean working tree. Stash before starting, pop after verification.

Related

  • .github/git-commit-instructions.md — commit message conventions.
  • pavlo-commit-by-commit-execution — execution skill using Step X: naming.

Keep looking

Skills are one crate of 607,533. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.