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: general
dryinheritancereuse
Do not reimplement behavior the base class already provides
Before adding manual logic (deduping, normalization, etc.) check whether the inherited/base implementation already does it; duplicating it is redundant and risks divergence.
PR: hegnar-ws · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | const articles = repo.byTagName(tag); |
| 2 | let teasers = await articles.landingPageTeasers(); |
| 3 | // manual fallback / dedupe that BaseRepository already handles |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | const teasers = await repo.byTagName(tag).landingPageTeasers(); // base asArray() already covers it |
Explanation (EN)
Objašnjenje (HR)