goncalossilva

git-clean-history

4
1
# Install this skill:
npx skills add goncalossilva/.agents --skill "git-clean-history"

Install specific skill from multi-skill repository

# Description

Reimplement the current Git branch on a fresh branch off `main` with a clean, narrative-quality commit history.

# SKILL.md


name: git-clean-history
description: "Reimplement the current Git branch on a fresh branch off main with a clean, narrative-quality commit history."


Git Rebase

Use this skill to reimplement the current branch on a new branch with a clean, narrative-quality git commit history suitable for reviewer comprehension.

Steps

  1. Validate the source branch
  2. Ensure no uncommitted changes or merge conflicts
  3. Confirm it is up to date with main

  4. Analyze the diff

  5. Study all changes between source branch and main
  6. Form a clear understanding of the final intended state

  7. Create the clean branch

  8. Create a new branch off of main using the new branch name
  9. Use the {source_branch}-clean name unless another name is provided by the user

  10. Plan the commit storyline

  11. Break the implementation into self-contained logical steps
  12. Each step should reflect a stage of development, as if writing a tutorial

  13. Reimplement the work

  14. Recreate changes in the clean branch, committing step by step
  15. Each commit must:
    • Introduce a single coherent idea
    • Include a clear commit message and description
    • Follow best practices for the message as outlined by the git-commit skill
  16. Use git commit --no-verify for all intermediate commits

    • Pre-commit hooks check tests, types, and imports that may not pass until the full implementation is complete; do not waste time fixing issues in intermediate commits that will be resolved by later commits
  17. Verify correctness

  18. Confirm the final state exactly matches the source branch
  19. Run the final commit without --no-verify to ensure all checks pass

Rules

  • Do not add yourself as an author or contributor
  • Do not include "Generated with ...", "Co-Authored-By: ...", or any AI attribution
  • The end state of the clean branch must be identical to the source branch

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.