- Home
- Skills
- Petekp
- Agent Skills
- Dead Code Sweep
dead-code-sweep_skill
- Makefile
2
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
3 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill petekp/agent-skills --skill dead-code-sweep- SKILL.md7.1 KB
Overview
This skill automates systematic identification and safe removal of dead code, redundant implementations, and orphaned artifacts in codebases. It is tuned for repositories maintained or refactored by coding agents, where overlooked remnants commonly accumulate. The workflow inventories the project, detects likely cruft, generates a confidence-ranked report, and removes confirmed dead code only after user approval.
How this skill works
The skill first scopes the analysis to a provided directory or the whole repo, maps entry points, and estimates language and build structure. It runs parallel detectors for orphaned files, unused exports, redundant implementations, stale compatibility shims, dead branches, orphaned tests, and unused dependencies. Each candidate is verified by tracing references, checking git history, and respecting dynamic usage patterns before being marked confirmed or needs review.
When to use it
- After multiple automated refactors or agent-driven merges
- When the codebase feels cluttered or builds include many unused files
- Before major upgrades to reduce regression risk from hidden cruft
- When preparing a library/package for public release to shrink surface area
- During maintenance sprints to lower technical debt and improve readability
Best practices
- Provide an explicit scope (directory or package) to limit analysis and speed results
- Review the generated report and approve only safe categories for automatic removal
- Watch for framework conventions and dynamic registration; mark uncertain items as needs review
- Run tests, typechecks, and builds after each approved cleanup and revert any breaking removals
- Prefer removing clusters of nearby dead code together to reduce follow-up churn
Example use cases
- Prune an agent-refactored frontend repo that has duplicate component implementations
- Clean a Python package with orphaned helper modules and unused exports before publishing
- Audit a monorepo to find packages with unused dependencies and orphaned test suites
- Reduce noise in CI by removing dead branches and unreachable conditional paths
- Prepare a repository for new contributors by shrinking codebase and clarifying entry points
FAQ
The skill treats such patterns cautiously: it detects likely dynamic usage, marks those items as needs review, and only confirms removal after explicit verification or user approval.
Will you modify public APIs used by external consumers?
No. Public API symbols are flagged as needs review rather than auto-removed. Only internal, non-public items are eligible for confirmed cleanup.