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).
frontend ruleP1universalStack: universal
dryreuseduplicationmaintainability
Search for existing utilities and types before adding duplicates
Before creating a type, helper, or block, check whether it already exists; duplicating logic in a third place is a signal to extract and reuse.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codejavascript
| 1 | // third copy of the same alphabet-pagination logic |
| 2 | const alphabet = ['A','B','C', /* ... */]; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codejavascript
| 1 | import { ALPHABET } from 'config/constants'; |
Explanation (EN)
Objašnjenje (HR)