---
title: "Remove unused dependencies · Agent Wranglers"
url: https://agentwranglers.se/playbook/architecture/dead-code/remove-unused-dependencies
updated: 2026-10-20
licence: "All rights reserved"
---

# Remove unused dependencies

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Required
- Chapter: [Dead code](https://agentwranglers.se/playbook/architecture/dead-code)
- Rule: Uninstall packages that no code imports. Each one adds install time, attack surface and update work.
- How: Run a dependency checker in the build. Remove what it reports from the manifest and the lock file.
- Check: A tool such as depcheck, knip, composer-unused or deptry fails the build on an unused package.

Example:

```text
$ npx depcheck
Unused dependencies
* left-pad
* moment
```

**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/remove-unused-dependencies`.

- Previous: [Remove flags that never change](https://agentwranglers.se/playbook/architecture/dead-code/remove-stale-flags)
- Next: [Delete tests with their feature](https://agentwranglers.se/playbook/architecture/dead-code/delete-tests-with-feature)
- [Dead code](https://agentwranglers.se/playbook/architecture/dead-code)
