code-slimming-cleanup

Detects dead code, duplication, oversized files, and unused dependencies for safe code reduction.

Updated May 25, 2026
One-click install
npx skills add https://github.com/gaopengbin/code-slimming-cleanup-skill --skill code-slimming-cleanup-gaopengbin
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: code-slimming-cleanup
Source: https://github.com/gaopengbin/code-slimming-cleanup-skill/tree/main/skills/code-slimming-cleanup
Command: npx skills add https://github.com/gaopengbin/code-slimming-cleanup-skill --skill code-slimming-cleanup-gaopengbin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Codebases accumulate dead code, duplicated logic, oversized files, and unused dependencies over time, and cleaning them up often turns into risky, uncontrolled refactors. This Skill provides a conservative, structured procedure for reducing code size while preserving behavior and proving code is dead before deleting it. ## Core Features & Use Cases - Seven-step scan procedure: Excludes build artifacts, checks version control hygiene, flags oversized files, detects duplication, finds dead code, and audits dependencies against actual imports. - Severity-ranked reporting: Outputs findings as Critical, Warning, or Info in a structured table format with locations, line counts, and suggested actions, ending with a quantified impact summary. - Safety guardrails: Requires proof before deletion (compiler warnings, reference searches, passing tests), keeps cleanup surgical, and preserves behavior unless explicitly told otherwise. - Use Case: After a large feature refactor, run this Skill to identify unused imports, orphaned helper functions, duplicated utilities across files, and dependencies in package.json that nothing imports, then receive a prioritized cleanup report. ## Quick Start Ask the AI to scan this repository for dead code, duplication, oversized files, and unused dependencies, then produce a severity-ranked cleanup report.

Frequently Asked Questions about code-slimming-cleanup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely remove dead code from a repository?▼

Prove code is dead before deleting it by checking compiler or linter unused warnings, searching for references across the repo, or confirming tests still pass after removal. If none of these verifications succeed, report the code as suspicious rather than deleting it.

How to find unused dependencies in package.json?▼

Cross-reference every entry in dependencies and devDependencies against actual imports in source files, using tools like npx depcheck or npx knip. Packages only used by build scripts or test runners should move to devDependencies, while unimported packages can be removed.

When should duplicated code be consolidated into a shared module?▼

Consolidate only when function bodies are exact or near-identical matches and the duplicated logic exceeds about 10 lines. Similar-looking code with different edge-case handling or control flow should stay separate, and trivial duplication under 5 lines is only worth noting.

Does this cleanup approach work for non-JavaScript projects?▼

Yes, the same rules apply to Python, Go, and Rust projects using equivalent tooling such as vulture, go mod tidy, staticcheck, or cargo-udeps. The dependency audit applies to the equivalent manifest file like requirements.txt, go.mod, or Cargo.toml.

What are the limitations of automated code cleanup?▼

Cleanup stays surgical and behavior-preserving, so it avoids reformatting unrelated files, changing public APIs, or rewriting working code in a preferred style. Aggressive cleanup involving broad deletion or API changes requires explicit user approval before proceeding.