AI NewsDev toolsAnnouncement

Shrink-anything deletes dead code if the tests still pass, 19 languages

Shrink-anything deletes dead code in 19 languages and keeps a cut only if your tests still pass. The repo reads 179 stars two days after launch.

AI News

Editorial2 min read

LinkedInX
GitHub social card for the shrink-anything repository

Image: GitHub

Why it mattersCoding agents write code faster than anyone deletes it. This is a safety-first cutter for the backlog they leave behind.

A new tool deletes dead code and dead files in 19 languages. It keeps each cut only if your own tests still pass. Shrink-anything was published on GitHub on 23 November 2026 and reads 179 stars today. It is written in Rust and licensed MIT.

The method the project chose

The tool uses a name-counting pass, not a call graph. The README states the trade: a count can only miss dead code, never invent it. The project reads source files and counts the names each file uses. It then picks candidates to cut. Supported languages: Python, JavaScript, TypeScript, Rust, Go, Java, Kotlin, C sharp, C, C++, PHP, Ruby, Swift, Dart, Lua, Luau, Elixir and Shell.

The safety rule is also short. A cut stays only if your test command still exits with success. The same number of tests must also run. The user supplies the test command. The tool runs it after each cut. If the command fails, or the test count falls, the cut is reversed.

The numbers the author published

The project README reports three demo runs:

  • A TypeScript cart example, from 106 lines, 5 files and 3 dependencies to 58 lines, 3 files and 1 dependency. A 45 percent cut.
  • A Python shop example, from 142 lines to 86 lines. A 39 percent cut.
  • A Go store example, from 89 lines to 55 lines. A 38 percent cut.

A fourth figure measures the token cost of reading the shrunken codebase. The README says a coding agent then needed 46 percent fewer tokens to read the TypeScript cart. These are the author's own figures on toy projects, not a measurement on a real codebase. A team running shrink-anything on a real repository will see a different cut.

Why this exists

The author writes that coding agents write code faster than anyone deletes it. Dead code written by an agent is a drag on the next agent run, because the agent reads it. The tool is written for that specific problem. A user points it at the folder the agent filled. The test suite is the one that was there before the agent arrived.

The limits are stated plainly. A name count cannot see a dynamic call, a reflection path, or a public API that no test touches. Removing a public export that nothing in the test suite imports is a real risk. A safer first run points at an internal module with real test coverage. Do a dry run before the real one.

A small point on traction. The repository is two days old, written in Rust, with 179 stars and 10 forks. The star count is a fast start, not a usage count. The tool has not been audited by a third party, and the figures above are the author's own. Readers who want a wider check can run it on a throwaway branch of a real repository. Then read the diff.

Source

SourceGitHub

This item was written by an AI system from the linked source. Reveneau is responsible for what it publishes.

Share
LinkedInX
Start a project