reviewable-branch-diffs
Skill0 starsChanged 6 months agoMITView on GitHub
Apply coding standards, style guidance, linting, formatting, or refactoring instructions to changes on a Git feature branch without adding unrelated cleanup. Use when a user, another skill, AGENTS.md, project policy, or a tool asks an agent to improve code quality while implementing or reviewing branch changes. Determine eligibility from the Git diff against the intended integration branch, not from all violations found in touched files; preserve a focused, easy-to-review branch diff.
In this repository13 other files it gives its agents.
- change-consistencySkill
- engineer-agentic-aiSkill
- format-markdownSkill
- information-representation-designSkill
- living-artifactsSkill
- messaging-frameworkSkill
- python-testingSkill
- relevance-first-information-designSkill
- review-ready-codeSkill
- securitySkill
- software-designSkill
- swe-methodSkill
- thoughts-to-artifactSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
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 18
If the user or repository workflow explicitly identifies the integration branch, use it.
- Distinctive: line 21
Use the resulting remote-tracking branch as the *candidate* integration branch.
- Distinctive: line 22
Ensure the candidate ref is present and sufficiently current (fetch when appropriate).
- Distinctive: line 48
Existing function: Keep its location when the feature changes a line inside it, even if a separate ordering convention would place it …
- Distinctive: line 59
If a mandatory formatter or check requires wider changes, identify the constraint and make the smallest technically valid change.
- Distinctive: line 68
Check each moved block, reflowed signature, and formatting-only hunk for a necessary feature-related reason.
- Distinctive: line 69
Ensure the actual behavior change remains visible as a localized diff where feasible, and run relevant tests.
≈ “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
Reviewable Branch Diffs
Objective
Make the aggregate Git branch diff easy for a human to review. Coding standards describe good code; this skill decides which changes on the current branch should be made to satisfy those standards. Leave unrelated pre-existing violations in place.
The standards themselves come from user instructions, other skills, repository instructions, or tools—not from this skill.
1. Establish the Git baseline
Identify the intended integration branch using Git only:
- If the user or repository workflow explicitly identifies the integration branch, use it.
- Otherwise, determine the relevant remote with
git remote. If more than one exists, use available Git tracking/configuration information to select the right one; do not silently pick an arbitrary remote. - Resolve that remote's default branch via
git symbolic-ref --quiet --short refs/remotes/<remote>/HEAD. If the symbolic ref is missing, consultgit ls-remote --symref <remote> HEADwhen network access is appropriate. This queries the remote'sHEAD, not the current checkout'sHEAD. - Use the resulting remote-tracking branch as the candidate integration branch. A remote default is not proof of the branch's actual merge destination. If evidence conflicts or is ambiguous, establish the target before applying scope-sensitive rules.
- Ensure the candidate ref is present and sufficiently current (fetch when appropriate).
Inspect the committed changes and the prospective complete working-tree diff:
git diff --find-renames <base-ref>...HEAD
git diff --find-renames "$(git merge-base <base-ref> HEAD)"
git ls-files --others --exclude-standardThe three-dot form compares committed branch changes with their merge base. The second command compares that same baseline with the current working tree, including staged and unstaged tracked changes. The last command discovers untracked files that neither diff includes.
2. Determine the eligible change scope
| Code relative to the baseline | Treatment |
| Newly introduced code | Apply the applicable coding standards. |
| Existing code changed for the feature | Change only what is necessary; preserve unrelated surrounding code. |
| Existing code unchanged by the feature—even in a touched file | Leave pre-existing violations untouched. |
A change to one line does not make an entire function or file eligible for reorganization.
3. Apply conventions within that scope
Structural organization
- Existing function: Keep its location when the feature changes a line inside it, even if a separate ordering convention would place it elsewhere. Otherwise, a small logic change becomes distant deletion/addition blocks.
- New function: Insert it at the location prescribed by the applicable coding rules; it has no prior location to preserve.
Declarations and type annotations
Apply required typing conventions to newly introduced functions and parameters. Do not retrofit unrelated existing signatures. When a feature changes an existing function, keep annotation changes limited to genuinely new or modified declarations and avoid incidental signature reflow.
Formatting
Format newly introduced or necessarily modified code without reformatting unrelated existing lines. If a formatter rewrites larger regions, retain the required edits and revert unrelated churn where feasible.
If a mandatory formatter or check requires wider changes, identify the constraint and make the smallest technically valid change; do not silently accept a large formatting-only diff.
4. Preserve the branch-level review boundary
A separate cleanup commit on the same branch still appears in its aggregate diff. Unrelated cleanup needs a separate scope, not merely a separate commit.
5. Verify the result
- Reinspect the full diff against the resolved baseline, including outstanding tracked edits and untracked files.
- Check each moved block, reflowed signature, and formatting-only hunk for a necessary feature-related reason. Remove incidental cleanup.
- Ensure the actual behavior change remains visible as a localized diff where feasible, and run relevant tests.
- Report any unavoidable scope expansion or unresolved baseline ambiguity.
This skill is agent guidance, not a guaranteed Git policy gate. Where enforcement must be deterministic, use an independently validated checker or hook appropriate to the agent runtime.
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.

