razor
Skill17 starsChanged 9 months agoMITView on GitHub
Minimize local diff size against merge base for uncommitted branch work using only behavior-preserving, scope-preserving architectural reductions.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- AmosChenZixuan/Agentic-working-contracttheir own version, first seen Jul 2, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- AmosChenZixuan/Agentic-working-contract★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 9 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
Always anchor to merge base: MB=$(git merge-base <base-ref> HEAD) (origin/latest by default).
- Very specific: line 17
Use unified working-tree diff only: git diff "$MB".
- Distinctive: line 19
Only propose/apply behavior-preserving, scope-preserving reductions.
- Distinctive: line 20
Never generate functionality-loss or scope-reduction options.
- Distinctive: line 21
Do not remove/trim comments or doc-comments.
- Distinctive: line 27
Prefer ideas that remove whole cross-file patterns or flows, not local line edits.
- Distinctive: line 28
Treat file-local cleanups as fallback only after high-impact PR-wide ideas are exhausted.
- Distinctive: line 29
Read every line of every file in the diff on every iteration.
- Very specific: line 30
Update TRIM_CODEX.MD every iteration before execution, then refresh after re-measurement.
- Distinctive: line 31
Run formatting on touched files and run targeted validation each pass.
- Distinctive: line 32
Never use destructive git commands.
- Very specific: line 49
Write/update TRIM_CODEX.MD with:
- Distinctive: line 67
Before stats and after stats (insertions, deletions, churn).
≈ “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
Razor
Reduce local diff size with merge-base-anchored architectural planning and behavior-preserving execution only.
Core Iteration Directive
On every iteration, follow this exact directive:
"Deeply analyze this implementation across the entire PR (not file-by-file in isolation), and create a detailed plan called TRIM_CODEX.MD with the most impactful architectural ideas to dramatically reduce the total size of this PR, without reducing scope or behavior. Comments do not count."
Non-negotiables
- Always anchor to merge base:
MB=$(git merge-base <base-ref> HEAD)(origin/latestby default). - Use unified working-tree diff only:
git diff "$MB". - Include untracked code-file lines in insertion totals.
- Only propose/apply behavior-preserving, scope-preserving reductions.
- Never generate functionality-loss or scope-reduction options.
- Do not remove/trim comments or doc-comments. Comment lines do not count toward reduction targets.
- Keep optimization priority:
- Primary: reduce non-comment insertions.
- Secondary: reduce non-comment total churn.
- Optimize at PR architecture level first:
- Identify duplication and redundant abstractions spanning multiple files/components.
- Prefer ideas that remove whole cross-file patterns or flows, not local line edits.
- Treat file-local cleanups as fallback only after high-impact PR-wide ideas are exhausted.
- Read every line of every file in the diff on every iteration.
- Update
TRIM_CODEX.MDevery iteration before execution, then refresh after re-measurement. - Run formatting on touched files and run targeted validation each pass.
- Never use destructive git commands.
Workflow
- Establish base and merge base.
- Measure unified diff (
status,numstat,name-status, untracked files, untracked code lines). - Compute baseline metrics:
- insertions
- deletions
- total churn
- comment-line additions (reported separately, not targeted)
- Full-diff read (mandatory):
- For each file in
git diff --name-status "$MB", read full current file contents. - For modified files, also review
git diff "$MB" -- <file>hunks.
- For each file in
- Deep architectural analysis:
- Identify structural duplication and avoidable abstraction layers across the full PR surface.
- Map cross-file data/control flow to find consolidation cuts that remove entire repeated paths.
- Rank ideas by expected PR-wide churn reduction; prioritize multi-file high-leverage cuts.
- Write/update
TRIM_CODEX.MDwith:- Goal and invariants.
- Merge-base baseline and divergence.
- Runtime/test hotspot ranking.
- Architectural diagnosis of churn drivers.
- Ranked behavior-preserving architectural ideas with explicit PR-wide scope (estimated insertion/churn savings, risk, validation notes).
- Clear separation of
PR-wide architectural cutsvslocal cleanup(local cleanup only when no higher-impact architectural cuts remain). - Ordered execution sequence and validation gates.
- Iteration history.
- Apply viable behavior-preserving ideas.
- Format touched files.
- Run targeted validation.
- Re-measure and refresh
TRIM_CODEX.MDwith before/after metrics and applied/skipped status. - Rerun fresh planning on the updated tree.
Output contract
Always return:
- Base ref and merge-base SHA.
- Before stats and after stats (insertions, deletions, churn).
- Primary and secondary percent reductions.
- Comment-line additions count (reported separately).
- Ranked behavior-preserving ideas and applied changes.
- Confirmation
TRIM_CODEX.MDwas refreshed this iteration. - Confirmation every diff file was fully read this iteration.
- Explicit statement whether any additional behavior-preserving, scope-preserving reductions remain after fresh rerun.
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.

