Guides
Remove dead code only with evidence
Use an existing repository analyzer to remove unused exports, files, branches, or dependencies without deleting dynamic or externally consumed paths.
Answers: use a coding agent to remove dead code safely · Updated
Dead-code cleanup starts only when the project already has a trustworthy unused-code, dependency, compiler, or coverage analyzer. Every deletion must survive checks for reflection, dynamic imports, registration, configuration, generated code, public exports, and external consumers.
Let existing tooling produce the list
Run the analyzer the repository already trusts and record its exact command. Do not introduce a new analyzer merely to create work.
- Deduplicate findings against earlier dispositions.
- Keep the analyzer output as evidence.
- Treat low coverage and text-search absence as insufficient proof.
Challenge every deletion
Before removing a finding, rule out dynamic and external references that static analysis may not see. Uncertainty is a reason to park the item, not permission to delete it.
- Protect public APIs, migrations, entry points, and compatibility shims.
- Rerun the analyzer and project gate after each coherent deletion.
- Never weaken the analyzer to produce a clean report.
Finish with both analyzer and build clean
A completed shift has no actionable analyzer findings, records every uncertain consumer, and passes the repository’s final build or package check.
Run the dead-code cleanup ready shift using only the analyzer already configured in this repository. Park every uncertain reference.Start with a bounded prompt
This prompt names the outcome and preserves Nightshift’s review boundary. Paste it into the supported coding host from the project you want to change.
Run the dead-code cleanup shift using only this repository's existing analyzer. Confirm dynamic, public, generated, and external references before each deletion.What this workflow does not claim
- No analyzer means the shift is unsupported; text search or intuition alone is insufficient evidence.
- Public APIs, migrations, entry points, and uncertain dynamic references stay untouched.
Evidence and sources
These links support the released behavior, public outcomes, or problem language described on this page.