Dead code Required
Delete code that nothing uses
Remove unused functions, classes, exports, parameters, routes and files as soon as they stop being used.
How to do it
Run a dead code finder in the build. Delete what it reports, or mark an entry point it missed. Dead code misleads readers and agents, who copy it and keep it alive. Old code in comments goes too, as the comments chapter explains.
Example
// Bad: kept "just in case", and an agent will copy it
export function legacyPriceWithVat(price: number) { return price * 1.25; }
// Good: deleted, with the history in version control
# Bad: kept "just in case", and vulture reports it as unused
def legacy_price_with_vat(price):
return price * 1.25
# Good: deleted, with the history in version control
How to check
A tool fails the build on new unused code. Examples are knip, vulture, and PHPStan with a dead code extension such as shipmonk/dead-code-detector.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers architecture playbook: https://agentwranglers.se/playbook/architecture/dead-code/delete-unused-code.