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).
fullstack ruleP2project specificStack: TypeScript
consistencyarchitecturepatterns
Follow the established pattern already used elsewhere in the codebase
When the project consistently uses a pattern (e.g. the repository pattern for data access), new code should follow it rather than introducing a one-off divergent approach.
PR: hegnar-user-ws · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | // rest of codebase uses repositories; this reaches into the data source directly |
| 2 | await this.dataSource.transaction(async (m) => { /* ad-hoc */ }); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | // reuse the repository pattern used everywhere else |
| 2 | await this.userRepository.storeProfile(data); |
Explanation (EN)
Objašnjenje (HR)