YAGNI
A software development principle that says to build what you need now rather than add features or complexity for needs you can only guess at. Revisit those ideas when there is a concrete requirement.
Also known as: You Aren't Gonna Need It
What YAGNI means
YAGNI stands for You Aren’t Gonna Need It. It comes from Extreme Programming (XP), where it serves as a rule of thumb: don't build a capability just because someone can imagine a use for it. The point isn't that the idea will never be useful. It's that you can often make a better decision once you know who needs it and what they need it to do.
Speculative code costs more than the time it takes to write. Every extra setting, extension point, or supported mode creates behavior that someone has to understand and keep working. If the real request turns out to be different from what you expected, you may have to remove the original design before you can build the right one.
How to make the call
Start with the acceptance criteria: what must work for this change to be done? If a proposed feature doesn't help meet those criteria or satisfy an existing constraint, ask what would justify revisiting it. “A second customer asks for a different file format” is a useful trigger. “We might want more flexibility” isn't a reason to build a plugin system today.
Deferring a feature doesn't mean making the code hard to change. Give the current behavior clear names, keep unrelated responsibilities separate, and test what callers actually rely on. When a second use case arrives, compare it with the first. That comparison tells you more about which code to share than a diagram of all the use cases you might someday support.
Example: sending invoices
Suppose a billing tool needs to email a PDF when an invoice is issued. Build that path: generate the PDF, send it through the existing email service, and handle delivery failures as required. Don't introduce a notification workflow engine to support possible SMS, push, and chat integrations. If SMS becomes a requirement, it might need a short payment link rather than an attachment, and it might have different retry rules. Knowing those differences helps you decide whether the two channels need a shared interface at all.
What not to defer
YAGNI is about speculative scope, not necessary quality. Access checks for the invoice, tests for billing behavior, and an agreed delivery guarantee belong to the current feature. Nor does YAGNI prohibit planning. If changing a public API later would force many clients to migrate, and an upcoming requirement is already confirmed, it can be cheaper to settle the compatibility question now without implementing the new behavior yet.
KISS and YAGNI address different decisions. YAGNI asks whether a capability belongs in the current scope. KISS asks how to keep the implementation simple once you've decided it does.
In interviews
In a system design round, an interviewer may ask why you didn't add a more flexible component. Tie your answer to the stated requirements and name the trade-off: what the component would cost to operate or maintain, what would make it worthwhile, and how you could introduce it later. If a feature is already required, explain how you'll meet it rather than using YAGNI to rule it out.