Agent Wranglers

SOLID and DRY Required

Build only what is needed now

Do not add interfaces, factories, options or layers for needs that do not exist yet.

How to do it

One implementation needs no interface, unless it sits at a boundary such as a database or an outside service. Add the abstraction when the second case arrives. Delete settings that nobody changes.

Example

# Bad: a factory and an interface for the only exporter there will ever be
class ExporterFactory:
    def create(self) -> "IExporter": return CsvExporter()

# Good: call the one thing directly
def export_orders(orders): return to_csv(orders)
// Bad
class ExporterFactory { create(): Exporter { return new CsvExporter(); } }

// Good
const exportOrders = (orders: Order[]) => toCsv(orders);

How to check

In review, every interface has two implementations or sits at a boundary. Every option has a caller that sets 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/no-speculative-abstraction.