shrink-anything identifies dead code by counting name occurrences: a name is considered deletable only if it appears nowhere else in any file, string, template, or configuration besides its own definition. This ensures it may miss some deletions but will never make false positives. It detects dead code (in 19 languages), unreferenced files, unused dependencies, unreferenced images, fonts, and audio files, as well as duplicate files. The cut command deletes items in batches and then runs your specified check commands; if a check fails, it uses binary search to identify the specific item causing the failure, restores it, and ensures the number of tests is not less than before deletion. Public methods, library exports, and files loaded by convention in frameworks are not automatically deleted; these are left for agent judgment or require the --aggressive flag. The repository includes TypeScript, Python, and Go example projects along with before-and-after comparisons.
Why it matters If tests fail, the problematic change is reverted, allowing all modifications to be undone byte-for-byte; it can be used as a Claude Code plugin, MCP server, or skill for agents.
Stars 336 (+57 / 24h)
Reasoning
- 57 new stars in 24 hours, total stars 336 (indicating attention only); MIT license, created on 11/23
- The README clearly explains the detection rules, what is not deleted, and states that "projects without tests should only be scanned; do not trust deletion results"
Usage
npm i -g @el4cteo/shrink-anything(orcargo install shrink-anything). First runshrink-anything scanto see what can be deleted, then runshrink-anything go --agent claude -- npm test; if unsatisfied, useshrink-anything undoto revert- Integrate with agents:
claude mcp add shrink-anything -- shrink-anything mcp, or install the plugin after running/plugin marketplace add EL4CTEO/shrink-anything
Risks
- The safety of deletions depends entirely on your test coverage; the deletion ratios in the example projects are demonstrations with intentionally planted dead code, so real-world projects will see much less
--agentmode allows coding agents to modify code and consumes model quotas; the project was created less than a week ago