skrub deletes the dead code your agent leaves behind, points it back at what the repo already has, and starts every session knowing what the product is and whose patterns to follow.
on one real pull request: 8 files, 99 added lines. skrub found 44 of them the agent didn't need: 13 safe to delete and 4 judgment calls for you, plus 3 places it rewrote code the repo already had. review them yourself.
[ github ][ try the review ]npx @amishaba/skrub
clean code can sound like a standard from old style books, but agents build on whatever is already there. if the base is strong, so is everything built on it: better code is better context for every agent that touches it next. (on clean code, the same agent used 7% fewer tokens and re-opened files 34% less.)
it belongs in code too: reuse what's already there, add an abstraction only when it earns its place, and name things so they can be found again.
deleting and reusing can go too far. ten screens sharing one api call looks tidy, until that call does heavy backend work and each screen throws most of it away. so skrub only deletes on its own what knip finds unused, then runs the typecheck and puts back anything that broke. anything that needs judgment, like a duplicate or a wrapper that looks pointless, it hands to you.
models keep changing and getting better. i can't write better code than a frontier model, but i can give it a baseline: the conventions this codebase already follows, read from the code itself.
a rule in a CLAUDE.md is a request, not a guarantee: across 481 of those files, only 4.4% of the security rules had anything actually enforcing them. so skrub turns what it can into checks, and leaves the writing for judgment calls.
the best code is the change the user actually needed. before it builds, the agent works out the problem behind the ask, and copies what's conventional in its space: for a devtool, how sentry, braintrust or posthog do it. users already know those patterns, so they don't have to learn yours.
npx @amishaba/skrub initevery session starts with what the product is, who uses it, and whose patterns to follow. on its first session in agentdiff, the agent wrote:
before the agent adds csv.ts, skrub points it at what the repo already has:
in this demo the agent writes the file anyway, so the rest of the story has something to clean up.
the agent wrote 99 lines across 8 files. skrub finds 44 it didn't need: an import nothing uses, a file nothing imports, a comment that only repeats the code, and more. it says so once, in at most ten lines.
skrub fix deletes the 13 nothing uses, runs the typecheck, and puts back anything that broke.
4 judgment calls, like a wrapper or a copy of a helper, wait for you: delete them, or keep one with a reason. skrub never asks twice, and a clean change never stops at all.
init sets up the product and conventions in .claude/conventions.md, three hooks (session start, before a new file, before the agent stops), and a skill with a product engineer's guide.
every safe finding applied at once, then typecheck, tests and build still pass. the version before knip broke 4 of them.
dead code and exports nothing else needed, from one fix. typecheck, tests, build and lint all still pass.
the same csv task, with and without skrub. with it, the agent read the product guide, ran fix, and said no to a flag that would have done nothing.
told to put its summing logic in a new file, the agent reused columnTotals instead, and said why.
on its first session in agentdiff, the agent picked braintrust, langsmith and promptfoo. you approve the edit, so you can correct it.