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 ruleP1universalStack: node
architectureabstractionapi-designencapsulation
Wrap a generic external/integration service behind a domain-specific interface
Expose intention-revealing domain methods (e.g. sendPasswordResetEmail) over a generic third-party client, so callers depend on your app's interface rather than the raw underlying API.
PR: hegnar-investor-ws · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | await this.mailer.sendMail({ to, subject, template: 'reset', context }); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | await this.mailService.sendPasswordResetEmail(user); |
| 2 | await this.mailService.sendThreadDeletedEmail(user, thread); |
Explanation (EN)
Objašnjenje (HR)