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 ruleP2universalStack: typescript
typesorganizationyagni
Keep a type next to its domain owner until a second domain needs it
Define a type alongside the type it belongs to; extract to a shared file only when an unrelated type also uses it.
PR: hegnar-forum-web · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codets
| 1 | // types/Vote.ts created for a Vote field used only by Thread |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | // types/Thread.ts keeps Vote since it's always tied to the Thread domain for now |
Explanation (EN)
Objašnjenje (HR)