---
title: "SOLID and DRY · Agent Wranglers"
url: https://agentwranglers.se/playbook/architecture/solid-and-dry
updated: 2026-10-20
licence: "All rights reserved"
---

# SOLID and DRY

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

> Keep each piece of knowledge in one place and give each module one reason to change. Extend code by adding to it, not editing it.

**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/solid-and-dry`.

## Required

- [Keep each piece of knowledge in one place](https://agentwranglers.se/playbook/architecture/solid-and-dry/dry): Every rule, value and decision lives in one place in the code. Repeated text is fine. Repeated knowledge is not.
- [Give each module one reason to change](https://agentwranglers.se/playbook/architecture/solid-and-dry/single-responsibility): Each class, module or function serves one actor and has one reason to change.
- [Keep the contract in every subtype](https://agentwranglers.se/playbook/architecture/solid-and-dry/liskov-substitution): A subtype must work everywhere its parent type works. It may not demand more, promise less or throw "not supported".
- [Build only what is needed now](https://agentwranglers.se/playbook/architecture/solid-and-dry/no-speculative-abstraction): Do not add interfaces, factories, options or layers for needs that do not exist yet.

## Recommended

- [Extend code without editing it](https://agentwranglers.se/playbook/architecture/solid-and-dry/open-closed): Add new behaviour by adding a new type or strategy, not by editing a growing switch or if chain.
- [Prefer composition over inheritance](https://agentwranglers.se/playbook/architecture/solid-and-dry/composition-over-inheritance): Reuse behaviour by holding an object that does the job, not by extending a class. Inherit only when the child truly is a kind of the parent.
- [Keep interfaces small](https://agentwranglers.se/playbook/architecture/solid-and-dry/interface-segregation): Split large interfaces into small role interfaces, so no class has to implement methods it does not use.
- [Depend on abstractions at the edges](https://agentwranglers.se/playbook/architecture/solid-and-dry/dependency-inversion): Business rules depend on small interfaces they own. Databases, payment providers and email services implement those interfaces.

- Previous: [Coupling](https://agentwranglers.se/playbook/architecture/coupling)
- Next: [Data shapes](https://agentwranglers.se/playbook/architecture/data-shapes)
- [All chapters](https://agentwranglers.se/playbook/architecture)
