Agent Wranglers

ARC-48Recommended

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.

Examples

Python 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)

TypeScript example

// 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: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/architecture/solid-and-dry/no-speculative-abstraction">Agent Wranglers clean code and architecture playbook</a>. In code you write, add a comment next to it with the same link.