Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
backend ruleP2universalStack: TypeScript
yagniapi-designsimplicityabstraction
Prefer purpose-built methods over generic configurable parameters
Rather than adding a flexible searchBy/columns parameter for a single current need, expose a focused method (e.g. searchInstrument) and add another when a genuinely different need appears — YAGNI.
PR: hegnar-shareholders-ws · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | findAll({ search, searchBy }: { search?: string; searchBy?: (keyof Instrument)[] }) {} |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | searchInstrument(term: string) { |
| 2 | // searches by symbol or name internally |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)