finalize-change-footprint
Skill2 starsChanged 20 days agoMITView on GitHub
Review the branch diff for duplicated tests, leftovers, dead code, and unnecessary churn. Use when a workflow, worker brief, or user requests a footprint sweep at the end of a piece of work or review cycle before a PR. Present verified removal candidates for approval; do not start a sweep for unrelated edits.
In this repository6 other files it gives its agents.
- architectSkill
- coordinateSkill
- defend-prSkill
- finalize-code-commentsSkill
- finalize-sweepSkill
- review-prsSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 53
Read every changed file's diff, every untracked file from step 1 in full (they have no diff), and every touched test file in full.
≈ “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.
Files
Finalize Change Footprint
A PR drifts while it is being reviewed. Each round adds a fix on top of the last one: a test for the new edge case beside an older test that already covered it, a guard for an input nothing sends, an import left behind by a revert, a description that still talks about the previous layout. Every change made sense in its round. Together they make the diff larger than the change needs, and a larger diff is harder to review and riskier to merge.
This skill reads the complete PR diff as a whole, as if it were written in one go, and finds what the final change does not need.
Comments are out of scope here; /finalize-code-comments covers them.
Input
$ARGUMENTS (optional): a base ref to diff against (default: merge-base with origin/<base>, where <base> is the current PR's base from gh pr view --json baseRefName; the repo default branch only when no PR exists), followed by file paths to limit the sweep to. If both are given, the ref comes first: /finalize-change-footprint <ref> <path> [<path>…]. A token that git rev-parse --verify --quiet <token>^{commit} resolves is the base ref; anything else (or anything that exists on disk) is a path. At most one ref is accepted.
The test
For each added or changed piece, ask:
Would this be in the PR if the final change had been written in one sitting? If it exists only because of the order the work happened in — a fix superseded by a later fix, a test written before a broader one, a branch that was reverted — it fails.
What to look for
- Duplicated or overlapping tests. Two tests asserting the same contract, often one written early and a broader one added in a later round. Keep the one that asserts more and name it as the cover for the one you remove. Read whole test files, not only the diff: an added test can duplicate one that was already there.
- ❌
it "shows the empty state when there are no results"beside a laterit "shows the empty state and hides the pagination when there are no results": the later one asserts everything the first does.
- ❌
- Leftovers from reverted or reworked approaches. Imports, helpers, variables, styles, fixtures, or test setup that only the abandoned version used. Read the branch's commit list (
git log --oneline <base>..HEAD) for reverts, fix-on-fix commits, and review-response commits, and check what each left behind.- ❌ an import or fixture that only a reverted commit used.
- Machinery for cases nothing exercises. Observers, listeners, guards, options, or fallbacks added during review for an input no current caller sends. Name the callers you checked. When none produces the case, recommend removing it and adding it when a caller needs it. This applies to internal code only: an input on a public surface (an API parameter, a CLI flag, a config key) or one the linked issue asks for stays, even with no caller in the repo.
- ❌ an observer keeping a derived value in sync with content that every caller renders once and replaces wholesale to change.
- Code the branch made dead, or found dead in the lines it touches. Rules no element can match, classes no template uses, variables nothing reads, files nothing imports. Verify with a search (the class, the import path, the variable) before calling anything dead.
- ❌ a style rule for an element's empty state when the template removes the element whenever it would be empty.
- Churn that changes nothing. Reformatting, reordering, or renames in lines the change does not otherwise need. Revert them to shrink the diff. A rename that makes code the change touches clearer is not churn.
- ❌ re-wrapping a literal in a function the change otherwise leaves alone.
- Repetition the branch introduced. The same literal, fallback, or expression added several times where one variable or helper would do. Recommend it only when it reads better, not just to reduce a count.
- ❌ the same fallback value written into several rules where one variable would carry it.
- Misplaced additions. Code inserted between a comment and the line it describes, a test in the wrong group, a doc entry in the wrong section.
- Stale descriptions. Docs, fixtures, and examples that describe a state a later commit reverted or changed. Report a stale PR description as well; editing it is outward-facing, so it waits for approval like everything else.
What to keep
- Anything that changes behaviour. This skill shrinks the diff; it does not redesign. A real fix stays even when it arrived late.
- Tests that pin distinct contracts. Overlapping setup is not duplication; two tests are duplicates only when they share setup and inputs and one's assertions are a subset of the other's.
- Cheap, standard defensive code. Say why it stays.
- Code outside the diff. Pre-existing problems go in the report as follow-up candidates, not into the PR.
Process
- Determine the scope with the base from Input:
git diff $(git merge-base HEAD <base>) -- <paths>(committed, staged, and unstaged),git ls-files --others --exclude-standard -- <paths>, andgit log --oneline <base>..HEAD. The scope is the complete PR diff, not the last commit. - Read every changed file's diff, every untracked file from step 1 in full (they have no diff), and every touched test file in full.
- For each candidate, verify before proposing: search for usages, name the test that covers a duplicate, name the callers checked for an unexercised case.
Present the findings as a table and wait for approval before changing anything:
FINDING FILE CATEGORY RECOMMENDATION ------------------------------------------- -------------------------- ------------ -------------- Repeats the broader empty-state example orders_spec.rb duplicate Remove Import only the reverted listener used widget.js leftover Remove Comment split from its example widget.spec.js misplaced Move Fallback on the text column widget.css defensive KeepA Keep row is a claim and needs the same evidence as a removal: verified at
file:line, a test or a run. "Required" without one of these is not evidence.- Apply only the approved changes, then run the linters and tests for the touched surfaces. When removing a duplicate test, break the behaviour it pinned, confirm the covering test fails, then restore it.
- Report what was removed, moved, or kept, and why. Do not commit or push unless asked.
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
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.

