You Aren’t Gonna Need It

  • Don’t write code unless it’s required now.
  • Avoid solving problems that don’t yet exist.
  • Focus on delivering the simplest solution for today.

why yagni matters

  • save time
  • reduce complexcity
  • prevent overengineering
  • encourage itrative development Eg.
// Overengineered:
interface User {
  id: number
  name: string
  address?: {
    street: string
    city: string
  }
}
// Keep it simple:
interface User {
  id: number
  name: string
}

when to break yagni

  • Performance Requirements
  • Future Scalability
  • Security Requirements
  • Error Handling in Critical Systems

If the cost of not doing it now outweighs doing it later, it might make sense to break YAGNI.

YAGNI Guidelines for Utility Libraries ✅ DO Build: Current Requirements Only Extension Points (Not Extensions) Hooks/callbacks for customization Composition over configuration Most common use case = zero config

Clear, Minimal API

Small surface area Each method has clear purpose