Back to Blog

data-analysis

Clean Your Branch's Diff in One Pass

Introducing the 'clean' agent skill for tidying diffs without behavior changes—one pass, a ledger, and nothing else.

OpenAgentSkillPublished:

Where this fits

You've been coding for hours, and before you open a PR you want to tidy the diff—rename that confusing variable, delete the dead function, split the duplicated block. But you're tired, and the diff is long. You ask your agent to "clean this diff" and it does exactly one pass, no behavior changes, and hands you a ledger of what it changed. That's the workflow this skill enables.

Why agents benefit

  • Pins the diff's fixed point: Resolves the merge-base with the default branch (or an optional ref) so the agent knows precisely which lines are in scope.
  • Enforces a strict one-pass rule: No second sweep, no scope creep—just a single cleanup cycle, then stop.
  • Separates edits from notes: Anything noticed outside the diff becomes a follow-up line, never an edit, so unrelated code stays untouched.
  • Guarantees behavior preservation: Tests and runtime behavior remain exactly as they were, so you can trust the cleanup without re-reviewing logic.
  • Ends with a ledger, not a verdict: The agent records what it changed instead of grading or emitting findings for a human to action inside the diff.

Practical scenarios

Pre-PR cleanup

After finishing a feature branch, run /clean to remove dead code, rename poorly named identifiers, and collapse duplication before requesting review. The ledger tells you exactly what changed, so you can quickly verify nothing broke.

Refactor hardening

After a large refactor, use /clean to apply the project charter's deep-module rules (e.g., no circular dependencies, proper layering) across the diff. The skill enforces those rules without altering behavior, making the refactor safer to merge.

Review follow-up

When a reviewer says "this branch needs a cleanup pass," invoke /clean to address naming and duplication systematically. The agent resolves the fixed point, performs one pass, and outputs a summary you can paste into the PR thread.

Add it to your agent workflow

Install the skill with:

npx skills add ConnorGriffin/skills --skill clean

Then in your agent's instructions, add: "When the user says '/clean' or 'clean this diff', run the clean skill. Resolve the fixed point, perform exactly one pass, and output the ledger."

Compare before adopting

Before integrating, compare how this skill handles fixed-point resolution against your current review process. Look at whether it truly stops after one pass, how it communicates changes, and whether the optional ref argument supports your branching model. Also compare with linters or other cleanup skills—does it go deeper than formatting and actually address naming and duplication?

Why it is worth tracking

With 20 stars and a focused, opinionated scope, this skill addresses a real pain point: the final cleanup pass before review. It's part of a growing skills repository, and its fixed-point logic is shared with a companion code-review skill, suggesting design consistency. Watch for updates that add more charter rules or refine diff resolution. Evaluate it when you want your agent to actively tidy code, not just review it. For more skills like this, see the OpenAgentSkill directory: https://www.openagentskill.com/skills/connorgriffin-clean

Featured Skill

clean

Skill by ConnorGriffin