---
title: "Delete tests with their feature · Agent Wranglers"
url: https://agentwranglers.se/playbook/architecture/dead-code/delete-tests-with-feature
updated: 2026-10-20
licence: "All rights reserved"
---

# Delete tests with their feature

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

- Level: Required
- Chapter: [Dead code](https://agentwranglers.se/playbook/architecture/dead-code)
- Rule: When you remove a feature, remove its tests, fixtures and settings in the same change.
- How: Search for the feature's name across tests, fixtures, settings and docs before you merge. Tests for removed code keep dead helpers alive and slow every run.
- Check: The dead code finder covers test folders too. In review, a removal change also deletes the matching tests.

Example:

```text
Removed: src/gift-cards/, tests/gift-cards/, fixtures/gift-cards.json, GIFT_CARDS_ENABLED
```

**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-tests-with-feature`.

- Previous: [Remove unused dependencies](https://agentwranglers.se/playbook/architecture/dead-code/remove-unused-dependencies)
- [Dead code](https://agentwranglers.se/playbook/architecture/dead-code)
